aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJoakim Verona2011-10-10 13:00:51 +0200
committerJoakim Verona2011-10-10 13:00:51 +0200
commit0b19c7867f5e647fa0269833fe74e0064b415c08 (patch)
tree08a0a4112e94675ffde647160706480e78435818 /lisp
parentd4077561a90a24d61e295745d70c0effa655a37c (diff)
parent0563dae9a9e3a8c2b6de454693c0cc207e67f05d (diff)
downloademacs-0b19c7867f5e647fa0269833fe74e0064b415c08.tar.gz
emacs-0b19c7867f5e647fa0269833fe74e0064b415c08.zip
upstream
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog150
-rw-r--r--lisp/bindings.el6
-rw-r--r--lisp/calendar/holidays.el5
-rw-r--r--lisp/comint.el79
-rw-r--r--lisp/cus-start.el7
-rw-r--r--lisp/emacs-lisp/edebug.el39
-rw-r--r--lisp/eshell/eshell.el20
-rw-r--r--lisp/faces.el6
-rw-r--r--lisp/gnus/ChangeLog29
-rw-r--r--lisp/gnus/ecomplete.el32
-rw-r--r--lisp/gnus/gnus-group.el2
-rw-r--r--lisp/gnus/gnus-win.el11
-rw-r--r--lisp/gnus/html2text.el6
-rw-r--r--lisp/gnus/shr.el17
-rw-r--r--lisp/international/mule-cmds.el37
-rw-r--r--lisp/mail/smtpmail.el2
-rw-r--r--lisp/minibuffer.el45
-rw-r--r--lisp/mpc.el12
-rw-r--r--lisp/net/tramp.el11
-rw-r--r--lisp/pcmpl-unix.el23
-rw-r--r--lisp/pcomplete.el52
-rw-r--r--lisp/progmodes/f90.el21
-rw-r--r--lisp/progmodes/gdb-mi.el6
-rw-r--r--lisp/progmodes/perl-mode.el10
-rw-r--r--lisp/simple.el50
-rw-r--r--lisp/subr.el5
-rw-r--r--lisp/window.el166
27 files changed, 553 insertions, 296 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index efe1d4b4a42..103d7b25518 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,149 @@
12011-10-10 Martin Rudalics <rudalics@gmx.at>
2
3 * window.el (special-display-buffer-names)
4 (special-display-regexps): Remove some remnants of earlier
5 changes from doc-strings.
6
72011-10-09 Martin Rudalics <rudalics@gmx.at>
8
9 * window.el (frame-auto-hide-function): Add version tag.
10 (Bug#9699)
11
122011-10-09 Michael Albinus <michael.albinus@gmx.de>
13
14 * net/tramp.el (tramp-file-name-handler): Add 'debug to the error
15 condition.
16
172011-10-09 Leo Liu <sdl.web@gmail.com>
18
19 * mail/smtpmail.el (smtpmail-send-data): Add a missing space.
20 (Bug#9701)
21
222011-10-08 Glenn Morris <rgm@gnu.org>
23
24 * progmodes/f90.el (f90-calculate-indent): Give preprocessor lines
25 before the first code statement zero indent. (Bug#9690)
26
272011-10-08 Chong Yidong <cyd@stupidchicken.com>
28
29 * simple.el (count-words-region): Always count in the region.
30 Report the number of lines and characters too.
31 (count-words): New command, which counts in the buffer if the
32 region is inactive, as count-words-region used to.
33 (count-words--message): New function. Handle plurals.
34 (count-lines-region): Make it an alias for count-words-region.
35
36 * bindings.el (esc-map): Replace count-lines-region with
37 count-words-region.
38
392011-10-08 Martin Rudalics <rudalics@gmx.at>
40
41 * window.el (window--delete): Delete dedicated frame
42 unconditionally when argument KILL is non-nil. (Bug#9699)
43 (switch-to-buffer): Fix doc-string typo.
44
452011-10-08 Thierry Volpiatto <thierry.volpiatto@gmail.com>
46
47 * lisp/eshell/eshell.el (eshell-command): Avoid using hooks.
48
492011-10-07 Chong Yidong <cyd@stupidchicken.com>
50
51 * bindings.el ([M-left],[M-right]): Bind to left-word and
52 right-word respectively.
53
542011-10-07 Glenn Morris <rgm@gnu.org>
55
56 * cus-start.el (debug-on-quit): Fix custom type.
57
582011-10-06 Lars Magne Ingebrigtsen <larsi@gnus.org>
59
60 * subr.el (define-key-after): Clarify that the function is not
61 useful for non-menu keymaps.
62
63 * progmodes/gdb-mi.el (gdb): Fix typo in doc string.
64
652011-10-06 Thierry Volpiatto <thierry.volpiatto@gmail.com>
66
67 * eshell/eshell.el (eshell-command): Enable `eshell-mode' only
68 in current minibuffer (Fix bug with recursive minibuffers).
69
702011-10-06 Chong Yidong <cyd@stupidchicken.com>
71
72 * progmodes/gdb-mi.el (gdb): Doc fix.
73
742011-10-05 Martin Rudalics <rudalics@gmx.at>
75
76 * window.el (frame-auto-hide-function): New option replacing
77 frame-auto-delete. Suggested by Stefan Monnier.
78 (window--delete): Call frame-auto-hide-function instead of
79 investigating frame-auto-delete.
80 (window-point-1, set-window-point-1): New functions.
81 (window-in-direction, record-window-buffer, window-state-get-1)
82 (display-buffer-record-window): Use window-point-1 instead of
83 window-point.
84 (set-window-buffer-start-and-point): Use set-window-point-1.
85
862011-10-05 Stefan Monnier <monnier@iro.umontreal.ca>
87
88 * emacs-lisp/edebug.el: Heed checkdoc recommendations.
89
902011-10-05 Glenn Morris <rgm@gnu.org>
91
92 * progmodes/perl-mode.el (perl-electric-terminator): Doc fix.
93 (perl-calculate-indent): Suppress scan errors. (Bug#2205)
94
952011-10-05 Leo Liu <sdl.web@gmail.com>
96
97 * subr.el (read-char-choice): Fix argument to buffer-live-p which
98 works with buffer object.
99
1002011-10-05 Stefan Monnier <monnier@iro.umontreal.ca>
101
102 * mpc.el (mpc-tool-bar-map): Add labels.
103
1042011-10-04 Glenn Morris <rgm@gnu.org>
105
106 * calendar/holidays.el (calendar-check-holidays): Doc fix.
107
1082011-10-04 Martin Rudalics <rudalics@gmx.at>
109
110 * window.el (window--delete): New function.
111 (frame-auto-delete): Resuscitate option.
112 (bury-buffer, replace-buffer-in-windows)
113 (quit-window): Rewrite using window--delete.
114 (display-buffer-pop-up-frame, display-buffer-pop-up-window):
115 Pass display-buffer-mark-dedicated to window--display-buffer-2
116 (Bug#9639).
117
1182011-10-03 Stefan Monnier <monnier@iro.umontreal.ca>
119
120 * pcmpl-unix.el (pcomplete/scp): Don't assume pcomplete-all-entries
121 returns a list (bug#9554). Add remote file name completion.
122 * comint.el (comint--table-subvert): Curry and get quote&unquote
123 functions as arguments.
124 (comint--complete-file-name-data): Adjust call accordingly.
125 * pcomplete.el (pcomplete--table-subvert): Remove.
126 (pcomplete-completions-at-point): Use comint--table-subvert instead.
127
128 * minibuffer.el (completion-table-case-fold): Use currying.
129 (completion--styles-type, completion--cycling-threshold-type):
130 New constants.
131 (completion-styles, completion-category-overrides)
132 (completion-cycle-threshold): Use them.
133 * pcomplete.el (pcomplete-completions-at-point): Adjust call to
134 completion-table-case-fold.
135
1362011-10-03 Stephen Berman <stephen.berman@gmx.net>
137
138 * minibuffer.el (completion-category-overrides): Fix type of styles
139 and add more user friendly tags (bug#9660).
140
1412011-10-03 Stefan Monnier <monnier@iro.umontreal.ca>
142
143 * international/mule-cmds.el: Fix abuses of apply-partially (bug#9661).
144 (mule-input-method-string): New widget.
145 (default-input-method, language-info-custom-alist): Use it.
146
12011-10-02 Stefan Monnier <monnier@iro.umontreal.ca> 1472011-10-02 Stefan Monnier <monnier@iro.umontreal.ca>
2 148
3 * pcomplete.el: Require comint. 149 * pcomplete.el: Require comint.
@@ -12,8 +158,8 @@
12 * pcmpl-gnu.el (pcmpl-gnu-with-file-buffer): New macro (bug#9643). 158 * pcmpl-gnu.el (pcmpl-gnu-with-file-buffer): New macro (bug#9643).
13 (pcmpl-gnu-tar-buffer): Remove. 159 (pcmpl-gnu-tar-buffer): Remove.
14 (pcmpl-gnu-with-file-buffer): Use it to avoid leaving the tar's buffer 160 (pcmpl-gnu-with-file-buffer): Use it to avoid leaving the tar's buffer
15 avoid. Make sure pcomplete-suffix-list is only changed temporarily. 161 around. Make sure pcomplete-suffix-list is only changed temporarily.
16 Don't look inside the tar's file is it's too large. 162 Don't look inside the tar's file if it's too large.
17 163
182011-10-01 Chong Yidong <cyd@stupidchicken.com> 1642011-10-01 Chong Yidong <cyd@stupidchicken.com>
19 165
diff --git a/lisp/bindings.el b/lisp/bindings.el
index 57bfeb60f82..1a10d117987 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -773,7 +773,7 @@ if `inhibit-field-text-motion' is non-nil."
773(define-key ctl-x-map "\C-o" 'delete-blank-lines) 773(define-key ctl-x-map "\C-o" 'delete-blank-lines)
774(define-key esc-map " " 'just-one-space) 774(define-key esc-map " " 'just-one-space)
775(define-key esc-map "z" 'zap-to-char) 775(define-key esc-map "z" 'zap-to-char)
776(define-key esc-map "=" 'count-lines-region) 776(define-key esc-map "=" 'count-words-region)
777(define-key ctl-x-map "=" 'what-cursor-position) 777(define-key ctl-x-map "=" 'what-cursor-position)
778(define-key esc-map ":" 'eval-expression) 778(define-key esc-map ":" 'eval-expression)
779;; Define ESC ESC : like ESC : for people who type ESC ESC out of habit. 779;; Define ESC ESC : like ESC : for people who type ESC ESC out of habit.
@@ -1103,9 +1103,9 @@ if `inhibit-field-text-motion' is non-nil."
1103 "Keymap for characters following C-c.") 1103 "Keymap for characters following C-c.")
1104(define-key global-map "\C-c" 'mode-specific-command-prefix) 1104(define-key global-map "\C-c" 'mode-specific-command-prefix)
1105 1105
1106(global-set-key [M-right] 'forward-word) 1106(global-set-key [M-right] 'right-word)
1107(define-key esc-map [right] 'forward-word) 1107(define-key esc-map [right] 'forward-word)
1108(global-set-key [M-left] 'backward-word) 1108(global-set-key [M-left] 'left-word)
1109(define-key esc-map [left] 'backward-word) 1109(define-key esc-map [left] 'backward-word)
1110;; ilya@math.ohio-state.edu says these bindings are standard on PC editors. 1110;; ilya@math.ohio-state.edu says these bindings are standard on PC editors.
1111(global-set-key [C-right] 'right-word) 1111(global-set-key [C-right] 'right-word)
diff --git a/lisp/calendar/holidays.el b/lisp/calendar/holidays.el
index 695f9b92712..3ba1078f62d 100644
--- a/lisp/calendar/holidays.el
+++ b/lisp/calendar/holidays.el
@@ -632,8 +632,9 @@ The optional LABEL is used to label the buffer created."
632;;;###diary-autoload 632;;;###diary-autoload
633(defun calendar-check-holidays (date) 633(defun calendar-check-holidays (date)
634 "Check the list of holidays for any that occur on DATE. 634 "Check the list of holidays for any that occur on DATE.
635The value returned is a list of strings of relevant holiday descriptions. 635DATE is a list (month day year). This function considers the
636The holidays are those in the list `calendar-holidays'." 636holidays from the list `calendar-holidays', and returns a list of
637strings describing those holidays that apply on DATE."
637 (let ((displayed-month (calendar-extract-month date)) 638 (let ((displayed-month (calendar-extract-month date))
638 (displayed-year (calendar-extract-year date)) 639 (displayed-year (calendar-extract-year date))
639 holiday-list) 640 holiday-list)
diff --git a/lisp/comint.el b/lisp/comint.el
index 59feab82e44..52580db6186 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -3040,8 +3040,9 @@ Returns t if successful."
3040 (comint--complete-file-name-data))) 3040 (comint--complete-file-name-data)))
3041 3041
3042;; FIXME: comint--common-suffix, comint--common-quoted-suffix, and 3042;; FIXME: comint--common-suffix, comint--common-quoted-suffix, and
3043;; comint--table-subvert copied from pcomplete. And they don't fully solve 3043;; comint--table-subvert don't fully solve the problem, since
3044;; the problem, since selecting a file from *Completions* won't quote it. 3044;; selecting a file from *Completions* won't quote it, among several
3045;; other problems.
3045 3046
3046(defun comint--common-suffix (s1 s2) 3047(defun comint--common-suffix (s1 s2)
3047 (assert (not (or (string-match "\n" s1) (string-match "\n" s2)))) 3048 (assert (not (or (string-match "\n" s1) (string-match "\n" s2))))
@@ -3076,43 +3077,45 @@ SS1 = (unquote SS2)."
3076 (cons (substring s1 0 (- (length s1) cs)) 3077 (cons (substring s1 0 (- (length s1) cs))
3077 (substring s2 0 (- (length s2) cs)))))) 3078 (substring s2 0 (- (length s2) cs))))))
3078 3079
3079(defun comint--table-subvert (table s1 s2 string pred action) 3080(defun comint--table-subvert (table s1 s2 &optional quote-fun unquote-fun)
3080 "Completion table that replaces the prefix S1 with S2 in STRING. 3081 "Completion table that replaces the prefix S1 with S2 in STRING.
3081When TABLE, S1 and S2 are provided by `apply-partially', the result 3082When TABLE, S1 and S2 are provided by `apply-partially', the result
3082is a completion table which completes strings of the form (concat S1 S) 3083is a completion table which completes strings of the form (concat S1 S)
3083in the same way as TABLE completes strings of the form (concat S2 S)." 3084in the same way as TABLE completes strings of the form (concat S2 S)."
3084 (let* ((str (if (eq t (compare-strings string 0 (length s1) s1 nil nil 3085 (lambda (string pred action)
3085 completion-ignore-case)) 3086 (let* ((str (if (eq t (compare-strings string 0 (length s1) s1 nil nil
3086 (concat s2 (comint-unquote-filename 3087 completion-ignore-case))
3087 (substring string (length s1)))))) 3088 (let ((rest (substring string (length s1))))
3088 (res (if str (complete-with-action action table str pred)))) 3089 (concat s2 (if unquote-fun
3089 (when res 3090 (funcall unquote-fun rest) rest)))))
3090 (cond 3091 (res (if str (complete-with-action action table str pred))))
3091 ((and (eq (car-safe action) 'boundaries)) 3092 (when res
3092 (let ((beg (or (and (eq (car-safe res) 'boundaries) (cadr res)) 0))) 3093 (cond
3093 (list* 'boundaries 3094 ((and (eq (car-safe action) 'boundaries))
3094 (max (length s1) 3095 (let ((beg (or (and (eq (car-safe res) 'boundaries) (cadr res)) 0)))
3095 ;; FIXME: Adjust because of quoting/unquoting. 3096 (list* 'boundaries
3096 (+ beg (- (length s1) (length s2)))) 3097 (max (length s1)
3097 (and (eq (car-safe res) 'boundaries) (cddr res))))) 3098 ;; FIXME: Adjust because of quoting/unquoting.
3098 ((stringp res) 3099 (+ beg (- (length s1) (length s2))))
3099 (if (eq t (compare-strings res 0 (length s2) s2 nil nil 3100 (and (eq (car-safe res) 'boundaries) (cddr res)))))
3100 completion-ignore-case)) 3101 ((stringp res)
3101 (concat s1 (comint-quote-filename 3102 (if (eq t (compare-strings res 0 (length s2) s2 nil nil
3102 (substring res (length s2)))))) 3103 completion-ignore-case))
3103 ((eq action t) 3104 (let ((rest (substring res (length s2))))
3104 (let ((bounds (completion-boundaries str table pred ""))) 3105 (concat s1 (if quote-fun (funcall quote-fun rest) rest)))))
3105 (if (>= (car bounds) (length s2)) 3106 ((eq action t)
3106 res 3107 (let ((bounds (completion-boundaries str table pred "")))
3107 (let ((re (concat "\\`" 3108 (if (>= (car bounds) (length s2))
3108 (regexp-quote (substring s2 (car bounds)))))) 3109 res
3109 (delq nil 3110 (let ((re (concat "\\`"
3110 (mapcar (lambda (c) 3111 (regexp-quote (substring s2 (car bounds))))))
3111 (if (string-match re c) 3112 (delq nil
3112 (substring c (match-end 0)))) 3113 (mapcar (lambda (c)
3113 res)))))) 3114 (if (string-match re c)
3114 ;; E.g. action=nil and it's the only completion. 3115 (substring c (match-end 0))))
3115 (res))))) 3116 res))))))
3117 ;; E.g. action=nil and it's the only completion.
3118 (res))))))
3116 3119
3117(defun comint-completion-file-name-table (string pred action) 3120(defun comint-completion-file-name-table (string pred action)
3118 (if (not (file-name-absolute-p string)) 3121 (if (not (file-name-absolute-p string))
@@ -3146,10 +3149,10 @@ in the same way as TABLE completes strings of the form (concat S2 S)."
3146 (table 3149 (table
3147 (let ((prefixes (comint--common-quoted-suffix 3150 (let ((prefixes (comint--common-quoted-suffix
3148 unquoted filename))) 3151 unquoted filename)))
3149 (apply-partially 3152 (comint--table-subvert
3150 #'comint--table-subvert
3151 #'comint-completion-file-name-table 3153 #'comint-completion-file-name-table
3152 (cdr prefixes) (car prefixes))))) 3154 (cdr prefixes) (car prefixes)
3155 #'comint-quote-filename #'comint-unquote-filename))))
3153 (nconc 3156 (nconc
3154 (list 3157 (list
3155 filename-beg filename-end 3158 filename-beg filename-end
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index 232c6c3808e..3760a7a9d74 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -180,12 +180,7 @@ Leaving \"Default\" unchecked is equivalent with specifying a default of
180 (symbol :format "%v")) 180 (symbol :format "%v"))
181 (const :tag "always" t))) 181 (const :tag "always" t)))
182 (debug-ignored-errors debug (repeat (choice symbol regexp))) 182 (debug-ignored-errors debug (repeat (choice symbol regexp)))
183 (debug-on-quit debug 183 (debug-on-quit debug boolean)
184 (choice (const :tag "off")
185 (repeat :menu-tag "When"
186 :value (nil)
187 (symbol :format "%v"))
188 (const :tag "always" t)))
189 ;; fileio.c 184 ;; fileio.c
190 (delete-by-moving-to-trash auto-save boolean "23.1") 185 (delete-by-moving-to-trash auto-save boolean "23.1")
191 (auto-save-visited-file-name auto-save boolean) 186 (auto-save-visited-file-name auto-save boolean)
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index 57d25c9e169..176b906632c 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -1557,7 +1557,7 @@ expressions; a `progn' form will be returned enclosing these forms."
1557 ;; The first spec is handled and the remainder-handler handles the rest. 1557 ;; The first spec is handled and the remainder-handler handles the rest.
1558 (let ((edebug-matching-depth 1558 (let ((edebug-matching-depth
1559 (if (> edebug-matching-depth edebug-max-depth) 1559 (if (> edebug-matching-depth edebug-max-depth)
1560 (error "too deep - perhaps infinite loop in spec?") 1560 (error "Too deep - perhaps infinite loop in spec?")
1561 (1+ edebug-matching-depth)))) 1561 (1+ edebug-matching-depth))))
1562 (cond 1562 (cond
1563 ((null specs) nil) 1563 ((null specs) nil)
@@ -3201,7 +3201,7 @@ before returning. The default is one second."
3201 "Modify the breakpoint for the form at point or after it. 3201 "Modify the breakpoint for the form at point or after it.
3202Set it if FLAG is non-nil, clear it otherwise. Then move to that point. 3202Set it if FLAG is non-nil, clear it otherwise. Then move to that point.
3203If CONDITION or TEMPORARY are non-nil, add those attributes to 3203If CONDITION or TEMPORARY are non-nil, add those attributes to
3204the breakpoint. " 3204the breakpoint."
3205 (let ((edebug-stop-point (edebug-find-stop-point))) 3205 (let ((edebug-stop-point (edebug-find-stop-point)))
3206 (if edebug-stop-point 3206 (if edebug-stop-point
3207 (let* ((edebug-def-name (car edebug-stop-point)) 3207 (let* ((edebug-def-name (car edebug-stop-point))
@@ -3879,24 +3879,23 @@ Global commands prefixed by `global-edebug-prefix':
3879\\{global-edebug-map} 3879\\{global-edebug-map}
3880 3880
3881Options: 3881Options:
3882edebug-setup-hook 3882`edebug-setup-hook'
3883edebug-all-defs 3883`edebug-all-defs'
3884edebug-all-forms 3884`edebug-all-forms'
3885edebug-save-windows 3885`edebug-save-windows'
3886edebug-save-displayed-buffer-points 3886`edebug-save-displayed-buffer-points'
3887edebug-initial-mode 3887`edebug-initial-mode'
3888edebug-trace 3888`edebug-trace'
3889edebug-test-coverage 3889`edebug-test-coverage'
3890edebug-continue-kbd-macro 3890`edebug-continue-kbd-macro'
3891edebug-print-length 3891`edebug-print-length'
3892edebug-print-level 3892`edebug-print-level'
3893edebug-print-circle 3893`edebug-print-circle'
3894edebug-on-error 3894`edebug-on-error'
3895edebug-on-quit 3895`edebug-on-quit'
3896edebug-on-signal 3896`edebug-on-signal'
3897edebug-unwrap-results 3897`edebug-unwrap-results'
3898edebug-global-break-condition 3898`edebug-global-break-condition'"
3899"
3900 ;; If the user kills the buffer in which edebug is currently active, 3899 ;; If the user kills the buffer in which edebug is currently active,
3901 ;; exit to top level, because the edebug command loop can't usefully 3900 ;; exit to top level, because the edebug command loop can't usefully
3902 ;; continue running in such a case. 3901 ;; continue running in such a case.
diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el
index 1a9d7c97b83..c33c2ccf9d1 100644
--- a/lisp/eshell/eshell.el
+++ b/lisp/eshell/eshell.el
@@ -344,16 +344,16 @@ With prefix ARG, insert output into the current buffer at point."
344 (require 'esh-cmd) 344 (require 'esh-cmd)
345 (unless arg 345 (unless arg
346 (setq arg current-prefix-arg)) 346 (setq arg current-prefix-arg))
347 (unwind-protect 347 (let ((eshell-non-interactive-p t))
348 (let ((eshell-non-interactive-p t)) 348 ;; Enable `eshell-mode' only in this minibuffer.
349 (add-hook 'minibuffer-setup-hook 'eshell-mode) 349 (minibuffer-with-setup-hook #'(lambda ()
350 (add-hook 'minibuffer-exit-hook 'eshell-add-command-to-history) 350 (eshell-mode)
351 (add-hook 'eshell-mode-hook 'eshell-return-exits-minibuffer) 351 (eshell-return-exits-minibuffer))
352 (unless command 352 (unwind-protect
353 (setq command (read-from-minibuffer "Emacs shell command: ")))) 353 (unless command
354 (remove-hook 'eshell-mode-hook 'eshell-return-exits-minibuffer) 354 (setq command (read-from-minibuffer "Emacs shell command: ")))
355 (remove-hook 'minibuffer-exit-hook 'eshell-add-command-to-history) 355 (when command
356 (remove-hook 'minibuffer-setup-hook 'eshell-mode)) 356 (eshell-add-input-to-history command)))))
357 (unless command 357 (unless command
358 (error "No command specified!")) 358 (error "No command specified!"))
359 ;; redirection into the current buffer is achieved by adding an 359 ;; redirection into the current buffer is achieved by adding an
diff --git a/lisp/faces.el b/lisp/faces.el
index 9a14e832065..d5f0ef90ee0 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -2065,9 +2065,9 @@ terminal type to a different value."
2065 (((supports :underline t)) 2065 (((supports :underline t))
2066 :underline t) 2066 :underline t)
2067 (t 2067 (t
2068 ;; default to italic, even it doesn't appear to be supported, 2068 ;; Default to italic, even if it doesn't appear to be supported,
2069 ;; because in some cases the display engine will do it's own 2069 ;; because in some cases the display engine will do its own
2070 ;; workaround (to `dim' on ttys) 2070 ;; workaround (to `dim' on ttys).
2071 :slant italic)) 2071 :slant italic))
2072 "Basic italic face." 2072 "Basic italic face."
2073 :group 'basic-faces) 2073 :group 'basic-faces)
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index a330d5c6be8..9c76635fb63 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,32 @@
12011-10-09 Andreas Schwab <schwab@linux-m68k.org>
2
3 * html2text.el (html2text-get-attr): Correctly handle attribute values
4 containing "=".
5
62011-09-22 Kan-Ru Chen <kanru@kanru.info>
7
8 * ecomplete.el (ecomplete-display-matches): Use a local keymap to
9 handle bindings.
10
112011-10-06 Lars Magne Ingebrigtsen <larsi@gnus.org>
12
13 * gnus-win.el (gnus-configure-windows): Protect against reading
14 ephemeral groups outside of Gnus.
15
162011-10-06 Katsumi Yamaoka <yamaoka@jpl.org>
17
18 * shr.el (shr-tag-img): Don't get images displayed in tables.
19
202011-10-03 Glenn Morris <rgm@gnu.org>
21
22 * gnus-group.el (gnus-bug-group-download-format-alist): Once again get
23 the "maintainer" version of debbugs.gnu.org reports.
24
252011-10-02 Lars Magne Ingebrigtsen <larsi@gnus.org>
26
27 * shr.el (shr-tag-img): Add a space at the end of an ALT image text to
28 make asynchronous adjacent image insertion work better.
29
12011-09-27 Daiki Ueno <ueno@unixuser.org> 302011-09-27 Daiki Ueno <ueno@unixuser.org>
2 31
3 * plstore.el (plstore-select-keys, plstore-encrypt-to): Clarify 32 * plstore.el (plstore-select-keys, plstore-encrypt-to): Clarify
diff --git a/lisp/gnus/ecomplete.el b/lisp/gnus/ecomplete.el
index 6a47b119f10..5d1c46bc2f6 100644
--- a/lisp/gnus/ecomplete.el
+++ b/lisp/gnus/ecomplete.el
@@ -27,6 +27,11 @@
27(eval-when-compile 27(eval-when-compile
28 (require 'cl)) 28 (require 'cl))
29 29
30(eval-when-compile
31 (when (featurep 'xemacs)
32 ;; The `kbd' macro requires that the `read-kbd-macro' macro is available.
33 (require 'edmacro)))
34
30(defgroup ecomplete nil 35(defgroup ecomplete nil
31 "Electric completion of email addresses and the like." 36 "Electric completion of email addresses and the like."
32 :group 'mail) 37 :group 'mail)
@@ -123,15 +128,24 @@
123 (message "%s" matches) 128 (message "%s" matches)
124 nil) 129 nil)
125 (setq highlight (ecomplete-highlight-match-line matches line)) 130 (setq highlight (ecomplete-highlight-match-line matches line))
126 (while (not (memq (setq command (read-event highlight)) '(? return))) 131 (let ((local-map (make-sparse-keymap))
127 (cond 132 selected)
128 ((eq command ?\M-n) 133 (define-key local-map (kbd "RET")
129 (setq line (min (1+ line) max-lines))) 134 (lambda () (setq selected (nth line (split-string matches "\n")))))
130 ((eq command ?\M-p) 135 (define-key local-map (kbd "M-n")
131 (setq line (max (1- line) 0)))) 136 (lambda () (setq line (min (1+ line) max-lines))))
132 (setq highlight (ecomplete-highlight-match-line matches line))) 137 (define-key local-map (kbd "M-p")
133 (when (eq command 'return) 138 (lambda () (setq line (max (1- line) 0))))
134 (nth line (split-string matches "\n"))))))) 139 (let ((overriding-local-map local-map))
140 (while (and (null selected)
141 (setq command (read-key-sequence highlight))
142 (lookup-key local-map command))
143 (apply (key-binding command) nil)
144 (setq highlight (ecomplete-highlight-match-line matches line))))
145 (if selected
146 (message selected)
147 (message "Abort"))
148 selected)))))
135 149
136(defun ecomplete-highlight-match-line (matches line) 150(defun ecomplete-highlight-match-line (matches line)
137 (with-temp-buffer 151 (with-temp-buffer
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index 720881acd98..4c527caff5c 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -2429,7 +2429,7 @@ Valid input formats include:
2429 (gnus-read-ephemeral-gmane-group group start range))) 2429 (gnus-read-ephemeral-gmane-group group start range)))
2430 2430
2431(defcustom gnus-bug-group-download-format-alist 2431(defcustom gnus-bug-group-download-format-alist
2432 '((emacs . "http://debbugs.gnu.org/%s;mboxstat=yes") 2432 '((emacs . "http://debbugs.gnu.org/%s;mboxmaint=yes;mboxstat=yes")
2433 (debian 2433 (debian
2434 . "http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=%s&mbox=yes;mboxmaint=yes")) 2434 . "http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=%s&mbox=yes;mboxmaint=yes"))
2435 "Alist of symbols for bug trackers and the corresponding URL format string. 2435 "Alist of symbols for bug trackers and the corresponding URL format string.
diff --git a/lisp/gnus/gnus-win.el b/lisp/gnus/gnus-win.el
index c38f57d96cb..a1a8abc3086 100644
--- a/lisp/gnus/gnus-win.el
+++ b/lisp/gnus/gnus-win.el
@@ -358,8 +358,13 @@ See the Gnus manual for an explanation of the syntax used.")
358(defvar gnus-frame-split-p nil) 358(defvar gnus-frame-split-p nil)
359 359
360(defun gnus-configure-windows (setting &optional force) 360(defun gnus-configure-windows (setting &optional force)
361 (if (window-configuration-p setting) 361 (cond
362 (set-window-configuration setting) 362 ((null setting)
363 ;; Do nothing.
364 )
365 ((window-configuration-p setting)
366 (set-window-configuration setting))
367 (t
363 (setq gnus-current-window-configuration setting) 368 (setq gnus-current-window-configuration setting)
364 (setq force (or force gnus-always-force-window-configuration)) 369 (setq force (or force gnus-always-force-window-configuration))
365 (let ((split (if (symbolp setting) 370 (let ((split (if (symbolp setting)
@@ -410,7 +415,7 @@ See the Gnus manual for an explanation of the syntax used.")
410 (run-hooks 'gnus-configure-windows-hook) 415 (run-hooks 'gnus-configure-windows-hook)
411 (when gnus-window-frame-focus 416 (when gnus-window-frame-focus
412 (gnus-select-frame-set-input-focus 417 (gnus-select-frame-set-input-focus
413 (window-frame gnus-window-frame-focus)))))))) 418 (window-frame gnus-window-frame-focus)))))))))
414 419
415(defun gnus-delete-windows-in-gnusey-frames () 420(defun gnus-delete-windows-in-gnusey-frames ()
416 "Do a `delete-other-windows' in all frames that have Gnus windows." 421 "Do a `delete-other-windows' in all frames that have Gnus windows."
diff --git a/lisp/gnus/html2text.el b/lisp/gnus/html2text.el
index 0635ab0afc6..7e699827141 100644
--- a/lisp/gnus/html2text.el
+++ b/lisp/gnus/html2text.el
@@ -193,7 +193,7 @@ formatting, and then moved afterward.")
193 ;; size=3 193 ;; size=3
194 ((string-match "[^ ]=[^ ]" prev) 194 ((string-match "[^ ]=[^ ]" prev)
195 (let ((attr (nth 0 (split-string prev "="))) 195 (let ((attr (nth 0 (split-string prev "=")))
196 (value (nth 1 (split-string prev "=")))) 196 (value (substring prev (1+ (string-match "=" prev)))))
197 (setq attr-list (cons (list attr value) attr-list)))) 197 (setq attr-list (cons (list attr value) attr-list))))
198 ;; size= 3 198 ;; size= 3
199 ((string-match "[^ ]=\\'" prev) 199 ((string-match "[^ ]=\\'" prev)
@@ -204,7 +204,7 @@ formatting, and then moved afterward.")
204 ;; size=3 204 ;; size=3
205 ((string-match "[^ ]=[^ ]" this) 205 ((string-match "[^ ]=[^ ]" this)
206 (let ((attr (nth 0 (split-string this "="))) 206 (let ((attr (nth 0 (split-string this "=")))
207 (value (nth 1 (split-string this "=")))) 207 (value (substring prev (1+ (string-match "=" this)))))
208 (setq attr-list (cons (list attr value) attr-list)))) 208 (setq attr-list (cons (list attr value) attr-list))))
209 ;; size =3 209 ;; size =3
210 ((string-match "\\`=[^ ]" this) 210 ((string-match "\\`=[^ ]" this)
@@ -358,7 +358,7 @@ formatting, and then moved afterward.")
358 (delete-region p1 p4) 358 (delete-region p1 p4)
359 (when href 359 (when href
360 (goto-char p1) 360 (goto-char p1)
361 (insert (substring href 1 -1 )) 361 (insert (substring href 1 -1))
362 (put-text-property p1 (point) 'face 'bold)))) 362 (put-text-property p1 (point) 'face 'bold))))
363 363
364;; 364;;
diff --git a/lisp/gnus/shr.el b/lisp/gnus/shr.el
index f49bbd69da3..7b9af3302af 100644
--- a/lisp/gnus/shr.el
+++ b/lisp/gnus/shr.el
@@ -901,7 +901,7 @@ ones, in case fg and bg are nil."
901 (url-is-cached (shr-encode-url url))) 901 (url-is-cached (shr-encode-url url)))
902 (funcall shr-put-image-function (shr-get-image-data url) alt)) 902 (funcall shr-put-image-function (shr-get-image-data url) alt))
903 (t 903 (t
904 (insert alt) 904 (insert alt " ")
905 (when (and shr-ignore-cache 905 (when (and shr-ignore-cache
906 (url-is-cached (shr-encode-url url))) 906 (url-is-cached (shr-encode-url url)))
907 (let ((file (url-cache-create-filename (shr-encode-url url)))) 907 (let ((file (url-cache-create-filename (shr-encode-url url))))
@@ -912,14 +912,15 @@ ones, in case fg and bg are nil."
912 'url-queue-retrieve 912 'url-queue-retrieve
913 'url-retrieve) 913 'url-retrieve)
914 (shr-encode-url url) 'shr-image-fetched 914 (shr-encode-url url) 'shr-image-fetched
915 (list (current-buffer) start (point-marker)) 915 (list (current-buffer) start (set-marker (make-marker) (1- (point))))
916 t))) 916 t)))
917 (put-text-property start (point) 'keymap shr-map) 917 (when (zerop shr-table-depth) ;; We are not in a table.
918 (put-text-property start (point) 'shr-alt alt) 918 (put-text-property start (point) 'keymap shr-map)
919 (put-text-property start (point) 'image-url url) 919 (put-text-property start (point) 'shr-alt alt)
920 (put-text-property start (point) 'image-displayer 920 (put-text-property start (point) 'image-url url)
921 (shr-image-displayer shr-content-function)) 921 (put-text-property start (point) 'image-displayer
922 (put-text-property start (point) 'help-echo alt) 922 (shr-image-displayer shr-content-function))
923 (put-text-property start (point) 'help-echo alt))
923 (setq shr-state 'image))))) 924 (setq shr-state 'image)))))
924 925
925(defun shr-tag-pre (cont) 926(defun shr-tag-pre (cont)
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index 3276447e72f..0a5d6ed954c 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -1306,17 +1306,22 @@ If nil, that means no input method is activated now.")
1306(make-variable-buffer-local 'current-input-method-title) 1306(make-variable-buffer-local 'current-input-method-title)
1307(put 'current-input-method-title 'permanent-local t) 1307(put 'current-input-method-title 'permanent-local t)
1308 1308
1309(define-widget 'mule-input-method-string 'string
1310 "String widget with completion for input method."
1311 :completions
1312 (lambda (string pred action)
1313 (let ((completion-ignore-case t))
1314 (complete-with-action action input-method-alist string pred)))
1315 :prompt-history 'input-method-history)
1316
1309(defcustom default-input-method nil 1317(defcustom default-input-method nil
1310 "Default input method for multilingual text (a string). 1318 "Default input method for multilingual text (a string).
1311This is the input method activated automatically by the command 1319This is the input method activated automatically by the command
1312`toggle-input-method' (\\[toggle-input-method])." 1320`toggle-input-method' (\\[toggle-input-method])."
1313 :link '(custom-manual "(emacs)Input Methods") 1321 :link '(custom-manual "(emacs)Input Methods")
1314 :group 'mule 1322 :group 'mule
1315 :type '(choice (const nil) 1323 :type `(choice (const nil)
1316 (string 1324 mule-input-method-string)
1317 :completions (apply-partially
1318 #'completion-table-case-fold input-method-alist)
1319 :prompt-history input-method-history))
1320 :set-after '(current-language-environment)) 1325 :set-after '(current-language-environment))
1321 1326
1322(put 'input-method-function 'permanent-local t) 1327(put 'input-method-function 'permanent-local t)
@@ -1879,10 +1884,11 @@ specifies the character set for the major languages of Western Europe."
1879(define-widget 'charset 'symbol 1884(define-widget 'charset 'symbol
1880 "An Emacs charset." 1885 "An Emacs charset."
1881 :tag "Charset" 1886 :tag "Charset"
1882 :completions (apply-partially #'completion-table-with-predicate 1887 :completions
1883 (apply-partially #'completion-table-case-fold 1888 (lambda (string pred action)
1884 obarray) 1889 (let ((completion-ignore-case t))
1885 #'charsetp 'strict) 1890 (completion-table-with-predicate
1891 obarray #'charsetp 'strict string pred action)))
1886 :value 'ascii 1892 :value 'ascii
1887 :validate (lambda (widget) 1893 :validate (lambda (widget)
1888 (unless (charsetp (widget-value widget)) 1894 (unless (charsetp (widget-value widget))
@@ -1917,8 +1923,10 @@ See `set-language-info-alist' for use in programs."
1917 :type `(alist 1923 :type `(alist
1918 :key-type (string :tag "Language environment" 1924 :key-type (string :tag "Language environment"
1919 :completions 1925 :completions
1920 (apply-partially #'completion-table-case-fold 1926 (lambda (string pred action)
1921 language-info-alist)) 1927 (let ((completion-ignore-case t))
1928 (complete-with-action
1929 action language-info-alist string pred))))
1922 :value-type 1930 :value-type
1923 (alist :key-type symbol 1931 (alist :key-type symbol
1924 :options ((documentation string) 1932 :options ((documentation string)
@@ -1929,12 +1937,7 @@ See `set-language-info-alist' for use in programs."
1929 (coding-system (repeat coding-system)) 1937 (coding-system (repeat coding-system))
1930 (coding-priority (repeat coding-system)) 1938 (coding-priority (repeat coding-system))
1931 (nonascii-translation charset) 1939 (nonascii-translation charset)
1932 (input-method 1940 (input-method mule-input-method-string)
1933 (string
1934 :completions
1935 (apply-partially #'completion-table-case-fold
1936 input-method-alist)
1937 :prompt-history input-method-history))
1938 (features (repeat symbol)) 1941 (features (repeat symbol))
1939 (unibyte-display coding-system))))) 1942 (unibyte-display coding-system)))))
1940 1943
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.")
924(defun smtpmail-send-data (process buffer) 924(defun smtpmail-send-data (process buffer)
925 (let ((data-continue t) sending-data 925 (let ((data-continue t) sending-data
926 (pr (with-current-buffer buffer 926 (pr (with-current-buffer buffer
927 (make-progress-reporter "Sending email" 927 (make-progress-reporter "Sending email "
928 (point-min) (point-max))))) 928 (point-min) (point-max)))))
929 (with-current-buffer buffer 929 (with-current-buffer buffer
930 (goto-char (point-min))) 930 (goto-char (point-min)))
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index 021e46d5053..e2ed07f1ef1 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -216,9 +216,13 @@ You should give VAR a non-nil `risky-local-variable' property."
216 (setq ,var (,fun))) 216 (setq ,var (,fun)))
217 ,var)))) 217 ,var))))
218 218
219(defun completion-table-case-fold (table string pred action) 219(defun completion-table-case-fold (table &optional dont-fold)
220 (let ((completion-ignore-case t)) 220 "Return new completion TABLE that is case insensitive.
221 (complete-with-action action table string pred))) 221If DONT-FOLD is non-nil, return a completion table that is
222case sensitive instead."
223 (lambda (string pred action)
224 (let ((completion-ignore-case (not dont-fold)))
225 (complete-with-action action table string pred))))
222 226
223(defun completion-table-with-context (prefix table string pred action) 227(defun completion-table-with-context (prefix table string pred action)
224 ;; TODO: add `suffix' maybe? 228 ;; TODO: add `suffix' maybe?
@@ -468,6 +472,15 @@ ALL-COMPLETIONS is the function that lists the completions (it should
468follow the calling convention of `completion-all-completions'), 472follow the calling convention of `completion-all-completions'),
469and DOC describes the way this style of completion works.") 473and DOC describes the way this style of completion works.")
470 474
475(defconst completion--styles-type
476 `(repeat :tag "insert a new menu to add more styles"
477 (choice ,@(mapcar (lambda (x) (list 'const (car x)))
478 completion-styles-alist))))
479(defconst completion--cycling-threshold-type
480 '(choice (const :tag "No cycling" nil)
481 (const :tag "Always cycle" t)
482 (integer :tag "Threshold")))
483
471(defcustom completion-styles 484(defcustom completion-styles
472 ;; First, use `basic' because prefix completion has been the standard 485 ;; First, use `basic' because prefix completion has been the standard
473 ;; for "ever" and works well in most cases, so using it first 486 ;; for "ever" and works well in most cases, so using it first
@@ -486,8 +499,7 @@ The available styles are listed in `completion-styles-alist'.
486 499
487Note that `completion-category-overrides' may override these 500Note that `completion-category-overrides' may override these
488styles for specific categories, such as files, buffers, etc." 501styles for specific categories, such as files, buffers, etc."
489 :type `(repeat (choice ,@(mapcar (lambda (x) (list 'const (car x))) 502 :type completion--styles-type
490 completion-styles-alist)))
491 :group 'minibuffer 503 :group 'minibuffer
492 :version "23.1") 504 :version "23.1")
493 505
@@ -498,18 +510,19 @@ Each override has the shape (CATEGORY . ALIST) where ALIST is
498an association list that can specify properties such as: 510an association list that can specify properties such as:
499- `styles': the list of `completion-styles' to use for that category. 511- `styles': the list of `completion-styles' to use for that category.
500- `cycle': the `completion-cycle-threshold' to use for that category." 512- `cycle': the `completion-cycle-threshold' to use for that category."
501 :type `(alist :key-type (choice (const buffer) 513 :type `(alist :key-type (choice :tag "Category"
514 (const buffer)
502 (const file) 515 (const file)
516 (const unicode-name)
503 symbol) 517 symbol)
504 :value-type 518 :value-type
505 (set 519 (set :tag "Properties to override"
506 (cons (const style) 520 (cons :tag "Completion Styles"
507 (repeat ,@(mapcar (lambda (x) (list 'const (car x))) 521 (const :tag "Select a style from the menu;" styles)
508 completion-styles-alist))) 522 ,completion--styles-type)
509 (cons (const cycle) 523 (cons :tag "Completion Cycling"
510 (choice (const :tag "No cycling" nil) 524 (const :tag "Select one value from the menu." cycle)
511 (const :tag "Always cycle" t) 525 ,completion--cycling-threshold-type))))
512 (integer :tag "Threshold"))))))
513 526
514(defun completion--styles (metadata) 527(defun completion--styles (metadata)
515 (let* ((cat (completion-metadata-get metadata 'category)) 528 (let* ((cat (completion-metadata-get metadata 'category))
@@ -595,9 +608,7 @@ If nil, cycling is never used.
595If t, cycling is always used. 608If t, cycling is always used.
596If an integer, cycling is used as soon as there are fewer completion 609If an integer, cycling is used as soon as there are fewer completion
597candidates than this number." 610candidates than this number."
598 :type '(choice (const :tag "No cycling" nil) 611 :type completion--cycling-threshold-type)
599 (const :tag "Always cycle" t)
600 (integer :tag "Threshold")))
601 612
602(defun completion--cycle-threshold (metadata) 613(defun completion--cycle-threshold (metadata)
603 (let* ((cat (completion-metadata-get metadata 'category)) 614 (let* ((cat (completion-metadata-get metadata 'category))
diff --git a/lisp/mpc.el b/lisp/mpc.el
index 8854d4e908f..251e1864927 100644
--- a/lisp/mpc.el
+++ b/lisp/mpc.el
@@ -1089,10 +1089,12 @@ If PLAYLIST is t or nil or missing, use the main playlist."
1089(defvar mpc-tool-bar-map 1089(defvar mpc-tool-bar-map
1090 (let ((map (make-sparse-keymap))) 1090 (let ((map (make-sparse-keymap)))
1091 (tool-bar-local-item "mpc/prev" 'mpc-prev 'prev map 1091 (tool-bar-local-item "mpc/prev" 'mpc-prev 'prev map
1092 :enable '(not (equal (cdr (assq 'state mpc-status)) "stop"))) 1092 :enable '(not (equal (cdr (assq 'state mpc-status)) "stop"))
1093 :label "Prev" :vert-only t)
1093 ;; FIXME: how can we bind it to the down-event? 1094 ;; FIXME: how can we bind it to the down-event?
1094 (tool-bar-local-item "mpc/rewind" 'mpc-rewind 'rewind map 1095 (tool-bar-local-item "mpc/rewind" 'mpc-rewind 'rewind map
1095 :enable '(not (equal (cdr (assq 'state mpc-status)) "stop")) 1096 :enable '(not (equal (cdr (assq 'state mpc-status)) "stop"))
1097 :label "Rew" :vert-only t
1096 :button '(:toggle . (and mpc--faster-toggle-timer 1098 :button '(:toggle . (and mpc--faster-toggle-timer
1097 (not mpc--faster-toggle-forward)))) 1099 (not mpc--faster-toggle-forward))))
1098 ;; We could use a single toggle command for pause/play, with 2 different 1100 ;; We could use a single toggle command for pause/play, with 2 different
@@ -1100,20 +1102,26 @@ If PLAYLIST is t or nil or missing, use the main playlist."
1100 ;; to be a toggle-button, thus displayed depressed in one of the 1102 ;; to be a toggle-button, thus displayed depressed in one of the
1101 ;; two states :-( 1103 ;; two states :-(
1102 (tool-bar-local-item "mpc/pause" 'mpc-pause 'pause map 1104 (tool-bar-local-item "mpc/pause" 'mpc-pause 'pause map
1105 :label "Pause" :vert-only t
1103 :visible '(equal (cdr (assq 'state mpc-status)) "play") 1106 :visible '(equal (cdr (assq 'state mpc-status)) "play")
1104 :help "Pause/play") 1107 :help "Pause/play")
1105 (tool-bar-local-item "mpc/play" 'mpc-play 'play map 1108 (tool-bar-local-item "mpc/play" 'mpc-play 'play map
1109 :label "Play" :vert-only t
1106 :visible '(not (equal (cdr (assq 'state mpc-status)) "play")) 1110 :visible '(not (equal (cdr (assq 'state mpc-status)) "play"))
1107 :help "Play/pause") 1111 :help "Play/pause")
1108 ;; FIXME: how can we bind it to the down-event? 1112 ;; FIXME: how can we bind it to the down-event?
1109 (tool-bar-local-item "mpc/ffwd" 'mpc-ffwd 'ffwd map 1113 (tool-bar-local-item "mpc/ffwd" 'mpc-ffwd 'ffwd map
1110 :enable '(not (equal (cdr (assq 'state mpc-status)) "stop")) 1114 :enable '(not (equal (cdr (assq 'state mpc-status)) "stop"))
1115 :label "Ffwd" :vert-only t
1111 :button '(:toggle . (and mpc--faster-toggle-timer 1116 :button '(:toggle . (and mpc--faster-toggle-timer
1112 mpc--faster-toggle-forward))) 1117 mpc--faster-toggle-forward)))
1113 (tool-bar-local-item "mpc/next" 'mpc-next 'next map 1118 (tool-bar-local-item "mpc/next" 'mpc-next 'next map
1119 :label "Next" :vert-only t
1114 :enable '(not (equal (cdr (assq 'state mpc-status)) "stop"))) 1120 :enable '(not (equal (cdr (assq 'state mpc-status)) "stop")))
1115 (tool-bar-local-item "mpc/stop" 'mpc-stop 'stop map) 1121 (tool-bar-local-item "mpc/stop" 'mpc-stop 'stop map
1122 :label "Stop" :vert-only t)
1116 (tool-bar-local-item "mpc/add" 'mpc-playlist-add 'add map 1123 (tool-bar-local-item "mpc/add" 'mpc-playlist-add 'add map
1124 :label "Add" :vert-only t
1117 :help "Append to the playlist") 1125 :help "Append to the playlist")
1118 map)) 1126 map))
1119 1127
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."
1886 (apply foreign operation args)) 1886 (apply foreign operation args))
1887 1887
1888 ;; Trace that somebody has interrupted the operation. 1888 ;; Trace that somebody has interrupted the operation.
1889 (quit 1889 ((debug quit)
1890 (let (tramp-message-show-message) 1890 (let (tramp-message-show-message)
1891 (tramp-message 1891 (tramp-message
1892 v 1 "Interrupt received in operation %s" 1892 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."
1898 ;; operations shall return at least a default value 1898 ;; operations shall return at least a default value
1899 ;; in order to give the user a chance to correct the 1899 ;; in order to give the user a chance to correct the
1900 ;; file name in the minibuffer. 1900 ;; file name in the minibuffer.
1901 ;; We cannot use 'debug as error handler. In order
1902 ;; to get a full backtrace, one could apply
1903 ;; (setq debug-on-error t debug-on-signal t)
1901 (error 1904 (error
1902 (cond 1905 (cond
1903 ((and completion (zerop (length localname)) 1906 ((and completion (zerop (length localname))
@@ -3850,9 +3853,9 @@ Only works for Bourne-like shells."
3850;; * Run emerge on two remote files. Bug is described here: 3853;; * Run emerge on two remote files. Bug is described here:
3851;; <http://www.mail-archive.com/tramp-devel@nongnu.org/msg01041.html>. 3854;; <http://www.mail-archive.com/tramp-devel@nongnu.org/msg01041.html>.
3852;; (Bug#6850) 3855;; (Bug#6850)
3853 3856;; * It would be very useful if it were possible to load or save a
3854;; Functions for file-name-handler-alist: 3857;; buffer using Tramp in a non-blocking way so that use of Emacs on
3855;; diff-latest-backup-file -- in diff.el 3858;; other buffers could continue. (Bug#9617)
3856 3859
3857;;; tramp.el ends here 3860;;; tramp.el ends here
3858 3861
diff --git a/lisp/pcmpl-unix.el b/lisp/pcmpl-unix.el
index e947bfe1da6..b466c2cd899 100644
--- a/lisp/pcmpl-unix.el
+++ b/lisp/pcmpl-unix.el
@@ -193,10 +193,25 @@ Uses both `pcmpl-ssh-config-file' and `pcmpl-ssh-known-hosts-file'."
193 "Completion rules for the `scp' command. 193 "Completion rules for the `scp' command.
194Includes files as well as host names followed by a colon." 194Includes files as well as host names followed by a colon."
195 (pcomplete-opt "1246BCpqrvcFiloPS") 195 (pcomplete-opt "1246BCpqrvcFiloPS")
196 (while t (pcomplete-here (append (pcomplete-all-entries) 196 (while t (pcomplete-here
197 (mapcar (lambda (host) 197 (lambda (string pred action)
198 (concat host ":")) 198 (let ((table
199 (pcmpl-ssh-hosts)))))) 199 (cond
200 ((string-match "\\`[^:/]+:" string) ; Remote file name.
201 (if (and (eq action 'lambda)
202 (eq (match-end 0) (length string)))
203 ;; Avoid connecting to the remote host when we're
204 ;; only completing the host name.
205 (list string)
206 (comint--table-subvert (pcomplete-all-entries)
207 "" "/ssh:")))
208 ((string-match "/" string) ; Local file name.
209 (pcomplete-all-entries))
210 (t ;Host name or local file name.
211 (append (all-completions string (pcomplete-all-entries))
212 (mapcar (lambda (host) (concat host ":"))
213 (pcmpl-ssh-hosts)))))))
214 (complete-with-action action table string pred))))))
200 215
201(provide 'pcmpl-unix) 216(provide 'pcmpl-unix)
202 217
diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el
index 4ac69df8e3a..8ae1e203849 100644
--- a/lisp/pcomplete.el
+++ b/lisp/pcomplete.el
@@ -370,7 +370,7 @@ modified to be an empty string, or the desired separation string."
370;; it pretty much impossible to have completion other than 370;; it pretty much impossible to have completion other than
371;; prefix-completion. 371;; prefix-completion.
372;; 372;;
373;; pcomplete--common-quoted-suffix and pcomplete--table-subvert try to 373;; pcomplete--common-quoted-suffix and comint--table-subvert try to
374;; work around this difficulty with heuristics, but it's 374;; work around this difficulty with heuristics, but it's
375;; really a hack. 375;; really a hack.
376 376
@@ -408,45 +408,6 @@ SS1 = (unquote SS2)."
408 (cons (substring s1 0 (- (length s1) cs)) 408 (cons (substring s1 0 (- (length s1) cs))
409 (substring s2 0 (- (length s2) cs)))))) 409 (substring s2 0 (- (length s2) cs))))))
410 410
411(defun pcomplete--table-subvert (table s1 s2 string pred action)
412 ;; FIXME: Copied in comint.el.
413 "Completion table that replaces the prefix S1 with S2 in STRING.
414When TABLE, S1 and S2 are provided by `apply-partially', the result
415is a completion table which completes strings of the form (concat S1 S)
416in the same way as TABLE completes strings of the form (concat S2 S)."
417 (let* ((str (if (eq t (compare-strings string 0 (length s1) s1 nil nil
418 completion-ignore-case))
419 (concat s2 (pcomplete-unquote-argument
420 (substring string (length s1))))))
421 (res (if str (complete-with-action action table str pred))))
422 (when res
423 (cond
424 ((and (eq (car-safe action) 'boundaries))
425 (let ((beg (or (and (eq (car-safe res) 'boundaries) (cadr res)) 0)))
426 (list* 'boundaries
427 (max (length s1)
428 ;; FIXME: Adjust because of quoting/unquoting.
429 (+ beg (- (length s1) (length s2))))
430 (and (eq (car-safe res) 'boundaries) (cddr res)))))
431 ((stringp res)
432 (if (eq t (compare-strings res 0 (length s2) s2 nil nil
433 completion-ignore-case))
434 (concat s1 (pcomplete-quote-argument
435 (substring res (length s2))))))
436 ((eq action t)
437 (let ((bounds (completion-boundaries str table pred "")))
438 (if (>= (car bounds) (length s2))
439 res
440 (let ((re (concat "\\`"
441 (regexp-quote (substring s2 (car bounds))))))
442 (delq nil
443 (mapcar (lambda (c)
444 (if (string-match re c)
445 (substring c (match-end 0))))
446 res))))))
447 ;; E.g. action=nil and it's the only completion.
448 (res)))))
449
450;; I don't think such commands are usable before first setting up buffer-local 411;; I don't think such commands are usable before first setting up buffer-local
451;; variables to parse args, so there's no point autoloading it. 412;; variables to parse args, so there's no point autoloading it.
452;; ;;;###autoload 413;; ;;;###autoload
@@ -480,7 +441,7 @@ Same as `pcomplete' but using the standard completion UI."
480 ;; pcomplete-stub and works from the buffer's text instead, 441 ;; pcomplete-stub and works from the buffer's text instead,
481 ;; we need to trick minibuffer-complete, into using 442 ;; we need to trick minibuffer-complete, into using
482 ;; pcomplete-stub without its knowledge. To that end, we 443 ;; pcomplete-stub without its knowledge. To that end, we
483 ;; use pcomplete--table-subvert to construct a completion 444 ;; use comint--table-subvert to construct a completion
484 ;; table which expects strings using a prefix from the 445 ;; table which expects strings using a prefix from the
485 ;; buffer's text but internally uses the corresponding 446 ;; buffer's text but internally uses the corresponding
486 ;; prefix from pcomplete-stub. 447 ;; prefix from pcomplete-stub.
@@ -498,9 +459,9 @@ Same as `pcomplete' but using the standard completion UI."
498 ;; practice it should work just fine (fingers crossed). 459 ;; practice it should work just fine (fingers crossed).
499 (let ((prefixes (pcomplete--common-quoted-suffix 460 (let ((prefixes (pcomplete--common-quoted-suffix
500 pcomplete-stub buftext))) 461 pcomplete-stub buftext)))
501 (apply-partially #'pcomplete--table-subvert 462 (comint--table-subvert
502 completions 463 completions (cdr prefixes) (car prefixes)
503 (cdr prefixes) (car prefixes)))) 464 #'pcomplete-quote-argument #'pcomplete-unquote-argument)))
504 (t 465 (t
505 (lambda (string pred action) 466 (lambda (string pred action)
506 (let ((res (complete-with-action 467 (let ((res (complete-with-action
@@ -523,8 +484,7 @@ Same as `pcomplete' but using the standard completion UI."
523 (funcall norm-func (directory-file-name f)) 484 (funcall norm-func (directory-file-name f))
524 seen))))))) 485 seen)))))))
525 (when pcomplete-ignore-case 486 (when pcomplete-ignore-case
526 (setq table 487 (setq table (completion-table-case-fold table)))
527 (apply-partially #'completion-table-case-fold table)))
528 (list beg (point) table 488 (list beg (point) table
529 :predicate pred 489 :predicate pred
530 :exit-function 490 :exit-function
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el
index eb33822ce55..3d5c8a97835 100644
--- a/lisp/progmodes/f90.el
+++ b/lisp/progmodes/f90.el
@@ -1489,14 +1489,19 @@ Does not check type and subprogram indentation."
1489 (if (not (f90-previous-statement)) 1489 (if (not (f90-previous-statement))
1490 ;; If f90-previous-statement returns nil, we must have been 1490 ;; If f90-previous-statement returns nil, we must have been
1491 ;; called from on or before the first line of the first statement. 1491 ;; called from on or before the first line of the first statement.
1492 (setq icol (if (save-excursion 1492 (setq icol (if (or (save-excursion
1493 ;; f90-previous-statement has moved us over 1493 (goto-char pnt)
1494 ;; comment/blank lines, so we need to get 1494 (beginning-of-line)
1495 ;; back to the first code statement. 1495 ;; Preprocessor line before code statement.
1496 (when (looking-at "[ \t]*\\([!#]\\|$\\)") 1496 (looking-at "[ \t]*#"))
1497 (f90-next-statement)) 1497 (progn
1498 (skip-chars-forward " \t0-9") 1498 ;; f90-previous-statement has moved us over
1499 (f90-looking-at-program-block-start)) 1499 ;; comment/blank lines, so we need to get
1500 ;; back to the first code statement.
1501 (when (looking-at "[ \t]*\\([!#]\\|$\\)")
1502 (f90-next-statement))
1503 (skip-chars-forward " \t0-9")
1504 (f90-looking-at-program-block-start)))
1500 0 1505 0
1501 ;; No explicit PROGRAM start statement. 1506 ;; No explicit PROGRAM start statement.
1502 f90-program-indent)) 1507 f90-program-indent))
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index a4d7cff4127..22db7b2e5f4 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -605,6 +605,12 @@ NOARG must be t when this macro is used outside `gud-def'"
605The directory containing FILE becomes the initial working directory 605The directory containing FILE becomes the initial working directory
606and source-file directory for your debugger. 606and source-file directory for your debugger.
607 607
608COMMAND-LINE is the shell command for starting the gdb session.
609It should be a string consisting of the name of the gdb
610executable followed by command-line options. The command-line
611options should include \"-i=mi\" to use gdb's MI text interface.
612Note that the old \"--annotate\" option is no longer supported.
613
608If `gdb-many-windows' is nil (the default value) then gdb just 614If `gdb-many-windows' is nil (the default value) then gdb just
609pops up the GUD buffer unless `gdb-show-main' is t. In this case 615pops up the GUD buffer unless `gdb-show-main' is t. In this case
610it starts with two windows: one displaying the GUD buffer and the 616it starts with two windows: one displaying the GUD buffer and the
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el
index 933f004bb5d..f051b49fe2a 100644
--- a/lisp/progmodes/perl-mode.el
+++ b/lisp/progmodes/perl-mode.el
@@ -633,8 +633,8 @@ Turning on Perl mode runs the normal hook `perl-mode-hook'."
633 633
634(defalias 'electric-perl-terminator 'perl-electric-terminator) 634(defalias 'electric-perl-terminator 'perl-electric-terminator)
635(defun perl-electric-terminator (arg) 635(defun perl-electric-terminator (arg)
636 "Insert character and adjust indentation. 636 "Insert character and maybe adjust indentation.
637If at end-of-line, and not in a comment or a quote, correct the's indentation." 637If at end-of-line, and not in a comment or a quote, correct the indentation."
638 (interactive "P") 638 (interactive "P")
639 (let ((insertpos (point))) 639 (let ((insertpos (point)))
640 (and (not arg) ; decide whether to indent 640 (and (not arg) ; decide whether to indent
@@ -832,7 +832,11 @@ Optional argument PARSE-START should be the position of `beginning-of-defun'."
832 (save-excursion 832 (save-excursion
833 (beginning-of-line) 833 (beginning-of-line)
834 (looking-at "\\s-+sub\\>")) 834 (looking-at "\\s-+sub\\>"))
835 (> indent-point (save-excursion (forward-sexp 1) (point)))) 835 (> indent-point (save-excursion
836 (condition-case nil
837 (forward-sexp 1)
838 (scan-error nil))
839 (point))))
836 (perl-beginning-of-function)) 840 (perl-beginning-of-function))
837 (while (< (point) indent-point) ;repeat until right sexp 841 (while (< (point) indent-point) ;repeat until right sexp
838 (setq state (parse-partial-sexp (point) indent-point 0)) 842 (setq state (parse-partial-sexp (point) indent-point 0))
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."
945 (forward-line (1- line))))) 945 (forward-line (1- line)))))
946 946
947(defun count-words-region (start end) 947(defun count-words-region (start end)
948 "Count the number of words in the active region. 948 "Return the number of words between START and END.
949If the region is not active, counts the number of words in the buffer." 949If called interactively, print a message reporting the number of
950 (interactive (if (use-region-p) (list (region-beginning) (region-end)) 950lines, words, and characters in the region."
951 (list (point-min) (point-max)))) 951 (interactive "r")
952 (let ((count 0)) 952 (let ((words 0))
953 (save-excursion 953 (save-excursion
954 (save-restriction 954 (save-restriction
955 (narrow-to-region start end) 955 (narrow-to-region start end)
956 (goto-char (point-min)) 956 (goto-char (point-min))
957 (while (forward-word 1) 957 (while (forward-word 1)
958 (setq count (1+ count))))) 958 (setq words (1+ words)))))
959 (when (called-interactively-p 'interactive) 959 (when (called-interactively-p 'interactive)
960 (message "%s has %d words" 960 (count-words--message "Region"
961 (if (use-region-p) "Region" "Buffer") 961 (count-lines start end)
962 count)) 962 words
963 count)) 963 (- end start)))
964 964 words))
965(defun count-lines-region (start end) 965
966 "Print number of lines and characters in the region." 966(defun count-words ()
967 (interactive "r") 967 "Display the number of lines, words, and characters in the buffer.
968 (message "Region has %d lines, %d characters" 968In Transient Mark mode when the mark is active, display the
969 (count-lines start end) (- end start))) 969number of lines, words, and characters in the region."
970 (interactive)
971 (if (use-region-p)
972 (call-interactively 'count-words-region)
973 (let* ((beg (point-min))
974 (end (point-max))
975 (lines (count-lines beg end))
976 (words (count-words-region beg end))
977 (chars (- end beg)))
978 (count-words--message "Buffer" lines words chars))))
979
980(defun count-words--message (str lines words chars)
981 (message "%s has %d line%s, %d word%s, and %d character%s."
982 str
983 lines (if (= lines 1) "" "s")
984 words (if (= words 1) "" "s")
985 chars (if (= chars 1) "" "s")))
986
987(defalias 'count-lines-region 'count-words-region)
970 988
971(defun what-line () 989(defun what-line ()
972 "Print the current buffer line number and narrowed line number of point." 990 "Print the current buffer line number and narrowed line number of point."
diff --git a/lisp/subr.el b/lisp/subr.el
index 4946f3eef7a..05ac198dd13 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -552,7 +552,8 @@ AFTER should be a single event type--a symbol or a character, not a sequence.
552 552
553Bindings are always added before any inherited map. 553Bindings are always added before any inherited map.
554 554
555The order of bindings in a keymap matters when it is used as a menu." 555The order of bindings in a keymap only matters when it is used as
556a menu, so this function is not useful for non-menu keymaps."
556 (unless after (setq after t)) 557 (unless after (setq after t))
557 (or (keymapp keymap) 558 (or (keymapp keymap)
558 (signal 'wrong-type-argument (list 'keymapp keymap))) 559 (signal 'wrong-type-argument (list 'keymapp keymap)))
@@ -2170,7 +2171,7 @@ keyboard-quit events while waiting for a valid input."
2170 (setq prompt (propertize prompt 'face 'minibuffer-prompt))) 2171 (setq prompt (propertize prompt 'face 'minibuffer-prompt)))
2171 (setq char (let ((inhibit-quit inhibit-keyboard-quit)) 2172 (setq char (let ((inhibit-quit inhibit-keyboard-quit))
2172 (read-key prompt))) 2173 (read-key prompt)))
2173 (and show-help (buffer-live-p helpbuf) 2174 (and show-help (buffer-live-p (get-buffer helpbuf))
2174 (kill-buffer helpbuf)) 2175 (kill-buffer helpbuf))
2175 (cond 2176 (cond
2176 ((not (numberp char))) 2177 ((not (numberp char)))
diff --git a/lisp/window.el b/lisp/window.el
index c6722a62c74..7241e148dae 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -1058,6 +1058,32 @@ windows nor the buffer list."
1058 (dolist (walk-windows-window (window-list-1 nil minibuf all-frames)) 1058 (dolist (walk-windows-window (window-list-1 nil minibuf all-frames))
1059 (funcall proc walk-windows-window)))) 1059 (funcall proc walk-windows-window))))
1060 1060
1061(defun window-point-1 (&optional window)
1062 "Return value of WINDOW's point.
1063WINDOW can be any live window and defaults to the selected one.
1064
1065This function is like `window-point' with one exception: If
1066WINDOW is selected, it returns the value of `point' of WINDOW's
1067buffer regardless of whether that buffer is current or not."
1068 (setq window (window-normalize-live-window window))
1069 (if (eq window (selected-window))
1070 (with-current-buffer (window-buffer window)
1071 (point))
1072 (window-point window)))
1073
1074(defun set-window-point-1 (window pos)
1075 "Set value of WINDOW's point to POS.
1076WINDOW can be any live window and defaults to the selected one.
1077
1078This function is like `set-window-point' with one exception: If
1079WINDOW is selected, it moves `point' of WINDOW's buffer to POS
1080regardless of whether that buffer is current or not."
1081 (setq window (window-normalize-live-window window))
1082 (if (eq window (selected-window))
1083 (with-current-buffer (window-buffer window)
1084 (goto-char pos))
1085 (set-window-point window pos)))
1086
1061(defun window-in-direction-2 (window posn &optional horizontal) 1087(defun window-in-direction-2 (window posn &optional horizontal)
1062 "Support function for `window-in-direction'." 1088 "Support function for `window-in-direction'."
1063 (if horizontal 1089 (if horizontal
@@ -1087,7 +1113,7 @@ IGNORE, when non-nil means a window can be returned even if its
1087 (last (+ first (if hor 1113 (last (+ first (if hor
1088 (window-total-width window) 1114 (window-total-width window)
1089 (window-total-height window)))) 1115 (window-total-height window))))
1090 (posn-cons (nth 6 (posn-at-point (window-point window) window))) 1116 (posn-cons (nth 6 (posn-at-point (window-point-1 window) window)))
1091 ;; The column / row value of `posn-at-point' can be nil for the 1117 ;; The column / row value of `posn-at-point' can be nil for the
1092 ;; mini-window, guard against that. 1118 ;; mini-window, guard against that.
1093 (posn (if hor 1119 (posn (if hor
@@ -2492,7 +2518,7 @@ WINDOW must be a live window and defaults to the selected one."
2492 ;; Add an entry for buffer to WINDOW's previous buffers. 2518 ;; Add an entry for buffer to WINDOW's previous buffers.
2493 (with-current-buffer buffer 2519 (with-current-buffer buffer
2494 (let ((start (window-start window)) 2520 (let ((start (window-start window))
2495 (point (window-point window))) 2521 (point (window-point-1 window)))
2496 (setq entry 2522 (setq entry
2497 (cons buffer 2523 (cons buffer
2498 (if entry 2524 (if entry
@@ -2534,10 +2560,7 @@ before was current this also makes BUFFER the current buffer."
2534 ;; Don't force window-start here (even if POINT is nil). 2560 ;; Don't force window-start here (even if POINT is nil).
2535 (set-window-start window start t)) 2561 (set-window-start window start t))
2536 (when point 2562 (when point
2537 (if selected 2563 (set-window-point-1 window point))))
2538 (with-current-buffer buffer
2539 (goto-char point))
2540 (set-window-point window point)))))
2541 2564
2542(defun switch-to-prev-buffer (&optional window bury-or-kill) 2565(defun switch-to-prev-buffer (&optional window bury-or-kill)
2543 "In WINDOW switch to previous buffer. 2566 "In WINDOW switch to previous buffer.
@@ -2738,6 +2761,44 @@ the buffer `*scratch*', creating it if necessary."
2738 (set-buffer-major-mode scratch) 2761 (set-buffer-major-mode scratch)
2739 scratch))) 2762 scratch)))
2740 2763
2764(defcustom frame-auto-hide-function #'iconify-frame
2765 "Function called to automatically hide frames.
2766The function is called with one argument - a frame.
2767
2768Functions affected by this option are those that bury a buffer
2769shown in a separate frame like `quit-window' and `bury-buffer'."
2770 :type '(choice (const :tag "Iconify" iconify-frame)
2771 (const :tag "Delete" delete-frame)
2772 (const :tag "Do nothing" ignore)
2773 function)
2774 :group 'windows
2775 :group 'frames
2776 :version "24.1")
2777
2778(defun window--delete (&optional window dedicated-only kill)
2779 "Delete WINDOW if possible.
2780WINDOW must be a live window and defaults to the selected one.
2781Optional argument DEDICATED-ONLY non-nil means to delete WINDOW
2782only if it's dedicated to its buffer. Optional argument KILL
2783means the buffer shown in window will be killed. Return non-nil
2784if WINDOW gets deleted or its frame is auto-hidden."
2785 (setq window (window-normalize-live-window window))
2786 (unless (and dedicated-only (not (window-dedicated-p window)))
2787 (let* ((buffer (window-buffer window))
2788 (deletable (window-deletable-p window)))
2789 (cond
2790 ((eq deletable 'frame)
2791 (let ((frame (window-frame window)))
2792 (cond
2793 (kill
2794 (delete-frame frame))
2795 ((functionp frame-auto-hide-function)
2796 (funcall frame-auto-hide-function frame))))
2797 'frame)
2798 (deletable
2799 (delete-window window)
2800 t)))))
2801
2741(defun bury-buffer (&optional buffer-or-name) 2802(defun bury-buffer (&optional buffer-or-name)
2742 "Put BUFFER-OR-NAME at the end of the list of all buffers. 2803 "Put BUFFER-OR-NAME at the end of the list of all buffers.
2743There it is the least likely candidate for `other-buffer' to 2804There it is the least likely candidate for `other-buffer' to
@@ -2758,14 +2819,11 @@ displayed there."
2758 ;; is shown in the selected window. 2819 ;; is shown in the selected window.
2759 (cond 2820 (cond
2760 ((or buffer-or-name (not (eq buffer (window-buffer))))) 2821 ((or buffer-or-name (not (eq buffer (window-buffer)))))
2761 ((not (window-dedicated-p)) 2822 ((window--delete nil t))
2762 (switch-to-prev-buffer nil 'bury)) 2823 (t
2763 ((and (frame-root-window-p (selected-window)) 2824 ;; Switch to another buffer in window.
2764 ;; Don't iconify if it's the only frame. 2825 (set-window-dedicated-p nil nil)
2765 (not (eq (next-frame nil 0) (selected-frame)))) 2826 (switch-to-prev-buffer nil 'kill)))
2766 (iconify-frame (window-frame (selected-window))))
2767 ((eq (window-deletable-p) t)
2768 (delete-window)))
2769 2827
2770 ;; Always return nil. 2828 ;; Always return nil.
2771 nil)) 2829 nil))
@@ -2840,30 +2898,21 @@ frames left."
2840BUFFER-OR-NAME may be a buffer or the name of an existing buffer 2898BUFFER-OR-NAME may be a buffer or the name of an existing buffer
2841and defaults to the current buffer. 2899and defaults to the current buffer.
2842 2900
2843When a window showing BUFFER-OR-NAME is either dedicated, or the 2901When a window showing BUFFER-OR-NAME is dedicated, that window is
2844window has no previous buffer, that window is deleted. If that 2902deleted. If that window is the only window on its frame, the
2845window is the only window on its frame, the frame is deleted too 2903frame is deleted too when there are other frames left. If there
2846when there are other frames left. If there are no other frames 2904are no other frames left, some other buffer is displayed in that
2847left, some other buffer is displayed in that window. 2905window.
2848 2906
2849This function removes the buffer denoted by BUFFER-OR-NAME from 2907This function removes the buffer denoted by BUFFER-OR-NAME from
2850all window-local buffer lists." 2908all window-local buffer lists."
2851 (let ((buffer (window-normalize-buffer buffer-or-name))) 2909 (let ((buffer (window-normalize-buffer buffer-or-name)))
2852 (dolist (window (window-list-1 nil nil t)) 2910 (dolist (window (window-list-1 nil nil t))
2853 (if (eq (window-buffer window) buffer) 2911 (if (eq (window-buffer window) buffer)
2854 (let ((deletable (and (window-dedicated-p window) 2912 (unless (window--delete window t t)
2855 (window-deletable-p window)))) 2913 ;; Switch to another buffer in window.
2856 (cond 2914 (set-window-dedicated-p window nil)
2857 ((eq deletable 'frame) 2915 (switch-to-prev-buffer window 'kill))
2858 ;; Delete frame.
2859 (delete-frame (window-frame window)))
2860 (deletable
2861 ;; Delete window.
2862 (delete-window window))
2863 (t
2864 ;; Switch to another buffer in window.
2865 (set-window-dedicated-p window nil)
2866 (switch-to-prev-buffer window 'kill))))
2867 ;; Unrecord BUFFER in WINDOW. 2916 ;; Unrecord BUFFER in WINDOW.
2868 (unrecord-window-buffer window buffer))))) 2917 (unrecord-window-buffer window buffer)))))
2869 2918
@@ -2893,20 +2942,10 @@ one. If non-nil, reset `quit-restore' parameter to nil."
2893 quad resize) 2942 quad resize)
2894 (cond 2943 (cond
2895 ((and (not prev-buffer) 2944 ((and (not prev-buffer)
2896 (eq (nth 1 quit-restore) 'frame) 2945 (memq (nth 1 quit-restore) '(window frame))
2897 (eq (window-deletable-p window) 'frame) 2946 (eq (nth 3 quit-restore) buffer)
2898 (eq (nth 3 quit-restore) buffer)) 2947 ;; Delete WINDOW if possible.
2899 ;; WINDOW's frame can be deleted. 2948 (window--delete window nil kill))
2900 (delete-frame (window-frame window))
2901 ;; If the previously selected window is still alive, select it.
2902 (when (window-live-p (nth 2 quit-restore))
2903 (select-window (nth 2 quit-restore))))
2904 ((and (not prev-buffer)
2905 (eq (nth 1 quit-restore) 'window)
2906 (eq (window-deletable-p window) t)
2907 (eq (nth 3 quit-restore) buffer))
2908 ;; WINDOW can be deleted.
2909 (delete-window window)
2910 ;; If the previously selected window is still alive, select it. 2949 ;; If the previously selected window is still alive, select it.
2911 (when (window-live-p (nth 2 quit-restore)) 2950 (when (window-live-p (nth 2 quit-restore))
2912 (select-window (nth 2 quit-restore)))) 2951 (select-window (nth 2 quit-restore))))
@@ -3538,7 +3577,7 @@ specific buffers."
3538 ;; All buffer related things go in here - make the buffer 3577 ;; All buffer related things go in here - make the buffer
3539 ;; current when retrieving `point' and `mark'. 3578 ;; current when retrieving `point' and `mark'.
3540 (with-current-buffer (window-buffer window) 3579 (with-current-buffer (window-buffer window)
3541 (let ((point (if selected (point) (window-point window))) 3580 (let ((point (window-point-1 window))
3542 (start (window-start window)) 3581 (start (window-start window))
3543 (mark (mark))) 3582 (mark (mark)))
3544 (window-list-no-nils 3583 (window-list-no-nils
@@ -3833,14 +3872,7 @@ element is BUFFER."
3833 (list 'other 3872 (list 'other
3834 ;; A quadruple of WINDOW's buffer, start, point and height. 3873 ;; A quadruple of WINDOW's buffer, start, point and height.
3835 (list (window-buffer window) (window-start window) 3874 (list (window-buffer window) (window-start window)
3836 (if (eq window (selected-window)) 3875 (window-point-1 window) (window-total-size window))
3837 ;; When WINDOW is the selected window use its
3838 ;; buffer's `point' instead of `window-point'
3839 ;; (Bug#9626).
3840 (with-current-buffer (window-buffer window)
3841 (point))
3842 (window-point window))
3843 (window-total-size window))
3844 (selected-window) buffer)))) 3876 (selected-window) buffer))))
3845 ((eq type 'window) 3877 ((eq type 'window)
3846 ;; WINDOW has been created on an existing frame. 3878 ;; WINDOW has been created on an existing frame.
@@ -3927,12 +3959,10 @@ Finally, an element of this list can be also specified as
3927\(BUFFER-NAME FUNCTION OTHER-ARGS). In that case, 3959\(BUFFER-NAME FUNCTION OTHER-ARGS). In that case,
3928`special-display-popup-frame' will call FUNCTION with the buffer 3960`special-display-popup-frame' will call FUNCTION with the buffer
3929named BUFFER-NAME as first argument, and OTHER-ARGS as the 3961named BUFFER-NAME as first argument, and OTHER-ARGS as the
3930second. If `special-display-function' specifies some other 3962second.
3931function, that function is called with the buffer named 3963
3932BUFFER-NAME as first, and the element's cdr as second argument. 3964Any alternative function specified here is responsible for
3933In any case, that function is responsible for setting the value 3965setting up the quit-restore parameter of the window used.
3934The function specified here is responsible for setting the
3935quit-restore and help-setup parameters of the window used.
3936 3966
3937If this variable appears \"not to work\", because you added a 3967If this variable appears \"not to work\", because you added a
3938name to it but the corresponding buffer is displayed in the 3968name to it but the corresponding buffer is displayed in the
@@ -3997,10 +4027,10 @@ as second argument.
3997Finally, an element of this list can be also specified as 4027Finally, an element of this list can be also specified as
3998\(REGEXP FUNCTION OTHER-ARGS). `special-display-popup-frame' 4028\(REGEXP FUNCTION OTHER-ARGS). `special-display-popup-frame'
3999will then call FUNCTION with the buffer whose name matched 4029will then call FUNCTION with the buffer whose name matched
4000REGEXP as first, and OTHER-ARGS as second argument. If 4030REGEXP as first, and OTHER-ARGS as second argument.
4001`special-display-function' specifies some other function, that 4031
4002function is called with the buffer whose name matched REGEXP 4032Any alternative function specified here is responsible for
4003as first, and the element's cdr as second argument. 4033setting up the quit-restore parameter of the window used.
4004 4034
4005If this variable appears \"not to work\", because you added a 4035If this variable appears \"not to work\", because you added a
4006name to it but the corresponding buffer is displayed in the 4036name to it but the corresponding buffer is displayed in the
@@ -4748,7 +4778,7 @@ return the window used; otherwise return nil."
4748 (setq frame (funcall fun)) 4778 (setq frame (funcall fun))
4749 (setq window (frame-selected-window frame))) 4779 (setq window (frame-selected-window frame)))
4750 (display-buffer-record-window 'frame window buffer) 4780 (display-buffer-record-window 'frame window buffer)
4751 (window--display-buffer-2 buffer window) 4781 (window--display-buffer-2 buffer window display-buffer-mark-dedicated)
4752 ;; Reset list of WINDOW's previous buffers to nil. 4782 ;; Reset list of WINDOW's previous buffers to nil.
4753 (set-window-prev-buffers window nil) 4783 (set-window-prev-buffers window nil)
4754 window))) 4784 window)))
@@ -4774,7 +4804,7 @@ If sucessful, return the new window; otherwise return nil."
4774 (window--try-to-split-window 4804 (window--try-to-split-window
4775 (get-lru-window frame t))))) 4805 (get-lru-window frame t)))))
4776 (display-buffer-record-window 'window window buffer) 4806 (display-buffer-record-window 'window window buffer)
4777 (window--display-buffer-2 buffer window) 4807 (window--display-buffer-2 buffer window display-buffer-mark-dedicated)
4778 ;; Reset list of WINDOW's previous buffers to nil. 4808 ;; Reset list of WINDOW's previous buffers to nil.
4779 (set-window-prev-buffers window nil) 4809 (set-window-prev-buffers window nil)
4780 window))) 4810 window)))
@@ -4946,7 +4976,7 @@ one.
4946If FORCE-SAME-WINDOW is non-nil, BUFFER-OR-NAME must be displayed 4976If FORCE-SAME-WINDOW is non-nil, BUFFER-OR-NAME must be displayed
4947in the selected window; signal an error if that is 4977in the selected window; signal an error if that is
4948impossible (e.g. if the selected window is minibuffer-only). If 4978impossible (e.g. if the selected window is minibuffer-only). If
4949non-nil, BUFFER-OR-NAME may be displayed in another window. 4979nil, BUFFER-OR-NAME may be displayed in another window.
4950 4980
4951Return the buffer switched to." 4981Return the buffer switched to."
4952 (interactive 4982 (interactive