aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJoakim Verona2012-08-19 02:44:11 +0200
committerJoakim Verona2012-08-19 02:44:11 +0200
commit5436d1df5e2ba0b4d4f72b03a1cd09b20403654b (patch)
tree532faa27319b3bb199d414dc85e63a58246d30b0 /lisp
parentd02344322b0d2fea8dd9ad9dd0a6c70e058f967b (diff)
parente757f1c6f393cf82057dbee0a4325b07f0fd55c4 (diff)
downloademacs-5436d1df5e2ba0b4d4f72b03a1cd09b20403654b.tar.gz
emacs-5436d1df5e2ba0b4d4f72b03a1cd09b20403654b.zip
upstream
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog62
-rw-r--r--lisp/mail/rmail.el1
-rw-r--r--lisp/mail/rmailout.el71
-rw-r--r--lisp/mouse.el14
-rw-r--r--lisp/net/tramp-sh.el75
-rw-r--r--lisp/progmodes/subword.el28
-rw-r--r--lisp/simple.el47
-rw-r--r--lisp/subr.el133
-rw-r--r--lisp/window.el162
9 files changed, 360 insertions, 233 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index cc42b1493ee..ec89b3784d9 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,65 @@
12012-08-18 Chong Yidong <cyd@gnu.org>
2
3 * simple.el (yank-handled-properties): New defcustom.
4 (yank-excluded-properties): Add font-lock-face and category.
5 (yank): Doc fix.
6
7 * subr.el (remove-yank-excluded-properties): Obey
8 yank-handled-properties. The special handling of font-lock-face
9 and category is now done this way, instead of being hard-coded.
10 (insert-for-yank-1): Remove font-lock-face handling.
11 (yank-handle-font-lock-face-property)
12 (yank-handle-category-property): New function.
13
142012-08-17 Glenn Morris <rgm@gnu.org>
15
16 * mail/rmailout.el (rmail-output-read-file-name):
17 Check rmail-output-file-alist against the full message body
18 in the correct rmail buffer. (Bug#12214)
19
202012-08-17 Michael Albinus <michael.albinus@gmx.de>
21
22 * net/tramp-sh.el (tramp-sh-handle-start-file-process): Eliminate
23 superfluous prompt. (Bug#12203)
24
252012-08-17 Chong Yidong <cyd@gnu.org>
26
27 * mouse.el (mouse-appearance-menu): If x-select-font returns a
28 font spec, set the font directly (Bug#3228).
29
302012-08-17 Martin Rudalics <rudalics@gmx.at>
31
32 * window.el (delete-window): Fix last fix.
33
342012-08-16 Martin Rudalics <rudalics@gmx.at>
35
36 * window.el (window-valid-p): Move to window.c.
37 (window-child, window-child-count, window-last-child)
38 (window-normalize-window, window-combined-p)
39 (window-combinations, window-atom-root, window-min-size)
40 (window-sizable, window-sizable-p, window-size-fixed-p)
41 (window-min-delta, window-max-delta, window--resizable)
42 (window--resizable-p, window-resizable, window-total-size)
43 (window-full-height-p, window-full-width-p, window-body-size)
44 (window-at-side-p, adjust-window-trailing-edge, maximize-window)
45 (minimize-window, window-deletable-p, delete-window)
46 (delete-other-windows, set-window-buffer-start-and-point)
47 (next-buffer, previous-buffer, split-window, balance-windows-2)
48 (set-window-text-height, window-buffer-height)
49 (fit-window-to-buffer, shrink-window-if-larger-than-buffer)
50 (truncated-partial-width-window-p): Minor code adjustments. In
51 doc-strings state whether the argument window has to denote a
52 live, valid or any window.
53
542012-08-16 Phil Sainty <psainty@orcon.net.nz> (tiny change)
55
56 * progmodes/subword.el (subword-forward-function)
57 (subword-backward-function, subword-forward-regexp)
58 (subword-backward-regexp): New variables.
59 (subword-forward, subword-forward-internal, subword-backward-internal):
60 Use new variables, eg so that different "word" definitions
61 can be easily used. (Bug#11411)
62
12012-08-15 Stefan Monnier <monnier@iro.umontreal.ca> 632012-08-15 Stefan Monnier <monnier@iro.umontreal.ca>
2 64
3 * vc/vc-mtn.el (vc-mtn-revision-completion-table): Handle completion 65 * vc/vc-mtn.el (vc-mtn-revision-completion-table): Handle completion
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 9fe8f28a59f..d88862b2d47 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -663,6 +663,7 @@ Element N specifies the summary line for message N+1.")
663(defvar rmail-last-regexp nil) 663(defvar rmail-last-regexp nil)
664(put 'rmail-last-regexp 'permanent-local t) 664(put 'rmail-last-regexp 'permanent-local t)
665 665
666;; Note that rmail-output-read-file-name modifies this.
666(defcustom rmail-default-file "~/xmail" 667(defcustom rmail-default-file "~/xmail"
667 "Default file name for \\[rmail-output]." 668 "Default file name for \\[rmail-output]."
668 :type 'file 669 :type 'file
diff --git a/lisp/mail/rmailout.el b/lisp/mail/rmailout.el
index 9c5b99c5184..5d500135b7a 100644
--- a/lisp/mail/rmailout.el
+++ b/lisp/mail/rmailout.el
@@ -34,7 +34,6 @@
34 :type 'boolean 34 :type 'boolean
35 :group 'rmail-output) 35 :group 'rmail-output)
36 36
37;; FIXME risky?
38(defcustom rmail-output-file-alist nil 37(defcustom rmail-output-file-alist nil
39 "Alist matching regexps to suggested output Rmail files. 38 "Alist matching regexps to suggested output Rmail files.
40This is a list of elements of the form (REGEXP . NAME-EXP). 39This is a list of elements of the form (REGEXP . NAME-EXP).
@@ -47,6 +46,7 @@ a file name as a string."
47 (string :tag "File Name") 46 (string :tag "File Name")
48 sexp))) 47 sexp)))
49 :group 'rmail-output) 48 :group 'rmail-output)
49;; This is risky because NAME-EXP gets evalled.
50;;;###autoload(put 'rmail-output-file-alist 'risky-local-variable t) 50;;;###autoload(put 'rmail-output-file-alist 'risky-local-variable t)
51 51
52(defcustom rmail-fields-not-to-output nil 52(defcustom rmail-fields-not-to-output nil
@@ -58,35 +58,46 @@ The function `rmail-delete-unwanted-fields' uses this, ignoring case."
58 58
59(defun rmail-output-read-file-name () 59(defun rmail-output-read-file-name ()
60 "Read the file name to use for `rmail-output'. 60 "Read the file name to use for `rmail-output'.
61Set `rmail-default-file' to this name as well as returning it." 61Set `rmail-default-file' to this name as well as returning it.
62 (let ((default-file 62This uses `rmail-output-file-alist'."
63 (let (answer tail) 63 (let* ((default-file
64 (setq tail rmail-output-file-alist) 64 (when rmail-output-file-alist
65 ;; Suggest a file based on a pattern match. 65 (or rmail-buffer (error "There is no Rmail buffer"))
66 (while (and tail (not answer)) 66 (save-current-buffer
67 (save-excursion 67 (set-buffer rmail-buffer)
68 (goto-char (point-min)) 68 (let ((beg (rmail-msgbeg rmail-current-message))
69 (if (re-search-forward (car (car tail)) nil t) 69 (end (rmail-msgend rmail-current-message)))
70 (setq answer (eval (cdr (car tail))))) 70 (if (rmail-buffers-swapped-p) (set-buffer rmail-view-buffer))
71 (setq tail (cdr tail)))) 71 (save-excursion
72 ;; If no suggestion, use same file as last time. 72 (save-restriction
73 (or answer rmail-default-file)))) 73 (widen)
74 (let ((read-file 74 (narrow-to-region beg end)
75 (expand-file-name 75 (let ((tail rmail-output-file-alist)
76 (read-file-name 76 answer)
77 (concat "Output message to mail file (default " 77 ;; Suggest a file based on a pattern match.
78 (file-name-nondirectory default-file) 78 (while (and tail (not answer))
79 "): ") 79 (goto-char (point-min))
80 (file-name-directory default-file) 80 (if (re-search-forward (caar tail) nil t)
81 (abbreviate-file-name default-file)) 81 (setq answer (eval (cdar tail))))
82 (file-name-directory default-file)))) 82 (setq tail (cdr tail)))
83 (setq rmail-default-file 83 ;; If no suggestion, use same file as last time.
84 (if (file-directory-p read-file) 84 (or answer rmail-default-file))))))))
85 (expand-file-name (file-name-nondirectory default-file) 85 (read-file
86 read-file) 86 (expand-file-name
87 (expand-file-name 87 (read-file-name
88 (or read-file (file-name-nondirectory default-file)) 88 (concat "Output message to mail file (default "
89 (file-name-directory default-file))))))) 89 (file-name-nondirectory default-file)
90 "): ")
91 (file-name-directory default-file)
92 (abbreviate-file-name default-file))
93 (file-name-directory default-file))))
94 (setq rmail-default-file
95 (if (file-directory-p read-file)
96 (expand-file-name (file-name-nondirectory default-file)
97 read-file)
98 (expand-file-name
99 (or read-file (file-name-nondirectory default-file))
100 (file-name-directory default-file))))))
90 101
91(defun rmail-delete-unwanted-fields (preserve) 102(defun rmail-delete-unwanted-fields (preserve)
92 "Delete all headers matching `rmail-fields-not-to-output'. 103 "Delete all headers matching `rmail-fields-not-to-output'.
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 589bbd67b1b..4ea84288f69 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -1951,12 +1951,14 @@ choose a font."
1951 (choice 1951 (choice
1952 ;; Either choice == 'x-select-font, or choice is a 1952 ;; Either choice == 'x-select-font, or choice is a
1953 ;; symbol whose name is a font. 1953 ;; symbol whose name is a font.
1954 (buffer-face-mode-invoke (font-face-attributes 1954 (let ((font (if (eq choice 'x-select-font)
1955 (if (eq choice 'x-select-font) 1955 (x-select-font)
1956 (x-select-font) 1956 (symbol-name choice))))
1957 (symbol-name choice))) 1957 (buffer-face-mode-invoke
1958 t 1958 (if (fontp font 'font-spec)
1959 (called-interactively-p 'interactive)))))))) 1959 (list :font font)
1960 (font-face-attributes font))
1961 t (called-interactively-p 'interactive)))))))))
1960 1962
1961 1963
1962;;; Bindings for mouse commands. 1964;;; Bindings for mouse commands.
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index e757247c2a2..6283188d46a 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -2738,51 +2738,64 @@ the result will be a local, non-Tramp, filename."
2738 (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer))) 2738 (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer)))
2739 (name1 name) 2739 (name1 name)
2740 (i 0)) 2740 (i 0))
2741 (unwind-protect 2741
2742 (save-excursion 2742 (unless buffer
2743 (save-restriction 2743 ;; BUFFER can be nil. We use a temporary buffer.
2744 (unless buffer 2744 (setq buffer (generate-new-buffer tramp-temp-buffer-name)))
2745 ;; BUFFER can be nil. We use a temporary buffer. 2745 (while (get-process name1)
2746 (setq buffer (generate-new-buffer tramp-temp-buffer-name))) 2746 ;; NAME must be unique as process name.
2747 (while (get-process name1) 2747 (setq i (1+ i)
2748 ;; NAME must be unique as process name. 2748 name1 (format "%s<%d>" name i)))
2749 (setq i (1+ i) 2749 (setq name name1)
2750 name1 (format "%s<%d>" name i))) 2750 ;; Set the new process properties.
2751 (setq name name1) 2751 (tramp-set-connection-property v "process-name" name)
2752 ;; Set the new process properties. 2752 (tramp-set-connection-property v "process-buffer" buffer)
2753 (tramp-set-connection-property v "process-name" name) 2753
2754 (tramp-set-connection-property v "process-buffer" buffer) 2754 (with-current-buffer (tramp-get-connection-buffer v)
2755 ;; Activate narrowing in order to save BUFFER contents. 2755 (unwind-protect
2756 ;; Clear also the modification time; otherwise we might 2756 (save-excursion
2757 ;; be interrupted by `verify-visited-file-modtime'. 2757 (save-restriction
2758 (with-current-buffer (tramp-get-connection-buffer v) 2758 ;; Activate narrowing in order to save BUFFER
2759 (let ((buffer-undo-list t)) 2759 ;; contents. Clear also the modification time;
2760 ;; otherwise we might be interrupted by
2761 ;; `verify-visited-file-modtime'.
2762 (let ((buffer-undo-list t)
2763 (buffer-read-only nil)
2764 (mark (point)))
2760 (clear-visited-file-modtime) 2765 (clear-visited-file-modtime)
2761 (narrow-to-region (point-max) (point-max)) 2766 (narrow-to-region (point-max) (point-max))
2767 ;; We call `tramp-maybe-open-connection', in order
2768 ;; to cleanup the prompt afterwards.
2769 (tramp-maybe-open-connection v)
2770 (widen)
2771 (delete-region mark (point))
2772 (narrow-to-region (point-max) (point-max))
2773 ;; Now do it.
2762 (if command 2774 (if command
2763 ;; Send the command. 2775 ;; Send the command.
2764 (tramp-send-command v command nil t) ; nooutput 2776 (tramp-send-command v command nil t) ; nooutput
2765 ;; Check, whether a pty is associated. 2777 ;; Check, whether a pty is associated.
2766 (tramp-maybe-open-connection v)
2767 (unless (tramp-compat-process-get 2778 (unless (tramp-compat-process-get
2768 (tramp-get-connection-process v) 'remote-tty) 2779 (tramp-get-connection-process v) 'remote-tty)
2769 (tramp-error 2780 (tramp-error
2770 v 'file-error 2781 v 'file-error
2771 "pty association is not supported for `%s'" name))))) 2782 "pty association is not supported for `%s'" name))))
2772 (let ((p (tramp-get-connection-process v))) 2783 (let ((p (tramp-get-connection-process v)))
2773 ;; Set query flag for this process. 2784 ;; Set query flag for this process. We ignore errors,
2774 (tramp-compat-set-process-query-on-exit-flag p t) 2785 ;; because the process could have finished already.
2775 ;; Return process. 2786 (ignore-errors
2776 p))) 2787 (tramp-compat-set-process-query-on-exit-flag p t))
2777 ;; Save exit. 2788 ;; Return process.
2778 (with-current-buffer (tramp-get-connection-buffer v) 2789 p)))
2790
2791 ;; Save exit.
2779 (if (string-match tramp-temp-buffer-name (buffer-name)) 2792 (if (string-match tramp-temp-buffer-name (buffer-name))
2780 (progn 2793 (progn
2781 (set-process-buffer (tramp-get-connection-process v) nil) 2794 (set-process-buffer (tramp-get-connection-process v) nil)
2782 (kill-buffer (current-buffer))) 2795 (kill-buffer (current-buffer)))
2783 (set-buffer-modified-p bmp))) 2796 (set-buffer-modified-p bmp))
2784 (tramp-set-connection-property v "process-name" nil) 2797 (tramp-set-connection-property v "process-name" nil)
2785 (tramp-set-connection-property v "process-buffer" nil))))) 2798 (tramp-set-connection-property v "process-buffer" nil))))))
2786 2799
2787(defun tramp-sh-handle-process-file 2800(defun tramp-sh-handle-process-file
2788 (program &optional infile destination display &rest args) 2801 (program &optional infile destination display &rest args)
diff --git a/lisp/progmodes/subword.el b/lisp/progmodes/subword.el
index 7d8dd4301a2..e541aed8867 100644
--- a/lisp/progmodes/subword.el
+++ b/lisp/progmodes/subword.el
@@ -80,6 +80,20 @@
80 80
81;;; Code: 81;;; Code:
82 82
83(defvar subword-forward-function 'subword-forward-internal
84 "Function to call for forward subword movement.")
85
86(defvar subword-backward-function 'subword-backward-internal
87 "Function to call for backward subword movement.")
88
89(defvar subword-forward-regexp
90 "\\W*\\(\\([[:upper:]]*\\W?\\)[[:lower:][:digit:]]*\\)"
91 "Regexp used by `subword-forward-internal'.")
92
93(defvar subword-backward-regexp
94 "\\(\\(\\W\\|[[:lower:][:digit:]]\\)\\([[:upper:]]+\\W*\\)\\|\\W\\w+\\)"
95 "Regexp used by `subword-backward-internal'.")
96
83(defvar subword-mode-map 97(defvar subword-mode-map
84 (let ((map (make-sparse-keymap))) 98 (let ((map (make-sparse-keymap)))
85 (dolist (cmd '(forward-word backward-word mark-word kill-word 99 (dolist (cmd '(forward-word backward-word mark-word kill-word
@@ -138,10 +152,10 @@ Optional argument ARG is the same as for `forward-word'."
138 (cond 152 (cond
139 ((< 0 arg) 153 ((< 0 arg)
140 (dotimes (i arg (point)) 154 (dotimes (i arg (point))
141 (subword-forward-internal))) 155 (funcall subword-forward-function)))
142 ((> 0 arg) 156 ((> 0 arg)
143 (dotimes (i (- arg) (point)) 157 (dotimes (i (- arg) (point))
144 (subword-backward-internal))) 158 (funcall subword-backward-function)))
145 (t 159 (t
146 (point)))) 160 (point))))
147 161
@@ -249,9 +263,7 @@ Optional argument ARG is the same as for `capitalize-word'."
249 (if (and 263 (if (and
250 (save-excursion 264 (save-excursion
251 (let ((case-fold-search nil)) 265 (let ((case-fold-search nil))
252 (re-search-forward 266 (re-search-forward subword-forward-regexp nil t)))
253 (concat "\\W*\\(\\([[:upper:]]*\\W?\\)[[:lower:][:digit:]]*\\)")
254 nil t)))
255 (> (match-end 0) (point))) 267 (> (match-end 0) (point)))
256 (goto-char 268 (goto-char
257 (cond 269 (cond
@@ -265,11 +277,7 @@ Optional argument ARG is the same as for `capitalize-word'."
265(defun subword-backward-internal () 277(defun subword-backward-internal ()
266 (if (save-excursion 278 (if (save-excursion
267 (let ((case-fold-search nil)) 279 (let ((case-fold-search nil))
268 (re-search-backward 280 (re-search-backward subword-backward-regexp nil t)))
269 (concat
270 "\\(\\(\\W\\|[[:lower:][:digit:]]\\)\\([[:upper:]]+\\W*\\)"
271 "\\|\\W\\w+\\)")
272 nil t)))
273 (goto-char 281 (goto-char
274 (cond 282 (cond
275 ((and (match-end 3) 283 ((and (match-end 3)
diff --git a/lisp/simple.el b/lisp/simple.el
index 76243a202bc..1080757f7d2 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -3474,16 +3474,36 @@ The argument is used for internal purposes; do not supply one."
3474 3474
3475;; Yanking. 3475;; Yanking.
3476 3476
3477(defcustom yank-handled-properties
3478 '((font-lock-face . yank-handle-font-lock-face-property)
3479 (category . yank-handle-category-property))
3480 "List of special text property handling conditions for yanking.
3481Each element should have the form (PROP . FUN), where PROP is a
3482property symbol and FUN is a function. When the `yank' command
3483inserts text into the buffer, it scans the inserted text for
3484stretches of text that have `eq' values of the text property
3485PROP; for each such stretch of text, FUN is called with three
3486arguments: the property's value in that text, and the start and
3487end positions of the text.
3488
3489This is done prior to removing the properties specified by
3490`yank-excluded-properties'."
3491 :group 'killing
3492 :version "24.3")
3493
3477;; This is actually used in subr.el but defcustom does not work there. 3494;; This is actually used in subr.el but defcustom does not work there.
3478(defcustom yank-excluded-properties 3495(defcustom yank-excluded-properties
3479 '(read-only invisible intangible field mouse-face help-echo local-map keymap 3496 '(category field follow-link fontified font-lock-face help-echo
3480 yank-handler follow-link fontified) 3497 intangible invisible keymap local-map mouse-face read-only
3498 yank-handler)
3481 "Text properties to discard when yanking. 3499 "Text properties to discard when yanking.
3482The value should be a list of text properties to discard or t, 3500The value should be a list of text properties to discard or t,
3483which means to discard all text properties." 3501which means to discard all text properties.
3502
3503See also `yank-handled-properties'."
3484 :type '(choice (const :tag "All" t) (repeat symbol)) 3504 :type '(choice (const :tag "All" t) (repeat symbol))
3485 :group 'killing 3505 :group 'killing
3486 :version "22.1") 3506 :version "24.3")
3487 3507
3488(defvar yank-window-start nil) 3508(defvar yank-window-start nil)
3489(defvar yank-undo-function nil 3509(defvar yank-undo-function nil
@@ -3535,15 +3555,16 @@ doc string for `insert-for-yank-1', which see."
3535 3555
3536(defun yank (&optional arg) 3556(defun yank (&optional arg)
3537 "Reinsert (\"paste\") the last stretch of killed text. 3557 "Reinsert (\"paste\") the last stretch of killed text.
3538More precisely, reinsert the stretch of killed text most recently 3558More precisely, reinsert the most recent kill, which is the
3539killed OR yanked. Put point at end, and set mark at beginning. 3559stretch of killed text most recently killed OR yanked. Put point
3540With just \\[universal-argument] as argument, same but put point at beginning (and mark at end). 3560at the end, and set mark at the beginning without activating it.
3541With argument N, reinsert the Nth most recently killed stretch of killed 3561With just \\[universal-argument] as argument, put point at beginning, and mark at end.
3542text. 3562With argument N, reinsert the Nth most recent kill.
3543 3563
3544When this command inserts killed text into the buffer, it honors 3564When this command inserts text into the buffer, it honors the
3545`yank-excluded-properties' and `yank-handler' as described in the 3565`yank-handled-properties' and `yank-excluded-properties'
3546doc string for `insert-for-yank-1', which see. 3566variables, and the `yank-handler' text property. See
3567`insert-for-yank-1' for details.
3547 3568
3548See also the command `yank-pop' (\\[yank-pop])." 3569See also the command `yank-pop' (\\[yank-pop])."
3549 (interactive "*P") 3570 (interactive "*P")
diff --git a/lisp/subr.el b/lisp/subr.el
index 1e367a155d0..74afd59f8d5 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2805,35 +2805,24 @@ if it's an autoloaded macro."
2805 2805
2806;;;; Support for yanking and text properties. 2806;;;; Support for yanking and text properties.
2807 2807
2808(defvar yank-handled-properties)
2808(defvar yank-excluded-properties) 2809(defvar yank-excluded-properties)
2809 2810
2810(defun remove-yank-excluded-properties (start end) 2811(defun remove-yank-excluded-properties (start end)
2811 "Remove `yank-excluded-properties' between START and END positions. 2812 "Process text properties between START and END, inserted for a `yank'.
2812Replaces `category' properties with their defined properties." 2813Perform the handling specified by `yank-handled-properties', then
2814remove properties specified by `yank-excluded-properties'."
2813 (let ((inhibit-read-only t)) 2815 (let ((inhibit-read-only t))
2814 ;; Replace any `category' property with the properties it stands 2816 (dolist (handler yank-handled-properties)
2815 ;; for. This is to remove `mouse-face' properties that are placed 2817 (let ((prop (car handler))
2816 ;; on categories in *Help* buffers' buttons. See 2818 (fun (cdr handler))
2817 ;; http://lists.gnu.org/archive/html/emacs-devel/2002-04/msg00648.html 2819 (run-start start))
2818 ;; for the details. 2820 (while (< run-start end)
2819 (unless (memq yank-excluded-properties '(t nil)) 2821 (let ((value (get-text-property run-start prop))
2820 (save-excursion 2822 (run-end (next-single-property-change
2821 (goto-char start) 2823 run-start prop nil end)))
2822 (while (< (point) end) 2824 (funcall fun value run-start run-end)
2823 (let ((cat (get-text-property (point) 'category)) 2825 (setq run-start run-end)))))
2824 run-end)
2825 (setq run-end
2826 (next-single-property-change (point) 'category nil end))
2827 (when cat
2828 (let (run-end2 original)
2829 (remove-list-of-text-properties (point) run-end '(category))
2830 (while (< (point) run-end)
2831 (setq run-end2 (next-property-change (point) nil run-end))
2832 (setq original (text-properties-at (point)))
2833 (set-text-properties (point) run-end2 (symbol-plist cat))
2834 (add-text-properties (point) run-end2 original)
2835 (goto-char run-end2))))
2836 (goto-char run-end)))))
2837 (if (eq yank-excluded-properties t) 2826 (if (eq yank-excluded-properties t)
2838 (set-text-properties start end nil) 2827 (set-text-properties start end nil)
2839 (remove-list-of-text-properties start end yank-excluded-properties)))) 2828 (remove-list-of-text-properties start end yank-excluded-properties))))
@@ -2851,29 +2840,31 @@ See `insert-for-yank-1' for more details."
2851 (insert-for-yank-1 string)) 2840 (insert-for-yank-1 string))
2852 2841
2853(defun insert-for-yank-1 (string) 2842(defun insert-for-yank-1 (string)
2854 "Insert STRING at point, stripping some text properties. 2843 "Insert STRING at point for the `yank' command.
2855 2844This function is like `insert', except it honors the variables
2856Strip text properties from the inserted text according to 2845`yank-handled-properties' and `yank-excluded-properties', and the
2857`yank-excluded-properties'. Otherwise just like (insert STRING). 2846`yank-handler' text property.
2858 2847
2859If STRING has a non-nil `yank-handler' property on the first character, 2848Properties listed in `yank-handled-properties' are processed,
2860the normal insert behavior is modified in various ways. The value of 2849then those listed in `yank-excluded-properties' are discarded.
2861the yank-handler property must be a list with one to four elements 2850
2862with the following format: (FUNCTION PARAM NOEXCLUDE UNDO). 2851If STRING has a non-nil `yank-handler' property on its first
2863When FUNCTION is present and non-nil, it is called instead of `insert' 2852character, the normal insert behavior is altered. The value of
2864 to insert the string. FUNCTION takes one argument--the object to insert. 2853the `yank-handler' property must be a list of one to four
2865If PARAM is present and non-nil, it replaces STRING as the object 2854elements, of the form (FUNCTION PARAM NOEXCLUDE UNDO).
2866 passed to FUNCTION (or `insert'); for example, if FUNCTION is 2855FUNCTION, if non-nil, should be a function of one argument, an
2867 `yank-rectangle', PARAM may be a list of strings to insert as a 2856 object to insert; it is called instead of `insert'.
2868 rectangle. 2857PARAM, if present and non-nil, replaces STRING as the argument to
2869If NOEXCLUDE is present and non-nil, the normal removal of the 2858 FUNCTION or `insert'; e.g. if FUNCTION is `yank-rectangle', PARAM
2859 may be a list of strings to insert as a rectangle.
2860If NOEXCLUDE is present and non-nil, the normal removal of
2870 `yank-excluded-properties' is not performed; instead FUNCTION is 2861 `yank-excluded-properties' is not performed; instead FUNCTION is
2871 responsible for removing those properties. This may be necessary 2862 responsible for the removal. This may be necessary if FUNCTION
2872 if FUNCTION adjusts point before or after inserting the object. 2863 adjusts point before or after inserting the object.
2873If UNDO is present and non-nil, it is a function that will be called 2864UNDO, if present and non-nil, should be a function to be called
2874 by `yank-pop' to undo the insertion of the current object. It is 2865 by `yank-pop' to undo the insertion of the current object. It is
2875 called with two arguments, the start and end of the current region. 2866 given two arguments, the start and end of the region. FUNCTION
2876 FUNCTION may set `yank-undo-function' to override the UNDO value." 2867 may set `yank-undo-function' to override UNDO."
2877 (let* ((handler (and (stringp string) 2868 (let* ((handler (and (stringp string)
2878 (get-text-property 0 'yank-handler string))) 2869 (get-text-property 0 'yank-handler string)))
2879 (param (or (nth 1 handler) string)) 2870 (param (or (nth 1 handler) string))
@@ -2882,7 +2873,7 @@ If UNDO is present and non-nil, it is a function that will be called
2882 end) 2873 end)
2883 2874
2884 (setq yank-undo-function t) 2875 (setq yank-undo-function t)
2885 (if (nth 0 handler) ;; FUNCTION 2876 (if (nth 0 handler) ; FUNCTION
2886 (funcall (car handler) param) 2877 (funcall (car handler) param)
2887 (insert param)) 2878 (insert param))
2888 (setq end (point)) 2879 (setq end (point))
@@ -2891,34 +2882,17 @@ If UNDO is present and non-nil, it is a function that will be called
2891 ;; following text property changes. 2882 ;; following text property changes.
2892 (setq inhibit-read-only t) 2883 (setq inhibit-read-only t)
2893 2884
2894 ;; What should we do with `font-lock-face' properties? 2885 (unless (nth 2 handler) ; NOEXCLUDE
2895 (if font-lock-defaults 2886 (remove-yank-excluded-properties opoint end))
2896 ;; No, just wipe them.
2897 (remove-list-of-text-properties opoint end '(font-lock-face))
2898 ;; Convert them to `face'.
2899 (save-excursion
2900 (goto-char opoint)
2901 (while (< (point) end)
2902 (let ((face (get-text-property (point) 'font-lock-face))
2903 run-end)
2904 (setq run-end
2905 (next-single-property-change (point) 'font-lock-face nil end))
2906 (when face
2907 (remove-text-properties (point) run-end '(font-lock-face nil))
2908 (put-text-property (point) run-end 'face face))
2909 (goto-char run-end)))))
2910
2911 (unless (nth 2 handler) ;; NOEXCLUDE
2912 (remove-yank-excluded-properties opoint (point)))
2913 2887
2914 ;; If last inserted char has properties, mark them as rear-nonsticky. 2888 ;; If last inserted char has properties, mark them as rear-nonsticky.
2915 (if (and (> end opoint) 2889 (if (and (> end opoint)
2916 (text-properties-at (1- end))) 2890 (text-properties-at (1- end)))
2917 (put-text-property (1- end) end 'rear-nonsticky t)) 2891 (put-text-property (1- end) end 'rear-nonsticky t))
2918 2892
2919 (if (eq yank-undo-function t) ;; not set by FUNCTION 2893 (if (eq yank-undo-function t) ; not set by FUNCTION
2920 (setq yank-undo-function (nth 3 handler))) ;; UNDO 2894 (setq yank-undo-function (nth 3 handler))) ; UNDO
2921 (if (nth 4 handler) ;; COMMAND 2895 (if (nth 4 handler) ; COMMAND
2922 (setq this-command (nth 4 handler))))) 2896 (setq this-command (nth 4 handler)))))
2923 2897
2924(defun insert-buffer-substring-no-properties (buffer &optional start end) 2898(defun insert-buffer-substring-no-properties (buffer &optional start end)
@@ -2944,6 +2918,27 @@ Strip text properties from the inserted text according to
2944 (insert-buffer-substring buffer start end) 2918 (insert-buffer-substring buffer start end)
2945 (remove-yank-excluded-properties opoint (point)))) 2919 (remove-yank-excluded-properties opoint (point))))
2946 2920
2921(defun yank-handle-font-lock-face-property (face start end)
2922 "If `font-lock-defaults' is nil, apply FACE as a `face' property.
2923START and END denote the start and end of the text to act on.
2924Do nothing if FACE is nil."
2925 (and face
2926 (null font-lock-defaults)
2927 (put-text-property start end 'face face)))
2928
2929;; This removes `mouse-face' properties in *Help* buffer buttons:
2930;; http://lists.gnu.org/archive/html/emacs-devel/2002-04/msg00648.html
2931(defun yank-handle-category-property (category start end)
2932 "Apply property category CATEGORY's properties between START and END."
2933 (when category
2934 (let ((start2 start))
2935 (while (< start2 end)
2936 (let ((end2 (next-property-change start2 nil end))
2937 (original (text-properties-at start2)))
2938 (set-text-properties start2 end2 (symbol-plist category))
2939 (add-text-properties start2 end2 original)
2940 (setq start2 end2))))))
2941
2947 2942
2948;;;; Synchronous shell commands. 2943;;;; Synchronous shell commands.
2949 2944
diff --git a/lisp/window.el b/lisp/window.el
index 5682e7e909a..142e80e1666 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -91,11 +91,13 @@ be any window."
91 (and window (window-parent window) (window-prev-sibling window))) 91 (and window (window-parent window) (window-prev-sibling window)))
92 92
93(defun window-child (window) 93(defun window-child (window)
94 "Return WINDOW's first child window." 94 "Return WINDOW's first child window.
95WINDOW can be any window."
95 (or (window-top-child window) (window-left-child window))) 96 (or (window-top-child window) (window-left-child window)))
96 97
97(defun window-child-count (window) 98(defun window-child-count (window)
98 "Return number of WINDOW's child windows." 99 "Return number of WINDOW's child windows.
100WINDOW can be any window."
99 (let ((count 0)) 101 (let ((count 0))
100 (when (and (windowp window) (setq window (window-child window))) 102 (when (and (windowp window) (setq window (window-child window)))
101 (while window 103 (while window
@@ -104,20 +106,13 @@ be any window."
104 count)) 106 count))
105 107
106(defun window-last-child (window) 108(defun window-last-child (window)
107 "Return last child window of WINDOW." 109 "Return last child window of WINDOW.
110WINDOW can be any window."
108 (when (and (windowp window) (setq window (window-child window))) 111 (when (and (windowp window) (setq window (window-child window)))
109 (while (window-next-sibling window) 112 (while (window-next-sibling window)
110 (setq window (window-next-sibling window)))) 113 (setq window (window-next-sibling window))))
111 window) 114 window)
112 115
113(defun window-valid-p (object)
114 "Return t if OBJECT denotes a live window or internal window.
115Otherwise, return nil; this includes the case where OBJECT is a
116deleted window."
117 (and (windowp object)
118 (or (window-buffer object) (window-child object))
119 t))
120
121(defun window-normalize-buffer (buffer-or-name) 116(defun window-normalize-buffer (buffer-or-name)
122 "Return buffer specified by BUFFER-OR-NAME. 117 "Return buffer specified by BUFFER-OR-NAME.
123BUFFER-OR-NAME must be either a buffer or a string naming a live 118BUFFER-OR-NAME must be either a buffer or a string naming a live
@@ -143,20 +138,22 @@ FRAME must be a live frame and defaults to the selected frame."
143 (selected-frame))) 138 (selected-frame)))
144 139
145(defun window-normalize-window (window &optional live-only) 140(defun window-normalize-window (window &optional live-only)
146 "Return window specified by WINDOW. 141 "Return the window specified by WINDOW.
147If WINDOW is nil, return `selected-window'. 142If WINDOW is nil, return the selected window. Otherwise, if
148If WINDOW is a live window or internal window, return WINDOW; 143WINDOW is a live or an internal window, return WINDOW; if
149 if LIVE-ONLY is non-nil, return WINDOW for a live window only. 144LIVE-ONLY is non-nil, return WINDOW for a live window only.
150Otherwise, signal an error." 145Otherwise, signal an error."
151 (cond ((null window) 146 (cond
152 (selected-window)) 147 ((null window)
153 (live-only 148 (selected-window))
154 (if (window-live-p window) 149 (live-only
155 window 150 (if (window-live-p window)
156 (error "%s is not a live window" window))) 151 window
157 ((if (window-valid-p window) 152 (error "%s is not a live window" window)))
158 window 153 ((window-valid-p window)
159 (error "%s is not a window" window))))) 154 window)
155 (t
156 (error "%s is not a valid window" window))))
160 157
161(defvar ignore-window-parameters nil 158(defvar ignore-window-parameters nil
162 "If non-nil, standard functions ignore window parameters. 159 "If non-nil, standard functions ignore window parameters.
@@ -207,7 +204,7 @@ narrower, explicitly specify the SIZE argument of that function."
207 204
208(defun window-combined-p (&optional window horizontal) 205(defun window-combined-p (&optional window horizontal)
209 "Return non-nil if WINDOW has siblings in a given direction. 206 "Return non-nil if WINDOW has siblings in a given direction.
210If WINDOW is omitted or nil, it defaults to the selected window. 207WINDOW must be a valid window and defaults to the selected one.
211 208
212HORIZONTAL determines a direction for the window combination. 209HORIZONTAL determines a direction for the window combination.
213If HORIZONTAL is omitted or nil, return non-nil if WINDOW is part 210If HORIZONTAL is omitted or nil, return non-nil if WINDOW is part
@@ -223,7 +220,7 @@ horizontal window combination."
223 220
224(defun window-combinations (window &optional horizontal) 221(defun window-combinations (window &optional horizontal)
225 "Return largest number of windows vertically arranged within WINDOW. 222 "Return largest number of windows vertically arranged within WINDOW.
226If WINDOW is omitted or nil, it defaults to the selected window. 223WINDOW must be a valid window and defaults to the selected one.
227If HORIZONTAL is non-nil, return the largest number of 224If HORIZONTAL is non-nil, return the largest number of
228windows horizontally arranged within WINDOW." 225windows horizontally arranged within WINDOW."
229 (setq window (window-normalize-window window)) 226 (setq window (window-normalize-window window))
@@ -321,7 +318,7 @@ too."
321;;; Atomic windows. 318;;; Atomic windows.
322(defun window-atom-root (&optional window) 319(defun window-atom-root (&optional window)
323 "Return root of atomic window WINDOW is a part of. 320 "Return root of atomic window WINDOW is a part of.
324WINDOW can be any window and defaults to the selected one. 321WINDOW must be a valid window and defaults to the selected one.
325Return nil if WINDOW is not part of an atomic window." 322Return nil if WINDOW is not part of an atomic window."
326 (setq window (window-normalize-window window)) 323 (setq window (window-normalize-window window))
327 (let (root) 324 (let (root)
@@ -525,10 +522,10 @@ window).")
525 522
526(defun window-min-size (&optional window horizontal ignore) 523(defun window-min-size (&optional window horizontal ignore)
527 "Return the minimum size of WINDOW. 524 "Return the minimum size of WINDOW.
528WINDOW can be an arbitrary window and defaults to the selected 525WINDOW must be a valid window and defaults to the selected one.
529one. Optional argument HORIZONTAL non-nil means return the 526Optional argument HORIZONTAL non-nil means return the minimum
530minimum number of columns of WINDOW; otherwise return the minimum 527number of columns of WINDOW; otherwise return the minimum number
531number of WINDOW's lines. 528of WINDOW's lines.
532 529
533Optional argument IGNORE, if non-nil, means ignore restrictions 530Optional argument IGNORE, if non-nil, means ignore restrictions
534imposed by fixed size windows, `window-min-height' or 531imposed by fixed size windows, `window-min-height' or
@@ -608,6 +605,7 @@ means ignore all of the above restrictions for all windows."
608 605
609(defun window-sizable (window delta &optional horizontal ignore) 606(defun window-sizable (window delta &optional horizontal ignore)
610 "Return DELTA if DELTA lines can be added to WINDOW. 607 "Return DELTA if DELTA lines can be added to WINDOW.
608WINDOW must be a valid window and defaults to the selected one.
611Optional argument HORIZONTAL non-nil means return DELTA if DELTA 609Optional argument HORIZONTAL non-nil means return DELTA if DELTA
612columns can be added to WINDOW. A return value of zero means 610columns can be added to WINDOW. A return value of zero means
613that no lines (or columns) can be added to WINDOW. 611that no lines (or columns) can be added to WINDOW.
@@ -649,6 +647,7 @@ ignore all of the above restrictions for all windows."
649 647
650(defun window-sizable-p (window delta &optional horizontal ignore) 648(defun window-sizable-p (window delta &optional horizontal ignore)
651 "Return t if WINDOW can be resized by DELTA lines. 649 "Return t if WINDOW can be resized by DELTA lines.
650WINDOW must be a valid window and defaults to the selected one.
652For the meaning of the arguments of this function see the 651For the meaning of the arguments of this function see the
653doc-string of `window-sizable'." 652doc-string of `window-sizable'."
654 (setq window (window-normalize-window window)) 653 (setq window (window-normalize-window window))
@@ -691,9 +690,9 @@ doc-string of `window-sizable'."
691 690
692(defun window-size-fixed-p (&optional window horizontal) 691(defun window-size-fixed-p (&optional window horizontal)
693 "Return non-nil if WINDOW's height is fixed. 692 "Return non-nil if WINDOW's height is fixed.
694WINDOW can be an arbitrary window and defaults to the selected 693WINDOW must be a valid window and defaults to the selected one.
695window. Optional argument HORIZONTAL non-nil means return 694Optional argument HORIZONTAL non-nil means return non-nil if
696non-nil if WINDOW's width is fixed. 695WINDOW's width is fixed.
697 696
698If this function returns nil, this does not necessarily mean that 697If this function returns nil, this does not necessarily mean that
699WINDOW can be resized in the desired direction. The function 698WINDOW can be resized in the desired direction. The function
@@ -741,8 +740,8 @@ WINDOW can be resized in the desired direction. The function
741 740
742(defun window-min-delta (&optional window horizontal ignore trail noup nodown) 741(defun window-min-delta (&optional window horizontal ignore trail noup nodown)
743 "Return number of lines by which WINDOW can be shrunk. 742 "Return number of lines by which WINDOW can be shrunk.
744WINDOW can be an arbitrary window and defaults to the selected 743WINDOW must be a valid window and defaults to the selected one.
745window. Return zero if WINDOW cannot be shrunk. 744Return zero if WINDOW cannot be shrunk.
746 745
747Optional argument HORIZONTAL non-nil means return number of 746Optional argument HORIZONTAL non-nil means return number of
748columns by which WINDOW can be shrunk. 747columns by which WINDOW can be shrunk.
@@ -823,8 +822,8 @@ at least one other window can be enlarged appropriately."
823 822
824(defun window-max-delta (&optional window horizontal ignore trail noup nodown) 823(defun window-max-delta (&optional window horizontal ignore trail noup nodown)
825 "Return maximum number of lines by which WINDOW can be enlarged. 824 "Return maximum number of lines by which WINDOW can be enlarged.
826WINDOW can be an arbitrary window and defaults to the selected 825WINDOW must be a valid window and defaults to the selected one.
827window. The return value is zero if WINDOW cannot be enlarged. 826The return value is zero if WINDOW cannot be enlarged.
828 827
829Optional argument HORIZONTAL non-nil means return maximum number 828Optional argument HORIZONTAL non-nil means return maximum number
830of columns by which WINDOW can be enlarged. 829of columns by which WINDOW can be enlarged.
@@ -861,6 +860,7 @@ only whether other windows can be shrunk appropriately."
861;; Make NOUP also inhibit the min-size check. 860;; Make NOUP also inhibit the min-size check.
862(defun window--resizable (window delta &optional horizontal ignore trail noup nodown) 861(defun window--resizable (window delta &optional horizontal ignore trail noup nodown)
863 "Return DELTA if WINDOW can be resized vertically by DELTA lines. 862 "Return DELTA if WINDOW can be resized vertically by DELTA lines.
863WINDOW must be a valid window and defaults to the selected one.
864Optional argument HORIZONTAL non-nil means return DELTA if WINDOW 864Optional argument HORIZONTAL non-nil means return DELTA if WINDOW
865can be resized horizontally by DELTA columns. A return value of 865can be resized horizontally by DELTA columns. A return value of
866zero means that WINDOW is not resizable. 866zero means that WINDOW is not resizable.
@@ -907,6 +907,7 @@ violate size restrictions of WINDOW or its child windows."
907 907
908(defun window--resizable-p (window delta &optional horizontal ignore trail noup nodown) 908(defun window--resizable-p (window delta &optional horizontal ignore trail noup nodown)
909 "Return t if WINDOW can be resized vertically by DELTA lines. 909 "Return t if WINDOW can be resized vertically by DELTA lines.
910WINDOW must be a valid window and defaults to the selected one.
910For the meaning of the arguments of this function see the 911For the meaning of the arguments of this function see the
911doc-string of `window--resizable'." 912doc-string of `window--resizable'."
912 (setq window (window-normalize-window window)) 913 (setq window (window-normalize-window window))
@@ -918,6 +919,7 @@ doc-string of `window--resizable'."
918 919
919(defun window-resizable (window delta &optional horizontal ignore) 920(defun window-resizable (window delta &optional horizontal ignore)
920 "Return DELTA if WINDOW can be resized vertically by DELTA lines. 921 "Return DELTA if WINDOW can be resized vertically by DELTA lines.
922WINDOW must be a valid window and defaults to the selected one.
921Optional argument HORIZONTAL non-nil means return DELTA if WINDOW 923Optional argument HORIZONTAL non-nil means return DELTA if WINDOW
922can be resized horizontally by DELTA columns. A return value of 924can be resized horizontally by DELTA columns. A return value of
923zero means that WINDOW is not resizable. 925zero means that WINDOW is not resizable.
@@ -944,7 +946,7 @@ means ignore all of the above restrictions for all windows."
944 946
945(defun window-total-size (&optional window horizontal) 947(defun window-total-size (&optional window horizontal)
946 "Return the total height or width of WINDOW. 948 "Return the total height or width of WINDOW.
947If WINDOW is omitted or nil, it defaults to the selected window. 949WINDOW must be a valid window and defaults to the selected one.
948 950
949If HORIZONTAL is omitted or nil, return the total height of 951If HORIZONTAL is omitted or nil, return the total height of
950WINDOW, in lines, like `window-total-height'. Otherwise return 952WINDOW, in lines, like `window-total-height'. Otherwise return
@@ -961,8 +963,8 @@ the total width, in columns, like `window-total-width'."
961 "Return t if WINDOW is as high as its containing frame. 963 "Return t if WINDOW is as high as its containing frame.
962More precisely, return t if and only if the total height of 964More precisely, return t if and only if the total height of
963WINDOW equals the total height of the root window of WINDOW's 965WINDOW equals the total height of the root window of WINDOW's
964frame. WINDOW can be any window and defaults to the selected 966frame. WINDOW must be a valid window and defaults to the
965one." 967selected one."
966 (setq window (window-normalize-window window)) 968 (setq window (window-normalize-window window))
967 (= (window-total-size window) 969 (= (window-total-size window)
968 (window-total-size (frame-root-window window)))) 970 (window-total-size (frame-root-window window))))
@@ -971,15 +973,14 @@ one."
971 "Return t if WINDOW is as wide as its containing frame. 973 "Return t if WINDOW is as wide as its containing frame.
972More precisely, return t if and only if the total width of WINDOW 974More precisely, return t if and only if the total width of WINDOW
973equals the total width of the root window of WINDOW's frame. 975equals the total width of the root window of WINDOW's frame.
974WINDOW can be any window and defaults to the selected one." 976WINDOW must be a valid window and defaults to the selected one."
975 (setq window (window-normalize-window window)) 977 (setq window (window-normalize-window window))
976 (= (window-total-size window t) 978 (= (window-total-size window t)
977 (window-total-size (frame-root-window window) t))) 979 (window-total-size (frame-root-window window) t)))
978 980
979(defun window-body-size (&optional window horizontal) 981(defun window-body-size (&optional window horizontal)
980 "Return the height or width of WINDOW's text area. 982 "Return the height or width of WINDOW's text area.
981If WINDOW is omitted or nil, it defaults to the selected window. 983WINDOW must be a live window and defaults to the selected one.
982Signal an error if the window is not live.
983 984
984If HORIZONTAL is omitted or nil, return the height of the text 985If HORIZONTAL is omitted or nil, return the height of the text
985area, like `window-body-height'. Otherwise, return the width of 986area, like `window-body-height'. Otherwise, return the width of
@@ -1089,9 +1090,9 @@ regardless of whether that buffer is current or not."
1089 1090
1090(defun window-at-side-p (&optional window side) 1091(defun window-at-side-p (&optional window side)
1091 "Return t if WINDOW is at SIDE of its containing frame. 1092 "Return t if WINDOW is at SIDE of its containing frame.
1092WINDOW can be any window and defaults to the selected one. SIDE 1093WINDOW must be a valid window and defaults to the selected one.
1093can be any of the symbols `left', `top', `right' or `bottom'. 1094SIDE can be any of the symbols `left', `top', `right' or
1094The default value nil is handled like `bottom'." 1095`bottom'. The default value nil is handled like `bottom'."
1095 (setq window (window-normalize-window window)) 1096 (setq window (window-normalize-window window))
1096 (let ((edge 1097 (let ((edge
1097 (cond 1098 (cond
@@ -2027,7 +2028,8 @@ any windows."
2027(defun adjust-window-trailing-edge (window delta &optional horizontal) 2028(defun adjust-window-trailing-edge (window delta &optional horizontal)
2028 "Move WINDOW's bottom edge by DELTA lines. 2029 "Move WINDOW's bottom edge by DELTA lines.
2029Optional argument HORIZONTAL non-nil means move WINDOW's right 2030Optional argument HORIZONTAL non-nil means move WINDOW's right
2030edge by DELTA columns. WINDOW defaults to the selected window. 2031edge by DELTA columns. WINDOW must be a valid window and
2032defaults to the selected one.
2031 2033
2032If DELTA is greater than zero, move the edge downwards or to the 2034If DELTA is greater than zero, move the edge downwards or to the
2033right. If DELTA is less than zero, move the edge upwards or to 2035right. If DELTA is less than zero, move the edge upwards or to
@@ -2211,7 +2213,7 @@ Return nil."
2211(defun maximize-window (&optional window) 2213(defun maximize-window (&optional window)
2212 "Maximize WINDOW. 2214 "Maximize WINDOW.
2213Make WINDOW as large as possible without deleting any windows. 2215Make WINDOW as large as possible without deleting any windows.
2214WINDOW can be any window and defaults to the selected window." 2216WINDOW must be a valid window and defaults to the selected one."
2215 (interactive) 2217 (interactive)
2216 (setq window (window-normalize-window window)) 2218 (setq window (window-normalize-window window))
2217 (window-resize window (window-max-delta window)) 2219 (window-resize window (window-max-delta window))
@@ -2220,7 +2222,7 @@ WINDOW can be any window and defaults to the selected window."
2220(defun minimize-window (&optional window) 2222(defun minimize-window (&optional window)
2221 "Minimize WINDOW. 2223 "Minimize WINDOW.
2222Make WINDOW as small as possible without deleting any windows. 2224Make WINDOW as small as possible without deleting any windows.
2223WINDOW can be any window and defaults to the selected window." 2225WINDOW must be a valid window and defaults to the selected one."
2224 (interactive) 2226 (interactive)
2225 (setq window (window-normalize-window window)) 2227 (setq window (window-normalize-window window))
2226 (window-resize window (- (window-min-delta window))) 2228 (window-resize window (- (window-min-delta window)))
@@ -2376,8 +2378,8 @@ and no others."
2376;;; Deleting windows. 2378;;; Deleting windows.
2377(defun window-deletable-p (&optional window) 2379(defun window-deletable-p (&optional window)
2378 "Return t if WINDOW can be safely deleted from its frame. 2380 "Return t if WINDOW can be safely deleted from its frame.
2379Return `frame' if deleting WINDOW should also delete its 2381WINDOW must be a valid window and defaults to the selected one.
2380frame." 2382Return `frame' if deleting WINDOW should also delete its frame."
2381 (setq window (window-normalize-window window)) 2383 (setq window (window-normalize-window window))
2382 2384
2383 (unless ignore-window-parameters 2385 (unless ignore-window-parameters
@@ -2415,8 +2417,8 @@ frame."
2415 2417
2416(defun delete-window (&optional window) 2418(defun delete-window (&optional window)
2417 "Delete WINDOW. 2419 "Delete WINDOW.
2418WINDOW can be an arbitrary window and defaults to the selected 2420WINDOW must be a valid window and defaults to the selected one.
2419one. Return nil. 2421Return nil.
2420 2422
2421If the variable `ignore-window-parameters' is non-nil or the 2423If the variable `ignore-window-parameters' is non-nil or the
2422`delete-window' parameter of WINDOW equals t, do not process any 2424`delete-window' parameter of WINDOW equals t, do not process any
@@ -2427,8 +2429,9 @@ function.
2427 2429
2428Otherwise, if WINDOW is part of an atomic window, call 2430Otherwise, if WINDOW is part of an atomic window, call
2429`delete-window' with the root of the atomic window as its 2431`delete-window' with the root of the atomic window as its
2430argument. If WINDOW is the only window on its frame or the last 2432argument. Signal an error if WINDOW is either the only window on
2431non-side window, signal an error." 2433its frame, the last non-side window, or part of an atomic window
2434that is its frame's root window."
2432 (interactive) 2435 (interactive)
2433 (setq window (window-normalize-window window)) 2436 (setq window (window-normalize-window window))
2434 (let* ((frame (window-frame window)) 2437 (let* ((frame (window-frame window))
@@ -2495,7 +2498,7 @@ non-side window, signal an error."
2495 2498
2496(defun delete-other-windows (&optional window) 2499(defun delete-other-windows (&optional window)
2497 "Make WINDOW fill its frame. 2500 "Make WINDOW fill its frame.
2498WINDOW may be any window and defaults to the selected one. 2501WINDOW must be a valid window and defaults to the selected one.
2499Return nil. 2502Return nil.
2500 2503
2501If the variable `ignore-window-parameters' is non-nil or the 2504If the variable `ignore-window-parameters' is non-nil or the
@@ -2638,11 +2641,13 @@ WINDOW."
2638 2641
2639(defun set-window-buffer-start-and-point (window buffer &optional start point) 2642(defun set-window-buffer-start-and-point (window buffer &optional start point)
2640 "Set WINDOW's buffer to BUFFER. 2643 "Set WINDOW's buffer to BUFFER.
2644WINDOW must be a live window and defaults to the selected one.
2641Optional argument START non-nil means set WINDOW's start position 2645Optional argument START non-nil means set WINDOW's start position
2642to START. Optional argument POINT non-nil means set WINDOW's 2646to START. Optional argument POINT non-nil means set WINDOW's
2643point to POINT. If WINDOW is selected this also sets BUFFER's 2647point to POINT. If WINDOW is selected this also sets BUFFER's
2644`point' to POINT. If WINDOW is selected and the buffer it showed 2648`point' to POINT. If WINDOW is selected and the buffer it showed
2645before was current this also makes BUFFER the current buffer." 2649before was current this also makes BUFFER the current buffer."
2650 (setq window (window-normalize-window window t))
2646 (let ((selected (eq window (selected-window))) 2651 (let ((selected (eq window (selected-window)))
2647 (current (eq (window-buffer window) (current-buffer)))) 2652 (current (eq (window-buffer window) (current-buffer))))
2648 (set-window-buffer window buffer) 2653 (set-window-buffer window buffer)
@@ -2956,16 +2961,24 @@ displayed there."
2956(defun next-buffer () 2961(defun next-buffer ()
2957 "In selected window switch to next buffer." 2962 "In selected window switch to next buffer."
2958 (interactive) 2963 (interactive)
2959 (if (window-minibuffer-p) 2964 (cond
2960 (error "Cannot switch buffers in minibuffer window")) 2965 ((window-minibuffer-p)
2961 (switch-to-next-buffer)) 2966 (error "Cannot switch buffers in minibuffer window"))
2967 ((eq (window-dedicated-p) t)
2968 (error "Window is strongly dedicated to its buffer"))
2969 (t
2970 (switch-to-next-buffer))))
2962 2971
2963(defun previous-buffer () 2972(defun previous-buffer ()
2964 "In selected window switch to previous buffer." 2973 "In selected window switch to previous buffer."
2965 (interactive) 2974 (interactive)
2966 (if (window-minibuffer-p) 2975 (cond
2967 (error "Cannot switch buffers in minibuffer window")) 2976 ((window-minibuffer-p)
2968 (switch-to-prev-buffer)) 2977 (error "Cannot switch buffers in minibuffer window"))
2978 ((eq (window-dedicated-p) t)
2979 (error "Window is strongly dedicated to its buffer"))
2980 (t
2981 (switch-to-prev-buffer))))
2969 2982
2970(defun delete-windows-on (&optional buffer-or-name frame) 2983(defun delete-windows-on (&optional buffer-or-name frame)
2971 "Delete all windows showing BUFFER-OR-NAME. 2984 "Delete all windows showing BUFFER-OR-NAME.
@@ -3138,7 +3151,7 @@ Optional argument HORIZONTAL non-nil means return minimum width."
3138 3151
3139(defun split-window (&optional window size side) 3152(defun split-window (&optional window size side)
3140 "Make a new window adjacent to WINDOW. 3153 "Make a new window adjacent to WINDOW.
3141WINDOW can be any window and defaults to the selected one. 3154WINDOW must be a valid window and defaults to the selected one.
3142Return the new window which is always a live window. 3155Return the new window which is always a live window.
3143 3156
3144Optional argument SIZE a positive number means make WINDOW SIZE 3157Optional argument SIZE a positive number means make WINDOW SIZE
@@ -3459,7 +3472,7 @@ right, if any."
3459(defun balance-windows-2 (window horizontal) 3472(defun balance-windows-2 (window horizontal)
3460 "Subroutine of `balance-windows-1'. 3473 "Subroutine of `balance-windows-1'.
3461WINDOW must be a vertical combination (horizontal if HORIZONTAL 3474WINDOW must be a vertical combination (horizontal if HORIZONTAL
3462is non-nil." 3475is non-nil)."
3463 (let* ((first (window-child window)) 3476 (let* ((first (window-child window))
3464 (sub first) 3477 (sub first)
3465 (number-of-children 0) 3478 (number-of-children 0)
@@ -5187,9 +5200,9 @@ documentation for additional customization information."
5187 5200
5188(defun set-window-text-height (window height) 5201(defun set-window-text-height (window height)
5189 "Set the height in lines of the text display area of WINDOW to HEIGHT. 5202 "Set the height in lines of the text display area of WINDOW to HEIGHT.
5190WINDOW must be a live window. HEIGHT doesn't include the mode 5203WINDOW must be a live window and defaults to the selected one.
5191line or header line, if any, or any partial-height lines in the 5204HEIGHT doesn't include the mode line or header line, if any, or
5192text display area. 5205any partial-height lines in the text display area.
5193 5206
5194Note that the current implementation of this function cannot 5207Note that the current implementation of this function cannot
5195always set the height exactly, but attempts to be conservative, 5208always set the height exactly, but attempts to be conservative,
@@ -5256,7 +5269,9 @@ in some window."
5256 (1+ (vertical-motion (buffer-size) window)))))) 5269 (1+ (vertical-motion (buffer-size) window))))))
5257 5270
5258(defun window-buffer-height (window) 5271(defun window-buffer-height (window)
5259 "Return the height (in screen lines) of the buffer that WINDOW is displaying." 5272 "Return the height (in screen lines) of the buffer that WINDOW is displaying.
5273WINDOW must be a live window and defaults to the selected one."
5274 (setq window (window-normalize-window window t))
5260 (with-current-buffer (window-buffer window) 5275 (with-current-buffer (window-buffer window)
5261 (max 1 5276 (max 1
5262 (count-screen-lines (point-min) (point-max) 5277 (count-screen-lines (point-min) (point-max)
@@ -5268,7 +5283,7 @@ in some window."
5268;;; Resizing buffers to fit their contents exactly. 5283;;; Resizing buffers to fit their contents exactly.
5269(defun fit-window-to-buffer (&optional window max-height min-height override) 5284(defun fit-window-to-buffer (&optional window max-height min-height override)
5270 "Adjust height of WINDOW to display its buffer's contents exactly. 5285 "Adjust height of WINDOW to display its buffer's contents exactly.
5271WINDOW can be any live window and defaults to the selected one. 5286WINDOW must be a live window and defaults to the selected one.
5272 5287
5273Optional argument MAX-HEIGHT specifies the maximum height of 5288Optional argument MAX-HEIGHT specifies the maximum height of
5274WINDOW and defaults to the height of WINDOW's frame. Optional 5289WINDOW and defaults to the height of WINDOW's frame. Optional
@@ -5387,7 +5402,7 @@ WINDOW defaults to the selected window."
5387 "Shrink height of WINDOW if its buffer doesn't need so many lines. 5402 "Shrink height of WINDOW if its buffer doesn't need so many lines.
5388More precisely, shrink WINDOW vertically to be as small as 5403More precisely, shrink WINDOW vertically to be as small as
5389possible, while still showing the full contents of its buffer. 5404possible, while still showing the full contents of its buffer.
5390WINDOW defaults to the selected window. 5405WINDOW must be a live window and defaults to the selected one.
5391 5406
5392Do not shrink WINDOW to less than `window-min-height' lines. Do 5407Do not shrink WINDOW to less than `window-min-height' lines. Do
5393nothing if the buffer contains more lines than the present window 5408nothing if the buffer contains more lines than the present window
@@ -5809,13 +5824,12 @@ is active. This function is run by `mouse-autoselect-window-timer'."
5809 5824
5810(defun truncated-partial-width-window-p (&optional window) 5825(defun truncated-partial-width-window-p (&optional window)
5811 "Return non-nil if lines in WINDOW are specifically truncated due to its width. 5826 "Return non-nil if lines in WINDOW are specifically truncated due to its width.
5812WINDOW defaults to the selected window. 5827WINDOW must be a live window and defaults to the selected one.
5813Return nil if WINDOW is not a partial-width window 5828Return nil if WINDOW is not a partial-width window
5814 (regardless of the value of `truncate-lines'). 5829 (regardless of the value of `truncate-lines').
5815Otherwise, consult the value of `truncate-partial-width-windows' 5830Otherwise, consult the value of `truncate-partial-width-windows'
5816 for the buffer shown in WINDOW." 5831 for the buffer shown in WINDOW."
5817 (unless window 5832 (setq window (window-normalize-window window t))
5818 (setq window (selected-window)))
5819 (unless (window-full-width-p window) 5833 (unless (window-full-width-p window)
5820 (let ((t-p-w-w (buffer-local-value 'truncate-partial-width-windows 5834 (let ((t-p-w-w (buffer-local-value 'truncate-partial-width-windows
5821 (window-buffer window)))) 5835 (window-buffer window))))