Commit 8dabbfd6 authored by Stefan Monnier's avatar Stefan Monnier
Browse files

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.
parent 642f3c5c
2011-01-20 Stefan Monnier <monnier@iro.umontreal.ca>
Don't mess with *temp*.
* obsolete/spell.el: Move from textmodes/spell.el.
(spell-string):
* term.el (term-read-input-ring):
* startup.el (display-startup-echo-area-message):
* progmodes/antlr-mode.el (antlr-directory-dependencies):
* comint.el (comint-read-input-ring): Use with-temp-buffer.
* international/mule.el (ctext-pre-write-conversion): Don't hardcode
point-min==1.
2011-01-20 Ken Manheimer <ken.manheimer@gmail.com>
 
* allout.el: Summary - migrate to defining allout mode using
......@@ -8,8 +21,8 @@
allout-mode-map is now a keymap by virtue of being a defalias to
allout-mode-map-value, which contains the actual keymap structure.
 
(allout-mode): Use define-minor-mode rather than defun. Remove
now-unnecessary minor-mode setup activities from the body.
(allout-mode): Use define-minor-mode rather than defun.
Remove now-unnecessary minor-mode setup activities from the body.
Specify :keymap as allout-mode-map so the minor-mode-map-alist
entry will be '(allout-mode . allout-mode-map) - see
allout-mode-map-value, below. Adjust docstring to track changes.
......@@ -19,7 +32,7 @@
keymap is allout-mode-map-value, via defalias.
(allout-mode-map-value): The variable holding the actual mode
keymap structure, by virtue of defalias from allout-mode-map.
(allout-compose-and-institute-keymap): Renamed from
(allout-compose-and-institute-keymap): Rename from
allout-bind-keys, and including the binding-composition
functionality of the former produce-allout-mode-map and
allout-setup-mode-map.
......@@ -27,14 +40,14 @@
allout-setup-mode-map. Reassign allout-mode-map-value value and
update the defalias.
(allout-command-prefix) (allout-prefixed-keybindings)
(allout-unprefixed-keybindings): Use
allout-compose-and-institute-keymap to process the bindings.
(allout-unprefixed-keybindings):
Use allout-compose-and-institute-keymap to process the bindings.
(allout-unprefixed-keybindings): Remove extraneous '?' question
marks.
(allout-prefixed-keybindings): Elide binding to (prefixed) \C-h -
user can customize if they want to use that binding. Bind
allout-copy-topic-as-kill to (prefixed) \M-k. Bind
allout-up-current-level to (prefixed) \C-u. (I think i mistakenly
user can customize if they want to use that binding.
Bind allout-copy-topic-as-kill to (prefixed) \M-k.
Bind allout-up-current-level to (prefixed) \C-u. (I think i mistakenly
elided that, previously, instead of the one for \C-h.)
(allout-hotspot-key-handler): Remove attempt to resolve the key
through the literal key-string lookup on allout-keybindings-list.
......
......@@ -918,41 +918,36 @@ See also `comint-input-ignoredups' and `comint-write-input-ring'."
(message "Cannot read history file %s"
comint-input-ring-file-name)))
(t
(let* ((history-buf (get-buffer-create " *temp*"))
(file comint-input-ring-file-name)
(let* ((file comint-input-ring-file-name)
(count 0)
(size comint-input-ring-size)
(ring (make-ring size)))
(unwind-protect
(with-current-buffer history-buf
(widen)
(erase-buffer)
(insert-file-contents file)
;; Save restriction in case file is already visited...
;; Watch for those date stamps in history files!
(goto-char (point-max))
(let (start end history)
(while (and (< count size)
(re-search-backward comint-input-ring-separator
nil t)
(setq end (match-beginning 0)))
(setq start
(if (re-search-backward comint-input-ring-separator
nil t)
(match-end 0)
(point-min)))
(setq history (buffer-substring start end))
(goto-char start)
(if (and (not (string-match comint-input-history-ignore
history))
(or (null comint-input-ignoredups)
(ring-empty-p ring)
(not (string-equal (ring-ref ring 0)
history))))
(progn
(ring-insert-at-beginning ring history)
(setq count (1+ count)))))))
(kill-buffer history-buf))
(with-temp-buffer
(insert-file-contents file)
;; Save restriction in case file is already visited...
;; Watch for those date stamps in history files!
(goto-char (point-max))
(let (start end history)
(while (and (< count size)
(re-search-backward comint-input-ring-separator
nil t)
(setq end (match-beginning 0)))
(setq start
(if (re-search-backward comint-input-ring-separator
nil t)
(match-end 0)
(point-min)))
(setq history (buffer-substring start end))
(goto-char start)
(if (and (not (string-match comint-input-history-ignore
history))
(or (null comint-input-ignoredups)
(ring-empty-p ring)
(not (string-equal (ring-ref ring 0)
history))))
(progn
(ring-insert-at-beginning ring history)
(setq count (1+ count)))))))
(setq comint-input-ring ring
comint-input-ring-index nil)))))
......
2011-01-20 Stefan Monnier <monnier@iro.umontreal.ca>
* mm-util.el (mm-find-buffer-file-coding-system): Don't forget to kill
the temp buffer.
* message.el (message-mailer-swallows-blank-line): Use with-temp-buffer.
2011-01-19 Katsumi Yamaoka <yamaoka@jpl.org>
 
* gnus-art.el (gnus-article-highlight): Remove argument passed to
......@@ -22,8 +28,8 @@
 
2011-01-13 Chong Yidong <cyd@stupidchicken.com>
 
* message.el (message-tool-bar-gnome): Tweak tool-bar items. Add
:vert-only tags.
* message.el (message-tool-bar-gnome): Tweak tool-bar items.
Add :vert-only tags.
(message-mail): New arg RETURN-ACTION.
(message-return-action): New var.
(message-bury): Use it.
......@@ -38,8 +44,8 @@
* nnimap.el (nnimap-convert-partial-article): Protect against
zero-length body parts.
 
* mm-decode.el (mm-preferred-alternative-precedence): Discourage
showing empty parts.
* mm-decode.el (mm-preferred-alternative-precedence):
Discourage showing empty parts.
 
* gnus-int.el (gnus-request-accept-article): Don't try to update marks
and stuff if the backend didn't return the article number. This fixes
......@@ -295,8 +301,8 @@
 
2010-12-13 Lars Magne Ingebrigtsen <larsi@gnus.org>
 
* gnus-sum.el (gnus-summary-enter-digest-group): Mention
gnus-auto-select-on-ephemeral-exit.
* gnus-sum.el (gnus-summary-enter-digest-group):
Mention gnus-auto-select-on-ephemeral-exit.
 
* proto-stream.el (proto-stream-open-network-only): Fix the calling
convention of the network-only option.
......@@ -535,8 +541,8 @@
(nnir-mode): Install nnir-specific hooks for updating the registry.
 
* gnus-sum.el
(gnus-article-original-subject,gnus-newsgroup-original-name): Remove
obsolete variables.
(gnus-article-original-subject,gnus-newsgroup-original-name):
Remove obsolete variables.
(gnus-summary-move-article): Remove use of obsolete variables.
(gnus-summary-local-variables): Make move and delete hooks local to
summary buffers.
......@@ -652,7 +658,7 @@
 
* nntp.el (nntp-open-connection): Report what the connection error is.
 
* proto-stream.el (open-protocol-stream): Renamed from
* proto-stream.el (open-protocol-stream): Rename from
open-proto-stream.
 
2010-11-27 Lars Magne Ingebrigtsen <larsi@gnus.org>
......@@ -933,8 +939,8 @@
 
* shr.el (shr-parse-style): Replace \n with space in style parsing.
 
* shr-color.el (shr-color-hsl-to-rgb-fractions): Use
shr-color-hue-to-rgb.
* shr-color.el (shr-color-hsl-to-rgb-fractions):
Use shr-color-hue-to-rgb.
(shr-color->hexadecimal): Call shr-color-hsl-to-rgb-fractions.
 
2010-11-23 Lars Magne Ingebrigtsen <larsi@gnus.org>
......
......@@ -1184,14 +1184,11 @@ called and its result is inserted."
(if (and (string-match "sparc-sun-sunos\\(\\'\\|[^5]\\)"
system-configuration)
(file-readable-p "/etc/sendmail.cf")
(let ((buffer (get-buffer-create " *temp*")))
(unwind-protect
(with-current-buffer buffer
(insert-file-contents "/etc/sendmail.cf")
(goto-char (point-min))
(let ((case-fold-search nil))
(re-search-forward "^OR\\>" nil t)))
(kill-buffer buffer))))
(with-temp-buffer
(insert-file-contents "/etc/sendmail.cf")
(goto-char (point-min))
(let ((case-fold-search nil))
(re-search-forward "^OR\\>" nil t))))
;; According to RFC822, "The field-name must be composed of printable
;; ASCII characters (i. e., characters that have decimal values between
;; 33 and 126, except colon)", i. e., any chars except ctl chars,
......
......@@ -1604,7 +1604,7 @@ gzip, bzip2, etc. are allowed."
(insert decomp)
(setq filename (file-name-sans-extension filename)))
(goto-char (point-min))
(prog1
(unwind-protect
(cond
((boundp 'set-auto-coding-function) ;; Emacs
(if filename
......
......@@ -1611,7 +1611,7 @@ in-place."
(set-buffer (generate-new-buffer " *temp"))
(set-buffer-multibyte (multibyte-string-p from))
(insert from)
(setq from 1 to (point-max)))
(setq from (point-min) to (point-max)))
(save-restriction
(narrow-to-region from to)
(goto-char from)
......
......@@ -5,6 +5,7 @@
;; Maintainer: FSF
;; Keywords: wp, unix
;; Obsolete-since: 23.1
;; This file is part of GNU Emacs.
......@@ -146,22 +147,21 @@ for example, \"word\"."
(defun spell-string (string)
"Check spelling of string supplied as argument."
(interactive "sSpell string: ")
(let ((buf (get-buffer-create " *temp*")))
(with-current-buffer buf
(widen)
(erase-buffer)
(insert string "\n")
(if (string= "spell" spell-command)
(call-process-region (point-min) (point-max) "spell"
t t)
(call-process-region (point-min) (point-max) shell-file-name
t t nil "-c" spell-command))
(if (= 0 (buffer-size))
(message "%s is correct" string)
(goto-char (point-min))
(while (search-forward "\n" nil t)
(replace-match " "))
(message "%sincorrect" (buffer-substring 1 (point-max)))))))
(with-temp-buffer
(widen)
(erase-buffer)
(insert string "\n")
(if (string= "spell" spell-command)
(call-process-region (point-min) (point-max) "spell"
t t)
(call-process-region (point-min) (point-max) shell-file-name
t t nil "-c" spell-command))
(if (= 0 (buffer-size))
(message "%s is correct" string)
(goto-char (point-min))
(while (search-forward "\n" nil t)
(replace-match " "))
(message "%sincorrect" (buffer-substring 1 (point-max))))))
;;;###autoload
(make-obsolete 'spell-string "The `spell' package is obsolete - use `ispell'."
"23.1")
......
......@@ -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))))))
......
......@@ -2017,7 +2017,7 @@ Type \\[describe-distribution] for information on "))
(defun display-startup-echo-area-message ()
(let ((resize-mini-windows t))
(or noninteractive ;(input-pending-p) init-file-had-error
(or noninteractive ;(input-pending-p) init-file-had-error
;; t if the init file says to inhibit the echo area startup message.
(and inhibit-startup-echo-area-message
user-init-file
......@@ -2027,24 +2027,21 @@ Type \\[describe-distribution] for information on "))
(user-login-name)
init-file-user)))
;; Wasn't set with custom; see if .emacs has a setq.
(let ((buffer (get-buffer-create " *temp*")))
(prog1
(condition-case nil
(with-current-buffer buffer
(insert-file-contents user-init-file)
(re-search-forward
(concat
"([ \t\n]*setq[ \t\n]+"
"inhibit-startup-echo-area-message[ \t\n]+"
(regexp-quote
(prin1-to-string
(if (equal init-file-user "")
(user-login-name)
init-file-user)))
"[ \t\n]*)")
nil t))
(error nil))
(kill-buffer buffer)))))
(condition-case nil
(with-temp-buffer
(insert-file-contents user-init-file)
(re-search-forward
(concat
"([ \t\n]*setq[ \t\n]+"
"inhibit-startup-echo-area-message[ \t\n]+"
(regexp-quote
(prin1-to-string
(if (equal init-file-user "")
(user-login-name)
init-file-user)))
"[ \t\n]*)")
nil t))
(error nil))))
(message "%s" (startup-echo-area-message)))))
(defun display-startup-screen (&optional concise)
......
......@@ -1537,29 +1537,24 @@ See also `term-input-ignoredups' and `term-write-input-ring'."
(message "Cannot read history file %s"
term-input-ring-file-name)))
(t
(let ((history-buf (get-buffer-create " *temp*"))
(file term-input-ring-file-name)
(let ((file term-input-ring-file-name)
(count 0)
(ring (make-ring term-input-ring-size)))
(unwind-protect
(with-current-buffer history-buf
(widen)
(erase-buffer)
(insert-file-contents file)
;; Save restriction in case file is already visited...
;; Watch for those date stamps in history files!
(goto-char (point-max))
(while (and (< count term-input-ring-size)
(re-search-backward "^[ \t]*\\([^#\n].*\\)[ \t]*$"
nil t))
(let ((history (buffer-substring (match-beginning 1)
(match-end 1))))
(when (or (null term-input-ignoredups)
(ring-empty-p ring)
(not (string-equal (ring-ref ring 0) history)))
(ring-insert-at-beginning ring history)))
(setq count (1+ count))))
(kill-buffer history-buf))
(with-temp-buffer
(insert-file-contents file)
;; Save restriction in case file is already visited...
;; Watch for those date stamps in history files!
(goto-char (point-max))
(while (and (< count term-input-ring-size)
(re-search-backward "^[ \t]*\\([^#\n].*\\)[ \t]*$"
nil t))
(let ((history (buffer-substring (match-beginning 1)
(match-end 1))))
(when (or (null term-input-ignoredups)
(ring-empty-p ring)
(not (string-equal (ring-ref ring 0) history)))
(ring-insert-at-beginning ring history)))
(setq count (1+ count))))
(setq term-input-ring ring
term-input-ring-index nil)))))
......
......@@ -667,9 +667,9 @@
 
2011-01-11 Tassilo Horn <tassilo@member.fsf.org>
 
* image.c (imagemagick_load_image, Finit_image_library): Free
intermediate image after creating a MagickWand from it. Terminate
MagickWand environment after image loading.
* image.c (imagemagick_load_image, Finit_image_library):
Free intermediate image after creating a MagickWand from it.
Terminate MagickWand environment after image loading.
 
2011-01-10 Michael Albinus <michael.albinus@gmx.de>
 
......@@ -740,7 +740,7 @@
 
2011-01-04 Jan Moringen <jan.moringen@uni-bielefeld.de>
 
* dbusbind.c (Fdbus_register_method): Added optional parameter
* dbusbind.c (Fdbus_register_method): Add optional parameter
dont_register_service. Updated docstring accordingly.
 
2011-01-04 Glenn Morris <rgm@gnu.org>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment