;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; set the machine-name variable and function (defvar machine-name (system-name) "Machine name for this system.") (defun machine-name () "Return the name of the machine you are running on, as a string. Same as (system-name) up to the first '.'" (concat machine-name)) (let ((i 1) (s (system-name)) (sl (length (system-name)))) (while (< i sl) (if (string-equal "." (substring s i (1+ i))) (setq i (length s)) ;; bail out (progn ;; keep looping (setq machine-name (substring s 0 (setq i (1+ i)))) ) ) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; rewrite mode-line (A B C ... Y Z) as (A B C .. Y foo bar baz Z) (let ((revx (reverse default-mode-line-format))) (setq default-mode-line-format (reverse (append ;; Things to insert penultimately: (reverse (list (concat "--" (user-login-name) "@" machine-name ;; or use (system-name) if you like ) (car revx) )) (cdr revx))))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;