From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Eric Hanchrow" Newsgroups: gmane.emacs.bugs,gmane.emacs.pretest.bugs Subject: bug#1511: 23.0.60; [PATCH] auto-insert: use expand-file-name rather than "concat". Date: Sun, 7 Dec 2008 16:20:40 -0800 Message-ID: <36366a980812071620y65b31f00h1b07407c42764ade@mail.gmail.com> Reply-To: Eric Hanchrow , 1511@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1228696238 12070 80.91.229.12 (8 Dec 2008 00:30:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 8 Dec 2008 00:30:38 +0000 (UTC) To: emacs-pretest-bug@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Dec 08 01:31:41 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L9U2F-00068w-9B for geb-bug-gnu-emacs@m.gmane.org; Mon, 08 Dec 2008 01:31:40 +0100 Original-Received: from localhost ([127.0.0.1]:55947 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L9U14-0003Du-44 for geb-bug-gnu-emacs@m.gmane.org; Sun, 07 Dec 2008 19:30:26 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L9U11-0003Dp-J0 for bug-gnu-emacs@gnu.org; Sun, 07 Dec 2008 19:30:23 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L9U0z-0003CS-TQ for bug-gnu-emacs@gnu.org; Sun, 07 Dec 2008 19:30:22 -0500 Original-Received: from [199.232.76.173] (port=52020 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L9U0z-0003CP-Mc for bug-gnu-emacs@gnu.org; Sun, 07 Dec 2008 19:30:21 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:46098) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L9U0y-0003sw-UK for bug-gnu-emacs@gnu.org; Sun, 07 Dec 2008 19:30:21 -0500 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id mB80UEmQ008054; Sun, 7 Dec 2008 16:30:14 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id mB80P47G006198; Sun, 7 Dec 2008 16:25:04 -0800 X-Loop: don@donarmstrong.com Resent-From: "Eric Hanchrow" Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Mon, 08 Dec 2008 00:25:03 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 1511 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by submit@emacsbugs.donarmstrong.com id=B.12286956495909 (code B ref -1); Mon, 08 Dec 2008 00:25:03 +0000 Original-Received: (at submit) by emacsbugs.donarmstrong.com; 8 Dec 2008 00:20:49 +0000 Original-Received: from fencepost.gnu.org (fencepost.gnu.org [140.186.70.10]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id mB80KjSB005900 for ; Sun, 7 Dec 2008 16:20:46 -0800 Original-Received: from mx10.gnu.org ([199.232.76.166]:37442) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1L9Tr9-0008A4-QJ for emacs-pretest-bug@gnu.org; Sun, 07 Dec 2008 19:20:12 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1L9Tre-00039s-VD for emacs-pretest-bug@gnu.org; Sun, 07 Dec 2008 19:20:44 -0500 Original-Received: from wf-out-1314.google.com ([209.85.200.169]:31042) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1L9Tre-00039h-06 for emacs-pretest-bug@gnu.org; Sun, 07 Dec 2008 19:20:42 -0500 Original-Received: by wf-out-1314.google.com with SMTP id 28so923641wfc.24 for ; Sun, 07 Dec 2008 16:20:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type:content-transfer-encoding :content-disposition; bh=ssti4imzUhYsLbZVgvqfo3yCGIPLtgqmSEnwHxTRIOQ=; b=tLDyM+PEEj9d6SwIJgHJ+XnmJO8u/1at68SgqXDC2/CRFAg71Np4TKE5amXtvBy+hK 8KAFoYvZEgIzr2RWnpZFOiRwcowuR8BgwrHDLVYQ1+c94V8uydl4WqqjnLTEw5ch9zy+ 7kEqOYFLLH9A7QmRXKRS0T5EaJO8Yo7EOK7bM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type :content-transfer-encoding:content-disposition; b=Y3bBcM3yXw9xQ2N8W6J6P/v9Gr7exUmW+ZDShdSLW78aFLtsG2a6BCjbA/YPOBa1si ubIF6lIeLxqUExfsk1pLWPkTpzRP7XDr2Y5OU9tZLV140Sm7h0annuWqCzpT27DjPe/e XmyyXw33LrBV2vMHpCfYxNrZRp/h0acLWssOo= Original-Received: by 10.142.234.16 with SMTP id g16mr1186057wfh.264.1228695640189; Sun, 07 Dec 2008 16:20:40 -0800 (PST) Original-Received: by 10.142.106.21 with HTTP; Sun, 7 Dec 2008 16:20:40 -0800 (PST) Content-Disposition: inline X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Sun, 07 Dec 2008 19:30:22 -0500 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:23045 gmane.emacs.pretest.bugs:23469 Archived-At: Please write in English if possible, because the Emacs maintainers usually do not have translators to read other languages for them. Your bug report will be posted to the emacs-pretest-bug@gnu.org mailing list. Please describe exactly what actions triggered the bug and the precise symptoms of the bug: I put this in my .emacs, and evaluated it: (add-to-list 'auto-insert-alist `(scheme-mode . ,(expand-file-name "~/doodles/plt-scheme/v4-script-template.ss"))) I then visited a non-existent file whose name ended wit ".ss", and noted that it was properly put into scheme-mode -- but it remained empty, whereas I'd wanted to see the contents of v4-script-template.ss. I determined that the auto-insert function was doing nothing when the file name was absolute (but it appeared to do the right thing for relative paths). Anyway, here's the patch that works for me: From 39bd280f55edd84d025b166a799c5a62bd2a6f9a Mon Sep 17 00:00:00 2001 From: Eric Hanchrow Date: Sun, 7 Dec 2008 08:09:24 -0800 Subject: [PATCH] auto-insert: use expand-file-name rather than "concat". --- lisp/autoinsert.el | 52 +++++++++++++++++++++++++++------------------------- 1 files changed, 27 insertions(+), 25 deletions(-) diff --git a/lisp/autoinsert.el b/lisp/autoinsert.el index 92a5f9f..3f555f8 100644 --- a/lisp/autoinsert.el +++ b/lisp/autoinsert.el @@ -343,31 +343,33 @@ Matches the visited file name against the elements of `auto-insert-alist'." ;; Now, if we found something, do it (and action - (if (stringp action) - (file-readable-p (concat auto-insert-directory action)) - t) - (if auto-insert-query - (or (if (eq auto-insert-query 'function) - (eq this-command 'auto-insert)) - (y-or-n-p (format auto-insert-prompt desc))) - t) - (mapc - (lambda (action) - (if (stringp action) - (if (file-readable-p - (setq action (concat auto-insert-directory action))) - (insert-file-contents action)) - (save-window-excursion - ;; make buffer visible before skeleton or function - ;; which might ask the user for something - (switch-to-buffer (current-buffer)) - (if (and (consp action) - (not (eq (car action) 'lambda))) - (skeleton-insert action) - (funcall action))))) - (if (vectorp action) - action - (vector action)))) + (let ((abs-file-name + (and (stringp action) + (expand-file-name action auto-insert-directory)))) + (and + (stringp abs-file-name) + (if auto-insert-query + (or (if (eq auto-insert-query 'function) + (eq this-command 'auto-insert)) + (y-or-n-p (format auto-insert-prompt desc))) + t) + (mapc + (lambda (action) + (if (stringp action) + (if (file-readable-p + (setq action (expand-file-name action auto-insert-directory))) + (insert-file-contents action)) + (save-window-excursion + ;; make buffer visible before skeleton or function + ;; which might ask the user for something + (switch-to-buffer (current-buffer)) + (if (and (consp action) + (not (eq (car action) 'lambda))) + (skeleton-insert action) + (funcall action))))) + (if (vectorp action) + action + (vector abs-file-name)))))) (and (buffer-modified-p) (not (eq this-command 'auto-insert)) (set-buffer-modified-p (eq auto-insert t))))) -- 1.6.1.rc1.35.gae26e If Emacs crashed, and you have the Emacs process in the gdb debugger, please include the output from the following gdb commands: `bt full' and `xbacktrace'. If you would like to further debug the crash, please read the file /usr/local/src/emacs-with-my-tweaks.git/etc/DEBUG for instructions. In GNU Emacs 23.0.60.1 (i686-pc-linux-gnu, GTK+ Version 2.14.4) of 2008-12-06 on enver-laptop Windowing system distributor `The X.Org Foundation', version 11.0.10502000 Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: nil value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default-enable-multibyte-characters: t Major mode: Diff Minor modes in effect: erc-ring-mode: t erc-pcomplete-mode: t erc-netsplit-mode: t erc-button-mode: t erc-fill-mode: t erc-stamp-mode: t erc-autojoin-mode: t erc-track-mode: t erc-match-mode: t erc-services-mode: t erc-networks-mode: t erc-irccontrols-mode: t erc-noncommands-mode: t erc-readonly-mode: t desktop-save-mode: t display-time-mode: t global-auto-revert-mode: t diff-auto-refine-mode: t shell-dirtrack-mode: t tooltip-mode: t mouse-wheel-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t global-auto-composition-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t Recent input: SPC " y o w " M-> M-p C-p C-p C-p C-p M-b M-d M e SPC < n o b o d y @ n o q w h e r e . c o m > M-> M-p C-p C-p C-p C-p M-f M-f C-b \ n M-> M-p C-M-p C-n M-m C-M-k C-M-u C-y C-M-k C-M-p M-1 M-( e x t r a c e t - a l l - f i e l d s C-M-o C-M-u C-M-q M-> M-p C-u C-p M-f M-f C-d C-d C-n M-b M-b M-b C-b C-M-k M-SPC C-f M-d s n r u u r k @ z o t z . o r g M-> C-x b . s s C-g C-x b i d o M-1 C-x $ C-x b s h e c d SPC / u s r l o c / l o c r s r e m - w g i t SPC s h o w C-x 1 C-c C-p M-0 C-l M-> M-p SPC - - i g n o r e - a l l - s p a c e C-c C-p M-0 C-l C-v M-> M-p C-a C-e C-c C-u f o r SPC g i t SPC f o r m a t - p a t h c h SPC H E A D ^ C-p M-x f f a p C-x b i n i C-a C-p M-m C-M-SPC M-w M-x r e p o r t - e m C-x o C-x b C-x b M-x M-p Recent messages: Completed Partially completed Type space to flush; repeat completion command to scroll Completed /usr/local/src/emacs-with-my-tweaks.git Mark set History item: 1 Mark set History item: 1 Mark set byte-code: Command attempted to use minibuffer while in minibuffer