summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-10-12 09:48:12 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-10-12 09:48:12 -0700
commit682432fc544c2bb4e0531c2931d43bce085eb16a (patch)
tree4bc9e4d78f34e19254382246b89a3462a0186311 /lisp
parentd44287d4adc1e268ef9974ea72010f0186f40197 (diff)
parent79beb1785aac3f8326f58710462e4b6be7f0449a (diff)
downloademacs-682432fc544c2bb4e0531c2931d43bce085eb16a.tar.gz
Merge from trunk.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog85
-rw-r--r--lisp/bindings.el2
-rw-r--r--lisp/eshell/eshell.el8
-rw-r--r--lisp/gnus/ChangeLog20
-rw-r--r--lisp/gnus/html2text.el7
-rw-r--r--lisp/gnus/message.el8
-rw-r--r--lisp/gnus/spam.el24
-rw-r--r--lisp/isearch.el9
-rw-r--r--lisp/mail/sendmail.el71
-rw-r--r--lisp/mail/smtpmail.el2
-rw-r--r--lisp/minibuffer.el103
-rw-r--r--lisp/net/tramp.el11
-rw-r--r--lisp/progmodes/f90.el23
-rw-r--r--lisp/simple.el50
-rw-r--r--lisp/textmodes/flyspell.el97
-rw-r--r--lisp/vc/vc-dispatcher.el21
-rw-r--r--lisp/vc/vc.el6
-rw-r--r--lisp/window.el53
18 files changed, 365 insertions, 235 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index fdc61721a13..58a038676e7 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,88 @@
+2011-10-12 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * textmodes/flyspell.el (flyspell-word): Move with-local-quit
+ from here...
+ (flyspell-post-command-hook): ...to here.
+
+2011-10-11 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * mail/sendmail.el (send-mail-function): Don't use sendmail-query-once
+ if not needed.
+ (sendmail-query-once): Remove OS dependencies. Make it a 3-way choice
+ using completion. Protect against "slow" callers.
+ Remove the "message hack".
+
+2011-10-11 Juri Linkov <juri@jurta.org>
+
+ * isearch.el (isearch-lazy-highlight-word): New variable.
+ (isearch-lazy-highlight-new-loop, isearch-lazy-highlight-search):
+ Use it. (Bug#9727)
+
+2011-10-11 Glenn Morris <rgm@gnu.org>
+
+ * progmodes/f90.el (f90-next-statement): Ignore preprocessor lines,
+ like f90-previous-statement does.
+
+2011-10-11 Thierry Volpiatto <thierry.volpiatto@gmail.com>
+
+ * eshell/eshell.el (eshell-command): History should be saved
+ only in interactive use, to avoid error.
+
+2011-10-11 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * minibuffer.el (completion-file-name-table): Fix last change,
+ i.e. ignore normal errors but not the other ones.
+
+2011-10-10 Martin Rudalics <rudalics@gmx.at>
+
+ * window.el (special-display-buffer-names)
+ (special-display-regexps): Remove some remnants of earlier
+ changes from doc-strings.
+ (quit-windows-on): New function.
+
+ * vc/vc.el (vc-revert, vc-rollback):
+ * vc/vc-dispatcher.el (vc-finish-logentry): Call quit-windows-on
+ instead of deleting windows. (Bug#4557) (Bug#5310) (Bug#5556)
+ (Bug#6183) (Bug#7074) (Bug#7447)
+
+2011-10-09 Martin Rudalics <rudalics@gmx.at>
+
+ * window.el (frame-auto-hide-function): Add version tag.
+ (Bug#9699)
+
+2011-10-09 Michael Albinus <michael.albinus@gmx.de>
+
+ * net/tramp.el (tramp-file-name-handler): Add 'debug to the error
+ condition.
+
+2011-10-09 Leo Liu <sdl.web@gmail.com>
+
+ * mail/smtpmail.el (smtpmail-send-data): Add a missing space.
+ (Bug#9701)
+
+2011-10-08 Glenn Morris <rgm@gnu.org>
+
+ * progmodes/f90.el (f90-calculate-indent): Give preprocessor lines
+ before the first code statement zero indent. (Bug#9690)
+
+2011-10-08 Chong Yidong <cyd@stupidchicken.com>
+
+ * simple.el (count-words-region): Always count in the region.
+ Report the number of lines and characters too.
+ (count-words): New command, which counts in the buffer if the
+ region is inactive, as count-words-region used to.
+ (count-words--message): New function. Handle plurals.
+ (count-lines-region): Make it an alias for count-words-region.
+
+ * bindings.el (esc-map): Replace count-lines-region with
+ count-words-region.
+
+2011-10-08 Martin Rudalics <rudalics@gmx.at>
+
+ * window.el (window--delete): Delete dedicated frame
+ unconditionally when argument KILL is non-nil. (Bug#9699)
+ (switch-to-buffer): Fix doc-string typo.
+
2011-10-08 Thierry Volpiatto <thierry.volpiatto@gmail.com>
* lisp/eshell/eshell.el (eshell-command): Avoid using hooks.
diff --git a/lisp/bindings.el b/lisp/bindings.el
index c056fce1e60..1a10d117987 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -773,7 +773,7 @@ if `inhibit-field-text-motion' is non-nil."
(define-key ctl-x-map "\C-o" 'delete-blank-lines)
(define-key esc-map " " 'just-one-space)
(define-key esc-map "z" 'zap-to-char)
-(define-key esc-map "=" 'count-lines-region)
+(define-key esc-map "=" 'count-words-region)
(define-key ctl-x-map "=" 'what-cursor-position)
(define-key esc-map ":" 'eval-expression)
;; Define ESC ESC : like ESC : for people who type ESC ESC out of habit.
diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el
index c33c2ccf9d1..0c1c03941e5 100644
--- a/lisp/eshell/eshell.el
+++ b/lisp/eshell/eshell.el
@@ -349,11 +349,9 @@ With prefix ARG, insert output into the current buffer at point."
(minibuffer-with-setup-hook #'(lambda ()
(eshell-mode)
(eshell-return-exits-minibuffer))
- (unwind-protect
- (unless command
- (setq command (read-from-minibuffer "Emacs shell command: ")))
- (when command
- (eshell-add-input-to-history command)))))
+ (unless command
+ (setq command (read-from-minibuffer "Emacs shell command: "))
+ (eshell-add-input-to-history command))))
(unless command
(error "No command specified!"))
;; redirection into the current buffer is achieved by adding an
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 69041ccbbd0..2fd624e819b 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,23 @@
+2011-10-11 Andreas Schwab <schwab@linux-m68k.org>
+
+ * html2text.el (html2text-clean-anchor): Check for quotes around
+ `href' value.
+
+2011-10-11 Teodor Zlatanov <tzz@lifelogs.com>
+
+ * spam.el (spam-check-BBDB): Simplify and support BBDB 3.x when
+ searching. Drop `bbdb-cache'.
+
+2011-10-11 Katsumi Yamaoka <yamaoka@jpl.org>
+
+ * message.el (message-signed-or-encrypted-p): Exclude header when
+ checking if there is signed or encrypted body in text/plain message.
+
+2011-10-09 Andreas Schwab <schwab@linux-m68k.org>
+
+ * html2text.el (html2text-get-attr): Correctly handle attribute values
+ containing "=".
+
2011-09-22 Kan-Ru Chen <kanru@kanru.info>
* ecomplete.el (ecomplete-display-matches): Use a local keymap to
diff --git a/lisp/gnus/html2text.el b/lisp/gnus/html2text.el
index 0635ab0afc6..8cfd9b9f903 100644
--- a/lisp/gnus/html2text.el
+++ b/lisp/gnus/html2text.el
@@ -193,7 +193,7 @@ formatting, and then moved afterward.")
;; size=3
((string-match "[^ ]=[^ ]" prev)
(let ((attr (nth 0 (split-string prev "=")))
- (value (nth 1 (split-string prev "="))))
+ (value (substring prev (1+ (string-match "=" prev)))))
(setq attr-list (cons (list attr value) attr-list))))
;; size= 3
((string-match "[^ ]=\\'" prev)
@@ -204,7 +204,7 @@ formatting, and then moved afterward.")
;; size=3
((string-match "[^ ]=[^ ]" this)
(let ((attr (nth 0 (split-string this "=")))
- (value (nth 1 (split-string this "="))))
+ (value (substring prev (1+ (string-match "=" this)))))
(setq attr-list (cons (list attr value) attr-list))))
;; size =3
((string-match "\\`=[^ ]" this)
@@ -358,7 +358,8 @@ formatting, and then moved afterward.")
(delete-region p1 p4)
(when href
(goto-char p1)
- (insert (substring href 1 -1 ))
+ (insert (if (string-match "\\`['\"].*['\"]\\'" href)
+ (substring href 1 -1) href))
(put-text-property p1 (point) 'face 'bold))))
;;
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 7203ef69a14..948892d1e13 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -7429,14 +7429,16 @@ is for the internal use."
(with-temp-buffer
(insert-buffer-substring cur)
(when (setq handles (mm-dissect-buffer t t))
- (if (and (prog1
- (bufferp (car handles))
- (mm-destroy-parts handles))
+ (if (and (bufferp (car handles))
(equal (mm-handle-media-type handles) "text/plain"))
(progn
+ (erase-buffer)
+ (insert-buffer-substring (car handles))
(mm-decode-content-transfer-encoding
(mm-handle-encoding handles))
+ (mm-destroy-parts handles)
(setq handles (mm-uu-dissect)))
+ (mm-destroy-parts handles)
(setq handles nil))))))
(when handles
(prog1
diff --git a/lisp/gnus/spam.el b/lisp/gnus/spam.el
index c7f993d7293..fa152f688c4 100644
--- a/lisp/gnus/spam.el
+++ b/lisp/gnus/spam.el
@@ -2150,29 +2150,13 @@ See the Info node `(gnus)Fancy Mail Splitting' for more details."
(defun spam-check-BBDB ()
"Mail from people in the BBDB is classified as ham or non-spam"
- (let ((who (message-fetch-field "from"))
- bbdb-cache bbdb-hashtable)
- (when spam-cache-lookups
- (setq bbdb-cache (gethash 'spam-use-BBDB spam-caches))
- (unless bbdb-cache
- (setq bbdb-cache (make-vector 17 0)) ; a good starting hash value
- ;; this is based on the expanded (bbdb-hashtable) macro
- ;; without the debugging support
- (with-current-buffer (bbdb-buffer)
- (save-excursion
- (save-window-excursion
- (bbdb-records nil t)
- (mapatoms
- (lambda (symbol)
- (intern (downcase (symbol-name symbol)) bbdb-cache))
- bbdb-hashtable))))
- (puthash 'spam-use-BBDB bbdb-cache spam-caches)))
+ (let ((who (message-fetch-field "from")))
(when who
(setq who (nth 1 (gnus-extract-address-components who)))
(if
- (if spam-cache-lookups
- (intern-soft (downcase who) bbdb-cache)
- (bbdb-search-simple nil who))
+ (if (fboundp 'bbdb-search)
+ (bbdb-search (bbdb-records) who) ;; v3
+ (bbdb-search-simple nil who)) ;; v2
t
(if spam-use-BBDB-exclusive
spam-split-group
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 81e0b4bf3b7..6cfcce59672 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -2617,6 +2617,7 @@ since they have special meaning in a regexp."
(defvar isearch-lazy-highlight-case-fold-search nil)
(defvar isearch-lazy-highlight-regexp nil)
(defvar isearch-lazy-highlight-space-regexp nil)
+(defvar isearch-lazy-highlight-word nil)
(defvar isearch-lazy-highlight-forward nil)
(defvar isearch-lazy-highlight-error nil)
@@ -2655,6 +2656,8 @@ by other Emacs features."
isearch-case-fold-search))
(not (eq isearch-lazy-highlight-regexp
isearch-regexp))
+ (not (eq isearch-lazy-highlight-word
+ isearch-word))
(not (= (window-start)
isearch-lazy-highlight-window-start))
(not (= (window-end) ; Window may have been split/joined.
@@ -2675,11 +2678,12 @@ by other Emacs features."
isearch-lazy-highlight-window-end (window-end)
isearch-lazy-highlight-start (point)
isearch-lazy-highlight-end (point)
+ isearch-lazy-highlight-wrapped nil
isearch-lazy-highlight-last-string isearch-string
isearch-lazy-highlight-case-fold-search isearch-case-fold-search
- isearch-lazy-highlight-regexp isearch-regexp
- isearch-lazy-highlight-wrapped nil
+ isearch-lazy-highlight-regexp isearch-regexp
isearch-lazy-highlight-space-regexp search-whitespace-regexp
+ isearch-lazy-highlight-word isearch-word
isearch-lazy-highlight-forward isearch-forward)
(unless (equal isearch-string "")
(setq isearch-lazy-highlight-timer
@@ -2693,6 +2697,7 @@ Attempt to do the search exactly the way the pending Isearch would."
(let ((case-fold-search isearch-lazy-highlight-case-fold-search)
(isearch-regexp isearch-lazy-highlight-regexp)
(search-spaces-regexp isearch-lazy-highlight-space-regexp)
+ (isearch-word isearch-lazy-highlight-word)
(search-invisible nil) ; don't match invisible text
(retry t)
(success nil)
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index dedb5719934..4557bf0fb3f 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -140,7 +140,11 @@ Otherwise, let mailer send back a message to report errors."
;; Useful to set in site-init.el
;;;###autoload
-(defcustom send-mail-function 'sendmail-query-once
+(defcustom send-mail-function
+ ;; Assume smtpmail is the preferred choice if it's already configured.
+ (if (and (boundp 'smtpmail-smtp-server)
+ smtpmail-smtp-server)
+ 'smtpmail-send-it 'sendmail-query-once)
"Function to call to send the current buffer as mail.
The headers should be delimited by a line which is
not a valid RFC822 header or continuation line,
@@ -505,46 +509,33 @@ by Emacs.)")
(defun sendmail-query-once ()
"Query for `send-mail-function' and send mail with it.
This also saves the value of `send-mail-function' via Customize."
- (let* ((mail-buffer (current-buffer))
- ;; Compute default mail sender, preferring smtpmail if it's
- ;; already configured.
- (default (cond
- ((and (boundp 'smtpmail-smtp-server)
- smtpmail-smtp-server)
- 'smtpmail-send-it)
- ((or (and window-system (eq system-type 'darwin))
- (eq system-type 'windows-nt))
- 'mailclient-send-it)
- ((and sendmail-program
- (executable-find sendmail-program))
- 'sendmail-send-it)))
- (send-function (if (eq default 'smtpmail-send-it)
- 'smtpmail-send-it)))
- (unless send-function
- ;; Query the user.
- (with-temp-buffer
- (rename-buffer "*Mail Help*" t)
- (erase-buffer)
- (insert "Emacs has not been set up for sending mail.\n
-Type `y' to configure and use Emacs as a mail client,
-or `n' to use your system's default mailer.\n
+ ;; If send-mail-function is already setup, we're incorrectly called
+ ;; a second time, probably because someone's using an old value
+ ;; of send-mail-function.
+ (when (eq send-mail-function 'sendmail-query-once)
+ (let* ((options `(("My favorite mail client" . mailclient-send-it)
+ ("Configuring Emacs's SMTP variables" . smtpmail-send-it)
+ ,@(when (and sendmail-program
+ (executable-find sendmail-program))
+ '(("The system's mail transport agent"
+ . sendmail-send-it)))))
+ (choice
+ ;; Query the user.
+ (with-temp-buffer
+ (rename-buffer "*Mail Help*" t)
+ (insert "Emacs has not been set up for sending mail.\n
+It can be told to send mail either via your favorite mail client,
+or via the system's mail transport agent (\"sendmail\"), if any,
+or it can send email on its own by configuring the SMTP parameters.\n
To change your decision later, customize `send-mail-function'.\n")
- (goto-char (point-min))
- (display-buffer (current-buffer))
- (if (y-or-n-p "Set up Emacs for sending SMTP mail? ")
- ;; FIXME: We should check and correct the From: field too.
- (setq send-function 'smtpmail-send-it)
- (setq send-function default))))
- (when send-function
- (customize-save-variable 'send-mail-function send-function)
- ;; HACK: Message mode stupidly has `message-send-mail-function',
- ;; so we must update it too or sending again in the current
- ;; Emacs session will still call `sendmail-query-once'.
- (and (boundp 'message-send-mail-function)
- (eq message-send-mail-function 'sendmail-query-once)
- (customize-set-variable 'message-send-mail-function
- send-function))
- (funcall send-function))))
+ (goto-char (point-min))
+ (display-buffer (current-buffer))
+ (let ((completion-ignore-case t))
+ (completing-read "Send mail via: "
+ options nil 'require-match)))))
+ (customize-save-variable 'send-mail-function
+ (cdr (assoc-string choice options t)))))
+ (funcall send-mail-function))
(defun sendmail-sync-aliases ()
(when mail-personal-alias-file
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index edcc82011af..026b03e350f 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -924,7 +924,7 @@ The list is in preference order.")
(defun smtpmail-send-data (process buffer)
(let ((data-continue t) sending-data
(pr (with-current-buffer buffer
- (make-progress-reporter "Sending email"
+ (make-progress-reporter "Sending email "
(point-min) (point-max)))))
(with-current-buffer buffer
(goto-char (point-min)))
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index e2ed07f1ef1..acb71d115d1 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1789,59 +1789,60 @@ same as `substitute-in-file-name'."
(defun completion-file-name-table (string pred action)
"Completion table for file names."
- (with-demoted-errors
- (cond
- ((eq action 'metadata) '(metadata (category . file)))
- ((eq (car-safe action) 'boundaries)
- (let ((start (length (file-name-directory string)))
- (end (string-match-p "/" (cdr action))))
- (list* 'boundaries
- ;; if `string' is "C:" in w32, (file-name-directory string)
- ;; returns "C:/", so `start' is 3 rather than 2.
- ;; Not quite sure what is The Right Fix, but clipping it
- ;; back to 2 will work for this particular case. We'll
- ;; see if we can come up with a better fix when we bump
- ;; into more such problematic cases.
- (min start (length string)) end)))
-
- ((eq action 'lambda)
- (if (zerop (length string))
- nil ;Not sure why it's here, but it probably doesn't harm.
- (funcall (or pred 'file-exists-p) string)))
+ (condition-case nil
+ (cond
+ ((eq action 'metadata) '(metadata (category . file)))
+ ((eq (car-safe action) 'boundaries)
+ (let ((start (length (file-name-directory string)))
+ (end (string-match-p "/" (cdr action))))
+ (list* 'boundaries
+ ;; if `string' is "C:" in w32, (file-name-directory string)
+ ;; returns "C:/", so `start' is 3 rather than 2.
+ ;; Not quite sure what is The Right Fix, but clipping it
+ ;; back to 2 will work for this particular case. We'll
+ ;; see if we can come up with a better fix when we bump
+ ;; into more such problematic cases.
+ (min start (length string)) end)))
- (t
- (let* ((name (file-name-nondirectory string))
- (specdir (file-name-directory string))
- (realdir (or specdir default-directory)))
+ ((eq action 'lambda)
+ (if (zerop (length string))
+ nil ;Not sure why it's here, but it probably doesn't harm.
+ (funcall (or pred 'file-exists-p) string)))
- (cond
- ((null action)
- (let ((comp (file-name-completion name realdir pred)))
- (if (stringp comp)
- (concat specdir comp)
- comp)))
-
- ((eq action t)
- (let ((all (file-name-all-completions name realdir)))
-
- ;; Check the predicate, if necessary.
- (unless (memq pred '(nil file-exists-p))
- (let ((comp ())
- (pred
- (if (eq pred 'file-directory-p)
- ;; Brute-force speed up for directory checking:
- ;; Discard strings which don't end in a slash.
- (lambda (s)
- (let ((len (length s)))
- (and (> len 0) (eq (aref s (1- len)) ?/))))
- ;; Must do it the hard (and slow) way.
- pred)))
- (let ((default-directory (expand-file-name realdir)))
- (dolist (tem all)
- (if (funcall pred tem) (push tem comp))))
- (setq all (nreverse comp))))
-
- all))))))))
+ (t
+ (let* ((name (file-name-nondirectory string))
+ (specdir (file-name-directory string))
+ (realdir (or specdir default-directory)))
+
+ (cond
+ ((null action)
+ (let ((comp (file-name-completion name realdir pred)))
+ (if (stringp comp)
+ (concat specdir comp)
+ comp)))
+
+ ((eq action t)
+ (let ((all (file-name-all-completions name realdir)))
+
+ ;; Check the predicate, if necessary.
+ (unless (memq pred '(nil file-exists-p))
+ (let ((comp ())
+ (pred
+ (if (eq pred 'file-directory-p)
+ ;; Brute-force speed up for directory checking:
+ ;; Discard strings which don't end in a slash.
+ (lambda (s)
+ (let ((len (length s)))
+ (and (> len 0) (eq (aref s (1- len)) ?/))))
+ ;; Must do it the hard (and slow) way.
+ pred)))
+ (let ((default-directory (expand-file-name realdir)))
+ (dolist (tem all)
+ (if (funcall pred tem) (push tem comp))))
+ (setq all (nreverse comp))))
+
+ all))))))
+ (file-error nil))) ;PCM often calls with invalid directories.
(defvar read-file-name-predicate nil
"Current predicate used by `read-file-name-internal'.")
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 1381d33efa2..7ace2911501 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1886,7 +1886,7 @@ Falls back to normal file name handler if no Tramp file name handler exists."
(apply foreign operation args))
;; Trace that somebody has interrupted the operation.
- (quit
+ ((debug quit)
(let (tramp-message-show-message)
(tramp-message
v 1 "Interrupt received in operation %s"
@@ -1898,6 +1898,9 @@ Falls back to normal file name handler if no Tramp file name handler exists."
;; operations shall return at least a default value
;; in order to give the user a chance to correct the
;; file name in the minibuffer.
+ ;; We cannot use 'debug as error handler. In order
+ ;; to get a full backtrace, one could apply
+ ;; (setq debug-on-error t debug-on-signal t)
(error
(cond
((and completion (zerop (length localname))
@@ -3850,9 +3853,9 @@ Only works for Bourne-like shells."
;; * Run emerge on two remote files. Bug is described here:
;; <http://www.mail-archive.com/tramp-devel@nongnu.org/msg01041.html>.
;; (Bug#6850)
-
-;; Functions for file-name-handler-alist:
-;; diff-latest-backup-file -- in diff.el
+;; * It would be very useful if it were possible to load or save a
+;; buffer using Tramp in a non-blocking way so that use of Emacs on
+;; other buffers could continue. (Bug#9617)
;;; tramp.el ends here
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el
index eb33822ce55..007203a8b21 100644
--- a/lisp/progmodes/f90.el
+++ b/lisp/progmodes/f90.el
@@ -1489,14 +1489,19 @@ Does not check type and subprogram indentation."
(if (not (f90-previous-statement))
;; If f90-previous-statement returns nil, we must have been
;; called from on or before the first line of the first statement.
- (setq icol (if (save-excursion
- ;; f90-previous-statement has moved us over
- ;; comment/blank lines, so we need to get
- ;; back to the first code statement.
- (when (looking-at "[ \t]*\\([!#]\\|$\\)")
- (f90-next-statement))
- (skip-chars-forward " \t0-9")
- (f90-looking-at-program-block-start))
+ (setq icol (if (or (save-excursion
+ (goto-char pnt)
+ (beginning-of-line)
+ ;; Preprocessor line before code statement.
+ (looking-at "[ \t]*#"))
+ (progn
+ ;; f90-previous-statement has moved us over
+ ;; comment/blank lines, so we need to get
+ ;; back to the first code statement.
+ (when (looking-at "[ \t]*\\([!#]\\|$\\)")
+ (f90-next-statement))
+ (skip-chars-forward " \t0-9")
+ (f90-looking-at-program-block-start)))
0
;; No explicit PROGRAM start statement.
f90-program-indent))
@@ -1573,7 +1578,7 @@ Return nil if no later statement is found."
(while (and (setq not-last-statement
(and (zerop (forward-line 1))
(not (eobp))))
- (looking-at "[ \t0-9]*\\(!\\|$\\)")))
+ (looking-at "[ \t0-9]*\\(!\\|$\\|#\\)")))
not-last-statement))
(defun f90-beginning-of-subprogram ()
diff --git a/lisp/simple.el b/lisp/simple.el
index c81385680bf..af6d855d9c0 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -945,28 +945,46 @@ rather than line counts."
(forward-line (1- line)))))
(defun count-words-region (start end)
- "Count the number of words in the active region.
-If the region is not active, counts the number of words in the buffer."
- (interactive (if (use-region-p) (list (region-beginning) (region-end))
- (list (point-min) (point-max))))
- (let ((count 0))
+ "Return the number of words between START and END.
+If called interactively, print a message reporting the number of
+lines, words, and characters in the region."
+ (interactive "r")
+ (let ((words 0))
(save-excursion
(save-restriction
(narrow-to-region start end)
(goto-char (point-min))
(while (forward-word 1)
- (setq count (1+ count)))))
+ (setq words (1+ words)))))
(when (called-interactively-p 'interactive)
- (message "%s has %d words"
- (if (use-region-p) "Region" "Buffer")
- count))
- count))
-
-(defun count-lines-region (start end)
- "Print number of lines and characters in the region."
- (interactive "r")
- (message "Region has %d lines, %d characters"
- (count-lines start end) (- end start)))
+ (count-words--message "Region"
+ (count-lines start end)
+ words
+ (- end start)))
+ words))
+
+(defun count-words ()
+ "Display the number of lines, words, and characters in the buffer.
+In Transient Mark mode when the mark is active, display the
+number of lines, words, and characters in the region."
+ (interactive)
+ (if (use-region-p)
+ (call-interactively 'count-words-region)
+ (let* ((beg (point-min))
+ (end (point-max))
+ (lines (count-lines beg end))
+ (words (count-words-region beg end))
+ (chars (- end beg)))
+ (count-words--message "Buffer" lines words chars))))
+
+(defun count-words--message (str lines words chars)
+ (message "%s has %d line%s, %d word%s, and %d character%s."
+ str
+ lines (if (= lines 1) "" "s")
+ words (if (= words 1) "" "s")
+ chars (if (= chars 1) "" "s")))
+
+(defalias 'count-lines-region 'count-words-region)
(defun what-line ()
"Print the current buffer line number and narrowed line number of point."
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 4eb4efc3766..c2af3f7be84 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -931,49 +931,52 @@ Mostly we check word delimiters."
;;* previous word nor the current word */
;;*---------------------------------------------------------------------*/
(defun flyspell-post-command-hook ()
- "The `post-command-hook' used by flyspell to check a word in-the-fly."
+ "The `post-command-hook' used by flyspell to check a word on-the-fly."
(interactive)
(when flyspell-mode
- (let ((command this-command)
- ;; Prevent anything we do from affecting the mark.
- deactivate-mark)
- (if (flyspell-check-pre-word-p)
- (with-current-buffer flyspell-pre-buffer
- '(flyspell-debug-signal-pre-word-checked)
- (save-excursion
- (goto-char flyspell-pre-point)
- (flyspell-word))))
- (if (flyspell-check-word-p)
- (progn
- '(flyspell-debug-signal-word-checked)
- (flyspell-word)
- ;; we remember which word we have just checked.
- ;; this will be used next time we will check a word
- ;; to compare the next current word with the word
- ;; that as been registered in the pre-command-hook
- ;; that is these variables are used within the predicate
- ;; FLYSPELL-CHECK-PRE-WORD-P
- (setq flyspell-pre-pre-buffer (current-buffer))
- (setq flyspell-pre-pre-point (point)))
- (progn
- (setq flyspell-pre-pre-buffer nil)
- (setq flyspell-pre-pre-point nil)
- ;; when a word is not checked because of a delayed command
- ;; we do not disable the ispell cache.
- (if (and (symbolp this-command) (get this-command 'flyspell-delayed))
- (progn
- (setq flyspell-word-cache-end -1)
- (setq flyspell-word-cache-result '_)))))
- (while (and (not (input-pending-p)) (consp flyspell-changes))
- (let ((start (car (car flyspell-changes)))
- (stop (cdr (car flyspell-changes))))
- (if (flyspell-check-changed-word-p start stop)
- (save-excursion
- '(flyspell-debug-signal-changed-checked)
- (goto-char start)
- (flyspell-word)))
- (setq flyspell-changes (cdr flyspell-changes))))
- (setq flyspell-previous-command command))))
+ (with-local-quit
+ (let ((command this-command)
+ ;; Prevent anything we do from affecting the mark.
+ deactivate-mark)
+ (if (flyspell-check-pre-word-p)
+ (with-current-buffer flyspell-pre-buffer
+ '(flyspell-debug-signal-pre-word-checked)
+ (save-excursion
+ (goto-char flyspell-pre-point)
+ (flyspell-word))))
+ (if (flyspell-check-word-p)
+ (progn
+ '(flyspell-debug-signal-word-checked)
+ ;; FIXME: This should be asynchronous!
+ (flyspell-word)
+ ;; we remember which word we have just checked.
+ ;; this will be used next time we will check a word
+ ;; to compare the next current word with the word
+ ;; that as been registered in the pre-command-hook
+ ;; that is these variables are used within the predicate
+ ;; FLYSPELL-CHECK-PRE-WORD-P
+ (setq flyspell-pre-pre-buffer (current-buffer))
+ (setq flyspell-pre-pre-point (point)))
+ (progn
+ (setq flyspell-pre-pre-buffer nil)
+ (setq flyspell-pre-pre-point nil)
+ ;; when a word is not checked because of a delayed command
+ ;; we do not disable the ispell cache.
+ (if (and (symbolp this-command)
+ (get this-command 'flyspell-delayed))
+ (progn
+ (setq flyspell-word-cache-end -1)
+ (setq flyspell-word-cache-result '_)))))
+ (while (and (not (input-pending-p)) (consp flyspell-changes))
+ (let ((start (car (car flyspell-changes)))
+ (stop (cdr (car flyspell-changes))))
+ (if (flyspell-check-changed-word-p start stop)
+ (save-excursion
+ '(flyspell-debug-signal-changed-checked)
+ (goto-char start)
+ (flyspell-word)))
+ (setq flyspell-changes (cdr flyspell-changes))))
+ (setq flyspell-previous-command command)))))
;;*---------------------------------------------------------------------*/
;;* flyspell-notify-misspell ... */
@@ -1100,14 +1103,10 @@ misspelling and skips redundant spell-checking step."
;; we mark the ispell process so it can be killed
;; when emacs is exited without query
(set-process-query-on-exit-flag ispell-process nil)
- ;; Wait until ispell has processed word. Since this
- ;; code is often executed from post-command-hook but
- ;; the ispell process may not be responsive, it's
- ;; important to make sure we re-enable C-g.
- (with-local-quit
- (while (progn
- (accept-process-output ispell-process)
- (not (string= "" (car ispell-filter))))))
+ ;; Wait until ispell has processed word.
+ (while (progn
+ (accept-process-output ispell-process)
+ (not (string= "" (car ispell-filter)))))
;; (ispell-send-string "!\n")
;; back to terse mode.
;; Remove leading empty element
diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el
index 388d4c94a08..84c7f4a510b 100644
--- a/lisp/vc/vc-dispatcher.el
+++ b/lisp/vc/vc-dispatcher.el
@@ -666,18 +666,15 @@ the buffer contents as a comment."
(funcall log-operation
log-fileset
log-entry))
- ;; Remove checkin window (after the checkin so that if that fails
- ;; we don't zap the log buffer and the typing therein).
- ;; -- IMO this should be replaced with quit-window
- (cond ((and logbuf vc-delete-logbuf-window)
- (delete-windows-on logbuf (selected-frame))
- ;; Kill buffer and delete any other dedicated windows/frames.
- (kill-buffer logbuf))
- (logbuf
- (with-selected-window (or (get-buffer-window logbuf 0)
- (selected-window))
- (with-current-buffer logbuf
- (bury-buffer)))))
+
+ ;; Quit windows on logbuf.
+ (cond
+ ((not logbuf))
+ (vc-delete-logbuf-window
+ (quit-windows-on logbuf t (selected-frame)))
+ (t
+ (quit-windows-on logbuf nil 0)))
+
;; Now make sure we see the expanded headers
(when log-fileset
(mapc
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 6704a43e59b..62536fd94be 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -2302,8 +2302,7 @@ to the working revision (except for keyword expansion)."
(if (= nfiles 1) "" "s"))))))
(error "Revert canceled")))
(when diff-buffer
- (delete-windows-on diff-buffer)
- (kill-buffer diff-buffer)))
+ (quit-windows-on diff-buffer t)))
(dolist (file files)
(message "Reverting %s..." (vc-delistify files))
(vc-revert-file file)
@@ -2349,8 +2348,7 @@ depending on the underlying version-control system."
;; Display changes
(unless (yes-or-no-p "Discard these revisions? ")
(error "Rollback canceled"))
- (delete-windows-on "*vc-diff*")
- (kill-buffer"*vc-diff*")
+ (quit-windows-on "*vc-diff*" t)
;; Do the actual reversions
(message "Rolling back %s..." (vc-delistify files))
(with-vc-properties
diff --git a/lisp/window.el b/lisp/window.el
index 74460ae6058..4d8b3c92b95 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -2772,7 +2772,8 @@ shown in a separate frame like `quit-window' and `bury-buffer'."
(const :tag "Do nothing" ignore)
function)
:group 'windows
- :group 'frames)
+ :group 'frames
+ :version "24.1")
(defun window--delete (&optional window dedicated-only kill)
"Delete WINDOW if possible.
@@ -2780,7 +2781,7 @@ WINDOW must be a live window and defaults to the selected one.
Optional argument DEDICATED-ONLY non-nil means to delete WINDOW
only if it's dedicated to its buffer. Optional argument KILL
means the buffer shown in window will be killed. Return non-nil
-if WINDOW gets deleted."
+if WINDOW gets deleted or its frame is auto-hidden."
(setq window (window-normalize-live-window window))
(unless (and dedicated-only (not (window-dedicated-p window)))
(let* ((buffer (window-buffer window))
@@ -2788,8 +2789,11 @@ if WINDOW gets deleted."
(cond
((eq deletable 'frame)
(let ((frame (window-frame window)))
- (when (functionp frame-auto-hide-function)
- (funcall frame-auto-hide-function frame)))
+ (cond
+ (kill
+ (delete-frame frame))
+ ((functionp frame-auto-hide-function)
+ (funcall frame-auto-hide-function frame))))
'frame)
(deletable
(delete-window window)
@@ -2980,6 +2984,27 @@ one. If non-nil, reset `quit-restore' parameter to nil."
(if kill
(kill-buffer buffer)
(bury-buffer-internal buffer))))
+
+(defun quit-windows-on (&optional buffer-or-name kill frame)
+ "Quit all windows showing BUFFER-OR-NAME.
+BUFFER-OR-NAME may be a buffer or the name of an existing buffer
+and defaults to the current buffer. Optional argument KILL
+non-nil means to kill BUFFER-OR-NAME. KILL nil means to bury
+BUFFER-OR-NAME. Optional argument FRAME is handled as by
+`delete-windows-on'.
+
+This function calls `quit-window' on all candidate windows
+showing BUFFER-OR-NAME."
+ (interactive "BQuit windows on (buffer):\nP")
+ (let ((buffer (window-normalize-buffer buffer-or-name))
+ ;; Handle the "inverted" meaning of the FRAME argument wrt other
+ ;; `window-list-1' based function.
+ (all-frames (cond ((not frame) t) ((eq frame t) nil) (t frame))))
+ (dolist (window (window-list-1 nil nil all-frames))
+ (if (eq (window-buffer window) buffer)
+ (quit-window kill window)
+ ;; If a window doesn't show BUFFER, unrecord BUFFER in it.
+ (unrecord-window-buffer window buffer)))))
;;; Splitting windows.
(defsubst window-split-min-size (&optional horizontal)
@@ -3955,12 +3980,10 @@ Finally, an element of this list can be also specified as
\(BUFFER-NAME FUNCTION OTHER-ARGS). In that case,
`special-display-popup-frame' will call FUNCTION with the buffer
named BUFFER-NAME as first argument, and OTHER-ARGS as the
-second. If `special-display-function' specifies some other
-function, that function is called with the buffer named
-BUFFER-NAME as first, and the element's cdr as second argument.
-In any case, that function is responsible for setting the value
-The function specified here is responsible for setting the
-quit-restore and help-setup parameters of the window used.
+second.
+
+Any alternative function specified here is responsible for
+setting up the quit-restore parameter of the window used.
If this variable appears \"not to work\", because you added a
name to it but the corresponding buffer is displayed in the
@@ -4025,10 +4048,10 @@ as second argument.
Finally, an element of this list can be also specified as
\(REGEXP FUNCTION OTHER-ARGS). `special-display-popup-frame'
will then call FUNCTION with the buffer whose name matched
-REGEXP as first, and OTHER-ARGS as second argument. If
-`special-display-function' specifies some other function, that
-function is called with the buffer whose name matched REGEXP
-as first, and the element's cdr as second argument.
+REGEXP as first, and OTHER-ARGS as second argument.
+
+Any alternative function specified here is responsible for
+setting up the quit-restore parameter of the window used.
If this variable appears \"not to work\", because you added a
name to it but the corresponding buffer is displayed in the
@@ -4974,7 +4997,7 @@ one.
If FORCE-SAME-WINDOW is non-nil, BUFFER-OR-NAME must be displayed
in the selected window; signal an error if that is
impossible (e.g. if the selected window is minibuffer-only). If
-non-nil, BUFFER-OR-NAME may be displayed in another window.
+nil, BUFFER-OR-NAME may be displayed in another window.
Return the buffer switched to."
(interactive