unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Why the odd interactive form in byte-compile-file?
@ 2014-01-13  4:17 Daniel Colascione
  2014-01-15  0:00 ` Daniel Colascione
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Colascione @ 2014-01-13  4:17 UTC (permalink / raw)
  To: Emacs developers

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




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-01-15 23:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-13  4:17 Why the odd interactive form in byte-compile-file? Daniel Colascione
2014-01-15  0:00 ` Daniel Colascione
2014-01-15  4:41   ` Thien-Thi Nguyen
2014-01-15  4:43     ` Daniel Colascione
2014-01-15 14:46       ` Stefan Monnier
2014-01-15 19:10         ` Daniel Colascione
2014-01-15 23:47           ` Stefan Monnier
2014-01-15 23:49             ` Daniel Colascione

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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