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

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

Re: how to set local key in dired to use vm on file


From: Pascal Bourguignon
Subject: Re: how to set local key in dired to use vm on file
Date: 21 Nov 2004 01:26:59 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3

Gilbert Harman <harman@Princeton.EDU> writes:

> Could anyone advise me how to use (set-local-key) or something else so that
> when I am in dired and the cursor is over a file, I get vm-visit-folder to
> visit that file?
> 
> I can get as far as:
> 
> (setq dired-mode-hook
>       '(lambda ()
>      (local-set-key "V" 'vm-visit-folder)))
> 
> But that still prompts me for the name of the file to visit.

Type: C-h f vm-visit-folder RET
Read the documentation. 
See that vm-visit-folder is a function that takes a "folder" argument.
Replace you hook with:


(setq dired-mode-hook
      '(lambda ()
         (local-set-key "V" (lambda () (interactive)
                                (vm-visit-folder some-folder)))))

Substitute some-folder by the expression that returns the file
selected in dired.

If you're like me and don't know anything about dired, open a
directory with dired: M-x dired RET
move to some file, and see what is done when typing RET with:
C-h k RET
Move over the file name "dired" and type RET
read the source of dired-find-file and see that the file name is found with:
    (file-name-sans-versions (dired-get-filename) t)
substitute this for some-folder above.


Lesson learned: 
use: C-h f
     C-h k
     Click on a file name in a Help window,
     Read the source: it's OPEN software, and you're FREE to read it!

-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
The world will now reboot; don't bother saving your artefacts.


reply via email to

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