summaryrefslogtreecommitdiff
path: root/lisp/progmodes/antlr-mode.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2011-01-20 17:36:12 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2011-01-20 17:36:12 -0500
commit8dabbfd6325ea5b11e67fa8358625669808312dd (patch)
tree079663dec17eea59c35ba92edaed0bbdb64f7751 /lisp/progmodes/antlr-mode.el
parent642f3c5c603d61aa0b47a614981f462669eec086 (diff)
downloademacs-8dabbfd6325ea5b11e67fa8358625669808312dd.tar.gz
Don't mess with *temp*.
* lisp/obsolete/spell.el: Move from textmodes/spell.el. (spell-string): * lisp/term.el (term-read-input-ring): * lisp/startup.el (display-startup-echo-area-message): * lisp/progmodes/antlr-mode.el (antlr-directory-dependencies): * lisp/gnus/message.el (message-mailer-swallows-blank-line): * lisp/comint.el (comint-read-input-ring): Use with-temp-buffer. * lisp/international/mule.el (ctext-pre-write-conversion): Don't hardcode point-min==1. * lisp/gnus/mm-util.el (mm-find-buffer-file-coding-system): Don't forget to kill the temp buffer.
Diffstat (limited to 'lisp/progmodes/antlr-mode.el')
-rw-r--r--lisp/progmodes/antlr-mode.el52
1 files changed, 24 insertions, 28 deletions
diff --git a/lisp/progmodes/antlr-mode.el b/lisp/progmodes/antlr-mode.el
index d9b036b67b4..3402282bd5d 100644
--- a/lisp/progmodes/antlr-mode.el
+++ b/lisp/progmodes/antlr-mode.el
@@ -2182,36 +2182,32 @@ grammar file in which CLASS is defined and EVOCAB is the name of the
export vocabulary specified in that file."
(let ((grammar (directory-files dirname t "\\.g\\'")))
(when grammar
- (let ((temp-buffer (get-buffer-create
- (generate-new-buffer-name " *temp*")))
- (antlr-imenu-name nil) ; dynamic-let: no imenu
- (expanded-regexp (concat (format (regexp-quote
- (cadr antlr-special-file-formats))
- ".+")
- "\\'"))
+ (let ((antlr-imenu-name nil) ; dynamic-let: no imenu
+ (expanded-regexp
+ (concat (format (regexp-quote
+ (cadr antlr-special-file-formats))
+ ".+")
+ "\\'"))
classes dependencies)
- (unwind-protect
- (with-current-buffer temp-buffer
- (widen) ; just in case...
- (dolist (file grammar)
- (when (and (file-regular-p file)
- (null (string-match expanded-regexp file)))
- (insert-file-contents file t nil nil t)
- (normal-mode t) ; necessary for major-mode, syntax
+ (with-temp-buffer
+ (dolist (file grammar)
+ (when (and (file-regular-p file)
+ (null (string-match expanded-regexp file)))
+ (insert-file-contents file t nil nil t)
+ (normal-mode t) ; necessary for major-mode, syntax
; table and `antlr-language'
- (when (derived-mode-p 'antlr-mode)
- (let* ((file-deps (antlr-file-dependencies))
- (file (car file-deps)))
- (when file-deps
- (dolist (class-def (caadr file-deps))
- (let ((file-evocab (cons file (cdr class-def)))
- (class-spec (assoc (car class-def) classes)))
- (if class-spec
- (nconc (cdr class-spec) (list file-evocab))
- (push (list (car class-def) file-evocab)
- classes))))
- (push file-deps dependencies)))))))
- (kill-buffer temp-buffer))
+ (when (derived-mode-p 'antlr-mode)
+ (let* ((file-deps (antlr-file-dependencies))
+ (file (car file-deps)))
+ (when file-deps
+ (dolist (class-def (caadr file-deps))
+ (let ((file-evocab (cons file (cdr class-def)))
+ (class-spec (assoc (car class-def) classes)))
+ (if class-spec
+ (nconc (cdr class-spec) (list file-evocab))
+ (push (list (car class-def) file-evocab)
+ classes))))
+ (push file-deps dependencies)))))))
(cons (nreverse classes) (nreverse dependencies))))))