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

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

Re: Passing current buffer to compile command


From: rusi
Subject: Re: Passing current buffer to compile command
Date: Sun, 16 Jan 2011 19:49:21 -0800 (PST)
User-agent: G2/1.0

On Jan 17, 8:29 am, rusi <address@hidden> wrote:
> The following will give that to you in the minibuffer
> [But beware of using it with buffers that have no file associated)

Now "No-file" should not misbehave


(savehist-mode 1)
(define-key minibuffer-local-map "%"
  (function
   (lambda ()
     (interactive)
     (let ((file-path-maybe (buffer-file-name
                             (window-buffer (minibuffer-selected-window)))))
     (insert (if file-path-maybe
                 (file-name-nondirectory file-path-maybe)
               "%"))))))


reply via email to

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