help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: file name aliases, bookmarks and abbrevs


From: Kevin Rodgers
Subject: Re: file name aliases, bookmarks and abbrevs
Date: Wed, 09 Jul 2003 10:18:40 -0600
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

Matthias Meulien wrote:

I have a collection of bookmarks mapped to long directory names; for
example `/usr/share/emacs/21.2.93/lisp/' and
`/[suu/root@localhost]/root/' (I use the nice tramp package) are
mapped respectively to `lisp' and `root'.

I have written a function to create an abbrev per bookmark, so I can
use bookmarks names in the minibuffer when "finding files" (`C-x C-f
root C-x a e ... RET' ):

(defun alt-bookmark-to-abbrevs ()
  "Create abbrevs based on `bookmark-alist'."
  (dolist (bookmark bookmark-alist)
  (let* ((name (car bookmark))
         (file (bookmark-get-filename name)))
    (define-abbrev global-abbrev-table name file))))

I love it! But all modes share the `global-abbrev-table', so strings
like `lisp' and `root' always expand...

Does there exists a minibuffer abbreviation table ? Or a mechanism of
"conditional expansion" ? Perhaps using `pre-abbrev-expand-hook' and a
more sophisticated `alt-bookmark-to-abbrevs'... Any idea welcome!

The minibuffer is in Fundamental mode.  So instead of

        (define-abbrev global-abbrev-table ...)

do

        (define-abbrev fundamental-mode-abbrev-table ...)

--
Kevin Rodgers



reply via email to

[Prev in Thread] Current Thread [Next in Thread]