unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Re: shortcut to open header from c file
       [not found]   ` <9084afe1-11ea-4ee9-a586-51bc664ab627@h39g2000prh.googlegroups.com>
@ 2011-10-17 19:23     ` charleykhan
  0 siblings, 0 replies; only message in thread
From: charleykhan @ 2011-10-17 19:23 UTC (permalink / raw)
  To: help-gnu-emacs

Works great, thanks.

It seems that I misunderstood let and was actually modifying buffer-file-name.
Just adding a concat in my original snippet also seems to do the right thing:

(global-set-key
 "\C-x7"
 (lambda ()
   (interactive "*")
   (let* ((name (concat buffer-file-name)))
     (aset name (- (length name) 1) ?h)
     (find-file name))))

I like your version better, but just for my own understanding, are there any hidden mistakes in the snippet above (excepting your note about global-set-key)?



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-10-17 19:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <04378dcb-a1b0-44a1-8ce8-1cdb0fae0018@v7g2000yqf.googlegroups.com>
     [not found] ` <b8d8fd2a-0e43-4d77-9756-0d1cbb42143d@42g2000prp.googlegroups.com>
     [not found]   ` <9084afe1-11ea-4ee9-a586-51bc664ab627@h39g2000prh.googlegroups.com>
2011-10-17 19:23     ` shortcut to open header from c file charleykhan

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).