From: "Eric Hanchrow" <eric.hanchrow@gmail.com>
To: emacs-pretest-bug@gnu.org
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 [thread overview]
Message-ID: <36366a980812071620y65b31f00h1b07407c42764ade@mail.gmail.com> (raw)
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 <offby1@blarg.net>
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-> <return> 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 <backspace> w h e
r e . c o m > M-> <return> M-p C-p C-p C-p C-p M-f
M-f C-b \ n M-> <return> 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 <backspace> t
- a l l - f i e l d s C-M-o C-M-u C-M-q M-> <return>
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 <backspace> <backspace> u r k
@ z o t z . o r g M-> <return> C-x b . s s C-g C-x
b i d o <return> M-1 C-x $ C-x b s h e <return> c d
SPC / u s r l o c <tab> <backspace> <backspace> <backspace>
/ l o c <tab> r <tab> <backspace> <backspace> s r <tab>
e m <tab> - <tab> w <tab> <return> g i t SPC s h o
w <return> 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 <return> 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 <M-backspace>
g i t SPC f o r m a t - p a t h <backspace> c h SPC
H E A D ^ <return> C-p M-x f f a p <return> <return>
C-x b i n i <return> C-a C-p M-m C-M-SPC M-w M-x r
e p o r t - e m <tab> <return> C-x o C-x b C-x b <return>
M-x M-p <return>
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
next reply other threads:[~2008-12-08 0:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <jwvljuqzl1j.fsf-monnier+emacsbugreports@gnu.org>
2008-12-08 0:20 ` Eric Hanchrow [this message]
2008-12-08 16:40 ` bug#1511: marked as done (23.0.60; [PATCH] auto-insert: use expand-file-name rather than "concat".) Emacs bug Tracking System
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=36366a980812071620y65b31f00h1b07407c42764ade@mail.gmail.com \
--to=eric.hanchrow@gmail.com \
--cc=1511@emacsbugs.donarmstrong.com \
--cc=emacs-pretest-bug@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.