emacs-devel
[Top][All Lists]
Advanced

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

Re: Why the odd interactive form in byte-compile-file?


From: Daniel Colascione
Subject: Re: Why the odd interactive form in byte-compile-file?
Date: Tue, 14 Jan 2014 16:00:02 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

On 01/12/2014 08:17 PM, Daniel Colascione wrote:
byte-compile-file begins with this interactive spec:

(interactive
    (let ((file buffer-file-name)
      (file-name nil)
      (file-dir nil))
      (and file
       (derived-mode-p 'emacs-lisp-mode)
       (setq file-name (file-name-nondirectory file)
         file-dir (file-name-directory file)))
      (list (read-file-name (if current-prefix-arg
                    "Byte compile and load file: "
                  "Byte compile file: "))
        current-prefix-arg)))

Why do we go to the trouble of splitting the file name when we're in an
emacs-lisp-mode buffer? If I'm editing /foo/bar/qux.el and type M-x
byte-compile-file RET, this code has the effect of compiling qux.el and
putting "qux.el" in file-name-history, not "/foo/bar/qux.el". Now, if
default-history is something else and I use C-x C-f C-r qux, I'll end up
on a bare "qux.el" instead of something I can actually use in another
context.

Is there some deeper reason we're not using code that looks like this?

(interactive
    (list (read-file-name (if current-prefix-arg
                              "Byte compile and load file: "
                            "Byte compile file: "))
          current-prefix-arg))

Ping? I'd like to treat this issue as a bugfix and change the interactive form to my proposal for 24.4.



reply via email to

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