emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r102918: Don't mess with *temp*.


From: Stefan Monnier
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r102918: Don't mess with *temp*.
Date: Thu, 20 Jan 2011 17:36:12 -0500
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 102918
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Thu 2011-01-20 17:36:12 -0500
message:
  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.
renamed:
  lisp/textmodes/spell.el => lisp/obsolete/spell.el
modified:
  lisp/ChangeLog
  lisp/comint.el
  lisp/gnus/ChangeLog
  lisp/gnus/message.el
  lisp/gnus/mm-util.el
  lisp/international/mule.el
  lisp/progmodes/antlr-mode.el
  lisp/startup.el
  lisp/term.el
  src/ChangeLog
  lisp/obsolete/spell.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-01-20 18:13:30 +0000
+++ b/lisp/ChangeLog    2011-01-20 22:36:12 +0000
@@ -1,3 +1,16 @@
+2011-01-20  Stefan Monnier  <address@hidden>
+
+       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  <address@hidden>
 
        * 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.

=== modified file 'lisp/comint.el'
--- a/lisp/comint.el    2011-01-16 02:21:30 +0000
+++ b/lisp/comint.el    2011-01-20 22:36:12 +0000
@@ -918,41 +918,36 @@
             (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)))))
 

=== modified file 'lisp/gnus/ChangeLog'
--- a/lisp/gnus/ChangeLog       2011-01-19 22:35:53 +0000
+++ b/lisp/gnus/ChangeLog       2011-01-20 22:36:12 +0000
@@ -1,3 +1,9 @@
+2011-01-20  Stefan Monnier  <address@hidden>
+
+       * 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  <address@hidden>
 
        * gnus-art.el (gnus-article-highlight): Remove argument passed to
@@ -22,8 +28,8 @@
 
 2011-01-13  Chong Yidong  <address@hidden>
 
-       * 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  <address@hidden>
 
-       * 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  <address@hidden>
@@ -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  <address@hidden>

=== modified file 'lisp/gnus/message.el'
--- a/lisp/gnus/message.el      2011-01-15 20:38:27 +0000
+++ b/lisp/gnus/message.el      2011-01-20 22:36:12 +0000
@@ -1184,14 +1184,11 @@
   (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,

=== modified file 'lisp/gnus/mm-util.el'
--- a/lisp/gnus/mm-util.el      2011-01-14 17:18:41 +0000
+++ b/lisp/gnus/mm-util.el      2011-01-20 22:36:12 +0000
@@ -1604,7 +1604,7 @@
        (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

=== modified file 'lisp/international/mule.el'
--- a/lisp/international/mule.el        2011-01-15 23:16:57 +0000
+++ b/lisp/international/mule.el        2011-01-20 22:36:12 +0000
@@ -1611,7 +1611,7 @@
       (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)

=== renamed file 'lisp/textmodes/spell.el' => 'lisp/obsolete/spell.el'
--- a/lisp/textmodes/spell.el   2011-01-16 02:21:30 +0000
+++ b/lisp/obsolete/spell.el    2011-01-20 22:36:12 +0000
@@ -5,6 +5,7 @@
 
 ;; Maintainer: FSF
 ;; Keywords: wp, unix
+;; Obsolete-since: 23.1
 
 ;; This file is part of GNU Emacs.
 
@@ -146,22 +147,21 @@
 (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")

=== modified file 'lisp/progmodes/antlr-mode.el'
--- a/lisp/progmodes/antlr-mode.el      2011-01-15 23:16:57 +0000
+++ b/lisp/progmodes/antlr-mode.el      2011-01-20 22:36:12 +0000
@@ -2182,36 +2182,32 @@
 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))))))
 
 

=== modified file 'lisp/startup.el'
--- a/lisp/startup.el   2011-01-16 02:21:30 +0000
+++ b/lisp/startup.el   2011-01-20 22:36:12 +0000
@@ -2017,7 +2017,7 @@
 
 (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 @@
                                 (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)

=== modified file 'lisp/term.el'
--- a/lisp/term.el      2011-01-16 02:21:30 +0000
+++ b/lisp/term.el      2011-01-20 22:36:12 +0000
@@ -1537,29 +1537,24 @@
             (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)))))
 

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-01-20 06:43:04 +0000
+++ b/src/ChangeLog     2011-01-20 22:36:12 +0000
@@ -667,9 +667,9 @@
 
 2011-01-11  Tassilo Horn  <address@hidden>
 
-       * 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  <address@hidden>
 
@@ -740,7 +740,7 @@
 
 2011-01-04  Jan Moringen  <address@hidden>
 
-       * 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  <address@hidden>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]