From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.devel Subject: Why the odd interactive form in byte-compile-file? Date: Sun, 12 Jan 2014 20:17:34 -0800 Message-ID: <52D368DE.1080303@dancol.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1389586661 27300 80.91.229.3 (13 Jan 2014 04:17:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 13 Jan 2014 04:17:41 +0000 (UTC) To: Emacs developers Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 13 05:17:49 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W2Yy9-00062X-NM for ged-emacs-devel@m.gmane.org; Mon, 13 Jan 2014 05:17:45 +0100 Original-Received: from localhost ([::1]:40476 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2Yy9-0005hF-9U for ged-emacs-devel@m.gmane.org; Sun, 12 Jan 2014 23:17:45 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54115) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2Yy6-0005hA-Nt for emacs-devel@gnu.org; Sun, 12 Jan 2014 23:17:43 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W2Yy5-0001WJ-Qc for emacs-devel@gnu.org; Sun, 12 Jan 2014 23:17:42 -0500 Original-Received: from dancol.org ([2600:3c01::f03c:91ff:fedf:adf3]:51702) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W2Yy5-0001W5-Df for emacs-devel@gnu.org; Sun, 12 Jan 2014 23:17:41 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dancol.org; s=x; h=Content-Transfer-Encoding:Content-Type:Subject:To:MIME-Version:From:Date:Message-ID; bh=71O2pMmFdwxxT95AzHXzblrkjrNFp0xHkv7iE4lkhwU=; b=BESN9ISxjNg/VTrUNtxPGOIxCxr3IxajLAOjAaZq8oOgiJCXBMM9S5NdWEGhojZ9ndrqa4c56YZm2xRtESKmZObVJy7JKb9aHzT1yApUNLl6kRHK7z4oaoiE5QRgoaiKVVWQjt1LvelvSPEPMNEWcq7Ph0X1g3P53mIhTMTi76eZ50cIcI7KTCAseq1JDGNma2gHlbA6KEE8hDbQthJx+B8EmBHtSIiGat0XVMhphgpi6Rj7qWfhaDNzgvr4vIkBooOCvEUT8iL6NQZYyQ3omnWqWU142Xe6qCHBKYnS2oB5IS4v/qnoxumtD76N423Rm+OQSl8JpypE+u7S3CQ36g==; Original-Received: from [2620:0:1cfe:99::7] by dancol.org with esmtpsa (TLS1.0:DHE_RSA_CAMELLIA_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1W2Yy5-0007My-0U for emacs-devel@gnu.org; Sun, 12 Jan 2014 20:17:41 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2600:3c01::f03c:91ff:fedf:adf3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:168277 Archived-At: 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))