* how to set local key in dired to use vm on file
@ 2004-11-20 23:53 Gilbert Harman
0 siblings, 0 replies; 4+ messages in thread
From: Gilbert Harman @ 2004-11-20 23:53 UTC (permalink / raw)
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.
Thanks in advance.
Gil
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: how to set local key in dired to use vm on file
[not found] <mailman.304.1100995412.27204.help-gnu-emacs@gnu.org>
@ 2004-11-21 0:26 ` Pascal Bourguignon
2004-11-21 0:29 ` Henrik Enberg
2004-11-21 0:43 ` V. L. Simpson
2 siblings, 0 replies; 4+ messages in thread
From: Pascal Bourguignon @ 2004-11-21 0:26 UTC (permalink / raw)
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: how to set local key in dired to use vm on file
[not found] <mailman.304.1100995412.27204.help-gnu-emacs@gnu.org>
2004-11-21 0:26 ` how to set local key in dired to use vm on file Pascal Bourguignon
@ 2004-11-21 0:29 ` Henrik Enberg
2004-11-21 0:43 ` V. L. Simpson
2 siblings, 0 replies; 4+ messages in thread
From: Henrik Enberg @ 2004-11-21 0:29 UTC (permalink / raw)
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)))
Emacs already have support for this in dired-x.el. Putting Something
like the following in your .emacs should bind "V" to the function you
want.
(add-hook 'dired-load-hook
(lambda ()
(require 'dired-x)
(setq dired-bind-vm t)))
As an aside, `add-hook' is the prefered way to add stuff to a hook.
`setq' will overwrite any other stuff that may be in the hook.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: how to set local key in dired to use vm on file
[not found] <mailman.304.1100995412.27204.help-gnu-emacs@gnu.org>
2004-11-21 0:26 ` how to set local key in dired to use vm on file Pascal Bourguignon
2004-11-21 0:29 ` Henrik Enberg
@ 2004-11-21 0:43 ` V. L. Simpson
2 siblings, 0 replies; 4+ messages in thread
From: V. L. Simpson @ 2004-11-21 0:43 UTC (permalink / raw)
>>>>> "Gilbert" == 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)))
You shouldn't use setq on mode-hooks. Use add-hook instead.
The dired-ex package has 'dired-bind-vm' for doing exactly what you want.
example
(add-hook 'dired-load-hook
(lambda ()
(load "dired-x")
(setq dired-bind-vm t)))
dired-load-hook is better than dired-mode-hook as it's only run
the first time you use dired. Trust me, it's what you want. 8-]
Have fun,
vls
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-11-21 0:43 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.304.1100995412.27204.help-gnu-emacs@gnu.org>
2004-11-21 0:26 ` how to set local key in dired to use vm on file Pascal Bourguignon
2004-11-21 0:29 ` Henrik Enberg
2004-11-21 0:43 ` V. L. Simpson
2004-11-20 23:53 Gilbert Harman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).