David Combs wrote:
> What I really want to know is that I *arrived* there
> via a *SYMLINK*  --  maybe shouted out at me in
> uppercase or something!
>
> So often, for me at least, if I've gotten to some file
> via a symlink -- hey, something's *wrong*.
>
> So, for me, anyway, some (optionally *loud*!) mark or word
> or other indication *on the buffer-name*, both in
> *Buffer List* and in the mode-line too.
>
> Again, LOUD -- since for me getting to some file via
> a symlink is really unusual, and for sure I want
> to know about it -- and be reminded of it each time
> I deal with that file (buffer).

I don't know what to do about the *Buffer List*, but here's a start:

;;; symlink-phobia-mode.el --- Indicate files visited via symbolic links

(defvar symlink-phobia-mode-indicator
  (concat " " (propertize "SymLink" 'face 'font-lock-warning-face)))

(define-minor-mode symlink-phobia-mode
"Minor mode to indicate when the visited file name is a symbolic link.
It also indicates when the file name's directory includes any symbolic links."
nil (:eval symlink-phobia-mode-indicator) nil
(require 'font-lock))


(defun turn-on-symlink-phobia-mode ()
  "Turn on `symlink-phobia-mode'."
  (when (or (file-symlink-p buffer-file-name)
            (not (equal buffer-file-name buffer-file-truename)))
    (symlink-phobia-mode 1)))

(add-hook 'find-file-hooks 'turn-on-symlink-phobia-mode)
(add-hook 'find-file-not-found-hooks 'turn-on-symlink-phobia-mode)

(provide 'symlink-phobia-mode)

;;; symlink-phobia-mode.el ends here

--
Kevin Rodgers
_______________________________________________
Help-gnu-emacs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

Reply via email to