]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't mess with *temp*.
authorStefan Monnier <monnier@iro.umontreal.ca>
Thu, 20 Jan 2011 22:36:12 +0000 (17:36 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Thu, 20 Jan 2011 22:36:12 +0000 (17:36 -0500)
* 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.

12 files changed:
lisp/ChangeLog
lisp/comint.el
lisp/gnus/ChangeLog
lisp/gnus/message.el
lisp/gnus/mm-util.el
lisp/international/mule.el
lisp/obsolete/spell.el [new file with mode: 0644]
lisp/progmodes/antlr-mode.el
lisp/startup.el
lisp/term.el
lisp/textmodes/spell.el [deleted file]
src/ChangeLog

index e928e5f3f26d86785c49bb5ad4105a8953bffadd..f2559c7c5aed4ea1dae8850d51d6dd81badf187b 100644 (file)
@@ -1,3 +1,16 @@
+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.
        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.
index e45c80212737c7b35893b92bacf07d399fa88422..da722002c207acd22f66b558db1ead7f27599298 100644 (file)
@@ -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)))))
 
index cb6d5563e407be6d69044d5bafd93e59b3f18e48..e2306c3ac47ad7ad1ac7ad7a4acb407e66450a49 100644 (file)
@@ -1,3 +1,9 @@
+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
 
 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.
        (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.
 
        * 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>
 
        * 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>
index 64569cfb99417fc85c51d7233caf9f229b1422ce..81093136d5ab746cbb19a498eb9007019971e944 100644 (file)
@@ -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,
index 99766e6446fb636d11b681bc94e9f19aac03d5b2..4012a7f5cdd8798036ea32f628ddb6135f96ac4a 100644 (file)
@@ -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
index 2f0063540deafc9bf61c2fb9ad9aa98b575543a4..086693dc662e3e6c002525b0b9bc288d506860e4 100644 (file)
@@ -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)
diff --git a/lisp/obsolete/spell.el b/lisp/obsolete/spell.el
new file mode 100644 (file)
index 0000000..6ccfe57
--- /dev/null
@@ -0,0 +1,171 @@
+;;; spell.el --- spelling correction interface for Emacs
+
+;; Copyright (C) 1985, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+;;   2009, 2010, 2011  Free Software Foundation, Inc.
+
+;; Maintainer: FSF
+;; Keywords: wp, unix
+;; Obsolete-since: 23.1
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This mode provides an Emacs interface to the UNIX spell(1) program.
+;; Entry points are `spell-buffer', `spell-word', `spell-region' and
+;; `spell-string'.
+
+;; See also ispell.el for an interface to the ispell program.
+
+;;; Code:
+
+(defgroup spell nil
+  "Interface to the UNIX spell(1) program."
+  :prefix "spell-"
+  :group 'applications)
+
+(defcustom spell-command "spell"
+  "Command to run the spell program."
+  :type 'string
+  :group 'spell)
+
+(defcustom spell-filter nil
+  "Filter function to process text before passing it to spell program.
+This function might remove text-processor commands.
+nil means don't alter the text before checking it."
+  :type '(choice (const nil) function)
+  :group 'spell)
+
+;;;###autoload
+(put 'spell-filter 'risky-local-variable t)
+
+;;;###autoload
+(defun spell-buffer ()
+  "Check spelling of every word in the buffer.
+For each incorrect word, you are asked for the correct spelling
+and then put into a query-replace to fix some or all occurrences.
+If you do not want to change a word, just give the same word
+as its \"correct\" spelling; then the query replace is skipped."
+  (interactive)
+  ;; Don't warn about spell-region being obsolete.
+  (with-no-warnings
+    (spell-region (point-min) (point-max) "buffer")))
+;;;###autoload
+(make-obsolete 'spell-buffer 'ispell-buffer "23.1")
+
+;;;###autoload
+(defun spell-word ()
+  "Check spelling of word at or before point.
+If it is not correct, ask user for the correct spelling
+and `query-replace' the entire buffer to substitute it."
+  (interactive)
+  (let (beg end spell-filter)
+    (save-excursion
+     (if (not (looking-at "\\<"))
+        (forward-word -1))
+     (setq beg (point))
+     (forward-word 1)
+     (setq end (point)))
+    ;; Don't warn about spell-region being obsolete.
+    (with-no-warnings
+      (spell-region beg end (buffer-substring beg end)))))
+;;;###autoload
+(make-obsolete 'spell-word 'ispell-word "23.1")
+
+;;;###autoload
+(defun spell-region (start end &optional description)
+  "Like `spell-buffer' but applies only to region.
+Used in a program, applies from START to END.
+DESCRIPTION is an optional string naming the unit being checked:
+for example, \"word\"."
+  (interactive "r")
+  (let ((filter spell-filter)
+       (buf (get-buffer-create " *temp*")))
+    (with-current-buffer buf
+     (widen)
+     (erase-buffer))
+    (message "Checking spelling of %s..." (or description "region"))
+    (if (and (null filter) (= ?\n (char-after (1- end))))
+       (if (string= "spell" spell-command)
+           (call-process-region start end "spell" nil buf)
+         (call-process-region start end shell-file-name
+                              nil buf nil "-c" spell-command))
+      (let ((oldbuf (current-buffer)))
+       (with-current-buffer buf
+          (insert-buffer-substring oldbuf start end)
+          (or (bolp) (insert ?\n))
+          (if filter (funcall filter))
+          (if (string= "spell" spell-command)
+              (call-process-region (point-min) (point-max) "spell" t buf)
+            (call-process-region (point-min) (point-max) shell-file-name
+                                 t buf nil "-c" spell-command)))))
+    (message "Checking spelling of %s...%s"
+            (or description "region")
+            (if (with-current-buffer buf
+                   (> (buffer-size) 0))
+                "not correct"
+              "correct"))
+    (let (word newword
+         (case-fold-search t)
+         (case-replace t))
+      (while (with-current-buffer buf
+               (> (buffer-size) 0))
+       (with-current-buffer buf
+          (goto-char (point-min))
+          (setq word (downcase
+                      (buffer-substring (point)
+                                        (progn (end-of-line) (point)))))
+          (forward-char 1)
+          (delete-region (point-min) (point))
+          (setq newword
+                (read-string (concat "`" word
+                                     "' not recognized; edit a replacement: ")
+                             word))
+          (flush-lines (concat "^" (regexp-quote word) "$")))
+       (if (not (equal word newword))
+           (progn
+            (goto-char (point-min))
+            (query-replace-regexp (concat "\\b" (regexp-quote word) "\\b")
+                                  newword)))))))
+;;;###autoload
+(make-obsolete 'spell-region 'ispell-region "23.1")
+
+;;;###autoload
+(defun spell-string (string)
+  "Check spelling of string supplied as argument."
+  (interactive "sSpell string: ")
+  (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")
+
+(provide 'spell)
+
+;;; spell.el ends here
index d9b036b67b481961ec741f152a5ca579bc700007..3402282bd5d62011fc02068fec6639dfc7e6450e 100644 (file)
@@ -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))))))
 
 
index 207297f3d347b20859c5e63db9c27940e40c154f..e637651a7e2064a5f003efa181b1520f2917e20e 100644 (file)
@@ -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)
index 2eb999b03db56d09c9ebc34b47d974ffbc1cfb50..0a8b35f5b40e61035b9d4b274ee2e54a65bc54cb 100644 (file)
@@ -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)))))
 
diff --git a/lisp/textmodes/spell.el b/lisp/textmodes/spell.el
deleted file mode 100644 (file)
index 253ebab..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-;;; spell.el --- spelling correction interface for Emacs
-
-;; Copyright (C) 1985, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
-;;   2009, 2010, 2011  Free Software Foundation, Inc.
-
-;; Maintainer: FSF
-;; Keywords: wp, unix
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs is free software: you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; GNU Emacs is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;; This mode provides an Emacs interface to the UNIX spell(1) program.
-;; Entry points are `spell-buffer', `spell-word', `spell-region' and
-;; `spell-string'.
-
-;; See also ispell.el for an interface to the ispell program.
-
-;;; Code:
-
-(defgroup spell nil
-  "Interface to the UNIX spell(1) program."
-  :prefix "spell-"
-  :group 'applications)
-
-(defcustom spell-command "spell"
-  "Command to run the spell program."
-  :type 'string
-  :group 'spell)
-
-(defcustom spell-filter nil
-  "Filter function to process text before passing it to spell program.
-This function might remove text-processor commands.
-nil means don't alter the text before checking it."
-  :type '(choice (const nil) function)
-  :group 'spell)
-
-;;;###autoload
-(put 'spell-filter 'risky-local-variable t)
-
-;;;###autoload
-(defun spell-buffer ()
-  "Check spelling of every word in the buffer.
-For each incorrect word, you are asked for the correct spelling
-and then put into a query-replace to fix some or all occurrences.
-If you do not want to change a word, just give the same word
-as its \"correct\" spelling; then the query replace is skipped."
-  (interactive)
-  ;; Don't warn about spell-region being obsolete.
-  (with-no-warnings
-    (spell-region (point-min) (point-max) "buffer")))
-;;;###autoload
-(make-obsolete 'spell-buffer 'ispell-buffer "23.1")
-
-;;;###autoload
-(defun spell-word ()
-  "Check spelling of word at or before point.
-If it is not correct, ask user for the correct spelling
-and `query-replace' the entire buffer to substitute it."
-  (interactive)
-  (let (beg end spell-filter)
-    (save-excursion
-     (if (not (looking-at "\\<"))
-        (forward-word -1))
-     (setq beg (point))
-     (forward-word 1)
-     (setq end (point)))
-    ;; Don't warn about spell-region being obsolete.
-    (with-no-warnings
-      (spell-region beg end (buffer-substring beg end)))))
-;;;###autoload
-(make-obsolete 'spell-word 'ispell-word "23.1")
-
-;;;###autoload
-(defun spell-region (start end &optional description)
-  "Like `spell-buffer' but applies only to region.
-Used in a program, applies from START to END.
-DESCRIPTION is an optional string naming the unit being checked:
-for example, \"word\"."
-  (interactive "r")
-  (let ((filter spell-filter)
-       (buf (get-buffer-create " *temp*")))
-    (with-current-buffer buf
-     (widen)
-     (erase-buffer))
-    (message "Checking spelling of %s..." (or description "region"))
-    (if (and (null filter) (= ?\n (char-after (1- end))))
-       (if (string= "spell" spell-command)
-           (call-process-region start end "spell" nil buf)
-         (call-process-region start end shell-file-name
-                              nil buf nil "-c" spell-command))
-      (let ((oldbuf (current-buffer)))
-       (with-current-buffer buf
-          (insert-buffer-substring oldbuf start end)
-          (or (bolp) (insert ?\n))
-          (if filter (funcall filter))
-          (if (string= "spell" spell-command)
-              (call-process-region (point-min) (point-max) "spell" t buf)
-            (call-process-region (point-min) (point-max) shell-file-name
-                                 t buf nil "-c" spell-command)))))
-    (message "Checking spelling of %s...%s"
-            (or description "region")
-            (if (with-current-buffer buf
-                   (> (buffer-size) 0))
-                "not correct"
-              "correct"))
-    (let (word newword
-         (case-fold-search t)
-         (case-replace t))
-      (while (with-current-buffer buf
-               (> (buffer-size) 0))
-       (with-current-buffer buf
-          (goto-char (point-min))
-          (setq word (downcase
-                      (buffer-substring (point)
-                                        (progn (end-of-line) (point)))))
-          (forward-char 1)
-          (delete-region (point-min) (point))
-          (setq newword
-                (read-string (concat "`" word
-                                     "' not recognized; edit a replacement: ")
-                             word))
-          (flush-lines (concat "^" (regexp-quote word) "$")))
-       (if (not (equal word newword))
-           (progn
-            (goto-char (point-min))
-            (query-replace-regexp (concat "\\b" (regexp-quote word) "\\b")
-                                  newword)))))))
-;;;###autoload
-(make-obsolete 'spell-region 'ispell-region "23.1")
-
-;;;###autoload
-(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)))))))
-;;;###autoload
-(make-obsolete 'spell-string "The `spell' package is obsolete - use `ispell'."
-               "23.1")
-
-(provide 'spell)
-
-;;; spell.el ends here
index 44fbcc4cf7d3a0935066550ee0e4baf42e3ca44d..c0424f954776cd2d8fde3d516e1ad90e6eb869e2 100644 (file)
 
 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>
 
 
 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>