aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorJoakim Verona2012-01-23 15:10:06 +0100
committerJoakim Verona2012-01-23 15:10:06 +0100
commit0322b140eead7c94de7f0f6d19a90bd15690b4eb (patch)
tree950c011783cc896d0450084cb5155e54548bfe5b /lisp
parentd5114bfea3ea4c37c57e2af0f3b095be9fcd8bac (diff)
parentcb5850f27c1b4d26957d58e2da2314dd12498671 (diff)
downloademacs-0322b140eead7c94de7f0f6d19a90bd15690b4eb.tar.gz
emacs-0322b140eead7c94de7f0f6d19a90bd15690b4eb.zip
upstream
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog144
-rw-r--r--lisp/calc/calc-units.el19
-rw-r--r--lisp/cedet/semantic/wisent/js-wy.el2
-rw-r--r--lisp/cedet/semantic/wisent/python-wy.el3
-rw-r--r--lisp/color.el5
-rw-r--r--lisp/dired.el46
-rw-r--r--lisp/eshell/em-unix.el2
-rw-r--r--lisp/eshell/esh-util.el2
-rw-r--r--lisp/files.el309
-rw-r--r--lisp/gnus/ChangeLog4
-rw-r--r--lisp/gnus/mm-decode.el2
-rw-r--r--lisp/help-macro.el9
-rw-r--r--lisp/international/mule-cmds.el5
-rw-r--r--lisp/international/mule.el3
-rw-r--r--lisp/isearch.el2
-rw-r--r--lisp/jka-cmpr-hook.el12
-rw-r--r--lisp/jka-compr.el9
-rw-r--r--lisp/net/tramp-cache.el11
-rw-r--r--lisp/net/tramp-sh.el24
-rw-r--r--lisp/net/tramp.el28
-rw-r--r--lisp/progmodes/cc-cmds.el7
-rw-r--r--lisp/progmodes/cc-engine.el143
-rw-r--r--lisp/progmodes/cc-fonts.el48
-rw-r--r--lisp/progmodes/cc-mode.el4
-rw-r--r--lisp/subr.el22
-rw-r--r--lisp/vc/pcvs.el16
-rw-r--r--lisp/vc/vc-dav.el5
-rw-r--r--lisp/windmove.el18
-rw-r--r--lisp/window.el78
29 files changed, 714 insertions, 268 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2813d80d9ff..97281db4c7c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,136 @@
12012-01-23 Mike Lamb <mrlamb@gmail.com> (tiny change)
2
3 * eshell/esh-util.el (eshell-read-hosts-file):
4 Skip comment lines. (Bug#10549)
5
6 * eshell/em-unix.el (pcomplete/ssh): Remove. (Bug#10548)
7
82012-01-23 Juanma Barranquero <lekktu@gmail.com>
9
10 * subr.el (display-delayed-warnings): Doc fix.
11 (collapse-delayed-warnings): New function to collapse identical
12 adjacent warnings.
13 (delayed-warnings-hook): Add it.
14
152012-01-22 Michael Albinus <michael.albinus@gmx.de>
16
17 * net/tramp.el (tramp-action-login): Set connection property "login-as".
18
19 * net/tramp-cache.el (tramp-dump-connection-properties): Do not dump
20 properties, when "login-as" is set.
21
22 * net/tramp-sh.el (tramp-methods): Add user spec to "pscp" and "psftp".
23 (tramp-default-user-alist): Don't add "pscp".
24 (tramp-do-copy-or-rename-file-out-of-band): Use connection
25 property "login-as", if set. (Bug#10530)
26
272012-01-21 Michael Albinus <michael.albinus@gmx.de>
28
29 * net/tramp-sh.el (tramp-default-user-alist): Don't add "plink",
30 "plink1" and "psftp". (Bug#10530)
31
322012-01-21 Kenichi Handa <handa@m17n.org>
33
34 * international/mule-cmds.el (prefer-coding-system): Show a
35 warning message if the default value of file-name-coding-system
36 was not changed.
37
382012-01-21 Jérémy Compostella <jeremy.compostella@gmail.com>
39
40 * windmove.el (windmove-reference-loc): Fix
41 windmove-reference-loc miscalculation.
42
432012-01-21 Jay Belanger <jay.p.belanger@gmail.com>
44
45 * calc/calc-units.el (math-put-default-units): Don't use "1" as a
46 default unit.
47
482012-01-21 Glenn Morris <rgm@gnu.org>
49
50 * international/mule.el (auto-coding-alist): Add .tbz.
51
52 * files.el (local-enable-local-variables): Doc fix.
53 (inhibit-local-variables-regexps): Rename from
54 inhibit-first-line-modes-regexps. Keep old name as obsolete alias.
55 Doc fix. Add some extensions from auto-coding-alist.
56 (inhibit-local-variables-suffixes):
57 Rename from inhibit-first-line-modes-suffixes. Doc fix.
58 (inhibit-local-variables-p):
59 New function, extracted from set-auto-mode-1.
60 (set-auto-mode): Doc fix. Respect inhibit-local-variables-regexps.
61 (set-auto-mode-1): Doc fix. Use inhibit-local-variables-p.
62 (hack-local-variables): Doc fix. Make the mode-only case
63 respect enable-local-variables and friends.
64 Respect inhibit-local-variables-regexps for file-locals, but
65 not for directory-locals.
66 (set-visited-file-name):
67 Take account of inhibit-local-variables-regexps.
68 Whether it applies may change as the file name is changed.
69 * jka-cmpr-hook.el (jka-compr-install):
70 * jka-compr.el (jka-compr-uninstall):
71 Update for inhibit-first-line-modes-suffixes name change.
72
732012-01-20 Martin Rudalics <rudalics@gmx.at>
74
75 * help-macro.el (make-help-screen): Temporarily restore original
76 binding for minor-mode-map-alist (Bug#10454).
77
782012-01-19 Julien Danjou <julien@danjou.info>
79
80 * color.el (color-name-to-rgb): Use the white color to find the max
81 color component value and return correctly computed values.
82 (color-name-to-rgb): Add missing float conversion for max value.
83
842012-01-19 Martin Rudalics <rudalics@gmx.at>
85
86 * window.el (window--state-get-1, window-state-get): Do not use
87 special state value for window-persistent-parameters. Rename
88 argument IGNORE to WRITABLE. Rewrite doc-string.
89 (window--state-put-2): Reset all window parameters to nil before
90 assigning values of persistent parameters.
91
922012-01-18 Alan Mackenzie <acm@muc.de>
93
94 Eliminate sluggishness and hangs in fontification of "semicolon
95 deserts".
96
97 * progmodes/cc-engine.el (c-state-nonlit-pos-interval): change
98 value 10000 -> 3000.
99 (c-state-safe-place): Reformulate so it doesn't stack up an
100 infinite number of wrong entries in c-state-nonlit-pos-cache.
101 (c-determine-limit-get-base, c-determine-limit): New functions to
102 determine backward search limits disregarding literals.
103 (c-find-decl-spots): Amend commenting.
104 (c-cheap-inside-bracelist-p): New function which detects "={".
105
106 * progmodes/cc-fonts.el
107 (c-make-font-lock-BO-decl-search-function): Give a limit to a
108 backward search.
109 (c-font-lock-declarations): Fix an occurrence of point being
110 undefined. Check additionally for point being in a bracelist or
111 near a macro invocation without a semicolon so as to avoid a
112 fruitless time consuming search for a declarator. Give a more
113 precise search limit for declarators using the new
114 c-determine-limit.
115
1162012-01-18 Glenn Morris <rgm@gnu.org>
117
118 * files.el (auto-mode-alist, inhibit-first-line-modes-regexps)
119 (set-auto-mode): Doc fixes.
120
1212012-01-17 Glenn Morris <rgm@gnu.org>
122
123 * isearch.el (search-nonincremental-instead): Fix doc typo.
124
125 * dired.el (dired-insert-directory): Handle newlines in directory name.
126 (dired-build-subdir-alist): Unescape newlines in directory name.
127
1282012-01-17 Michael Albinus <michael.albinus@gmx.de>
129
130 * net/tramp.el (tramp-local-end-of-line): New defcustom.
131 (tramp-action-login, tramp-action-yesno, tramp-action-yn)
132 (tramp-action-terminal): Use it. (Bug#10530)
133
12012-01-16 Stefan Monnier <monnier@iro.umontreal.ca> 1342012-01-16 Stefan Monnier <monnier@iro.umontreal.ca>
2 135
3 * minibuffer.el (completion--replace): Strip properties (bug#10062). 136 * minibuffer.el (completion--replace): Strip properties (bug#10062).
@@ -34,6 +167,17 @@
34 167
35 * dired.el (dired-get-filename): Fix 'verbatim case of previous change. 168 * dired.el (dired-get-filename): Fix 'verbatim case of previous change.
36 169
1702012-01-13 Alan Mackenzie <acm@muc.de>
171
172 Fix filling for when filladapt mode is enabled.
173
174 * progmodes/cc-cmds.el (c-fill-paragraph): In the invocation of
175 c-mask-paragraph, pass in `fill-paragraph' rather than
176 `fill-region-as-paragraph'. (This is a reversion of a previous
177 change.)
178 * progmodes/cc-mode.el (c-basic-common-init): Make
179 fill-paragraph-handle-comment buffer local and set it to nil.
180
372012-01-13 Glenn Morris <rgm@gnu.org> 1812012-01-13 Glenn Morris <rgm@gnu.org>
38 182
39 * dired.el (dired-switches-escape-p): New function. 183 * dired.el (dired-switches-escape-p): New function.
diff --git a/lisp/calc/calc-units.el b/lisp/calc/calc-units.el
index 8f4c79e3f0a..dcbf845c371 100644
--- a/lisp/calc/calc-units.el
+++ b/lisp/calc/calc-units.el
@@ -415,18 +415,19 @@ If EXPR is nil, return nil."
415 415
416(defun math-put-default-units (expr) 416(defun math-put-default-units (expr)
417 "Put the units in EXPR in the default units table." 417 "Put the units in EXPR in the default units table."
418 (let* ((units (math-get-units expr)) 418 (let ((units (math-get-units expr)))
419 (standard-units (math-get-standard-units expr)) 419 (unless (eq units 1)
420 (let* ((standard-units (math-get-standard-units expr))
420 (default-units (gethash 421 (default-units (gethash
421 standard-units 422 standard-units
422 math-default-units-table))) 423 math-default-units-table)))
423 (cond 424 (cond
424 ((not default-units) 425 ((not default-units)
425 (puthash standard-units (list units) math-default-units-table)) 426 (puthash standard-units (list units) math-default-units-table))
426 ((not (equal units (car default-units))) 427 ((not (equal units (car default-units)))
427 (puthash standard-units 428 (puthash standard-units
428 (list units (car default-units)) 429 (list units (car default-units))
429 math-default-units-table))))) 430 math-default-units-table)))))))
430 431
431 432
432(defun calc-convert-units (&optional old-units new-units) 433(defun calc-convert-units (&optional old-units new-units)
diff --git a/lisp/cedet/semantic/wisent/js-wy.el b/lisp/cedet/semantic/wisent/js-wy.el
index b8d3240aef1..05346b02c8d 100644
--- a/lisp/cedet/semantic/wisent/js-wy.el
+++ b/lisp/cedet/semantic/wisent/js-wy.el
@@ -1,7 +1,7 @@
1;;; semantic/wisent/js-wy.el --- Generated parser support file 1;;; semantic/wisent/js-wy.el --- Generated parser support file
2 2
3;; Copyright (C) 2005, 2009-2012 Free Software Foundation, Inc. 3;; Copyright (C) 2005, 2009-2012 Free Software Foundation, Inc.
4;; Copyright (C) 1998-2011 Ecma International 4;; Copyright (C) 1998-2011 Ecma International.
5 5
6;; This file is part of GNU Emacs. 6;; This file is part of GNU Emacs.
7 7
diff --git a/lisp/cedet/semantic/wisent/python-wy.el b/lisp/cedet/semantic/wisent/python-wy.el
index cb0f37c8f16..e8229dcd9ea 100644
--- a/lisp/cedet/semantic/wisent/python-wy.el
+++ b/lisp/cedet/semantic/wisent/python-wy.el
@@ -1,7 +1,8 @@
1;;; semantic/wisent/python-wy.el --- Generated parser support file 1;;; semantic/wisent/python-wy.el --- Generated parser support file
2 2
3;; Copyright (C) 2002-2004, 2007, 2010-2012 Free Software Foundation, Inc. 3;; Copyright (C) 2002-2004, 2007, 2010-2012 Free Software Foundation, Inc.
4;; Copyright (C) 2001-2010 Python Software Foundation 4;; Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
5;; 2009, 2010 Python Software Foundation; All Rights Reserved
5 6
6;; This file is part of GNU Emacs. 7;; This file is part of GNU Emacs.
7 8
diff --git a/lisp/color.el b/lisp/color.el
index ff7f0eee4e6..6fab613ba69 100644
--- a/lisp/color.el
+++ b/lisp/color.el
@@ -53,7 +53,10 @@ numbers, (RED GREEN BLUE), each between 0.0 and 1.0 inclusive.
53Optional arg FRAME specifies the frame where the color is to be 53Optional arg FRAME specifies the frame where the color is to be
54displayed. If FRAME is omitted or nil, use the selected frame. 54displayed. If FRAME is omitted or nil, use the selected frame.
55If FRAME cannot display COLOR, return nil." 55If FRAME cannot display COLOR, return nil."
56 (mapcar (lambda (x) (/ x 65535.0)) (color-values color frame))) 56 ;; `colors-values' maximum value is either 65535 or 65280 depending on the
57 ;; display system. So we use a white conversion to get the max value.
58 (let ((valmax (float (car (color-values "#ffffff")))))
59 (mapcar (lambda (x) (/ x valmax)) (color-values color frame))))
57 60
58(defun color-rgb-to-hex (red green blue) 61(defun color-rgb-to-hex (red green blue)
59 "Return hexadecimal notation for the color RED GREEN BLUE. 62 "Return hexadecimal notation for the color RED GREEN BLUE.
diff --git a/lisp/dired.el b/lisp/dired.el
index f1a778ad05a..57f67ca7c8c 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1172,7 +1172,22 @@ see `dired-use-ls-dired' for more details.")
1172 "\\015" 1172 "\\015"
1173 (text-properties-at (match-beginning 0))) 1173 (text-properties-at (match-beginning 0)))
1174 nil t)) 1174 nil t))
1175 (set-marker end nil))) 1175 (set-marker end nil))
1176 ;; Replace any newlines in DIR with literal "\n"s, for the sake
1177 ;; of the header line. To disambiguate a literal "\n" in the
1178 ;; actual dirname, we also replace "\" with "\\".
1179 ;; Personally, I think this should always be done, irrespective
1180 ;; of the value of dired-actual-switches, because:
1181 ;; i) Dired simply does not work with an unescaped newline in
1182 ;; the directory name used in the header (bug=10469#28), and
1183 ;; ii) "\" is always replaced with "\\" in the listing, so doing
1184 ;; it in the header as well makes things consistent.
1185 ;; But at present it is only done if "-b" is in ls-switches,
1186 ;; because newlines in dirnames are uncommon, and people may
1187 ;; have gotten used to seeing unescaped "\" in the headers.
1188 ;; Note: adjust dired-build-subdir-alist if you change this.
1189 (setq dir (replace-regexp-in-string "\\\\" "\\\\" dir nil t)
1190 dir (replace-regexp-in-string "\n" "\\n" dir nil t)))
1176 (dired-insert-set-properties opoint (point)) 1191 (dired-insert-set-properties opoint (point))
1177 ;; If we used --dired and it worked, the lines are already indented. 1192 ;; If we used --dired and it worked, the lines are already indented.
1178 ;; Otherwise, indent them. 1193 ;; Otherwise, indent them.
@@ -2541,12 +2556,31 @@ instead of `dired-actual-switches'."
2541 (delete-region (point) (match-end 1)) 2556 (delete-region (point) (match-end 1))
2542 (insert new-dir-name)) 2557 (insert new-dir-name))
2543 (setq count (1+ count)) 2558 (setq count (1+ count))
2559 ;; Undo any escaping of newlines and \ by dired-insert-directory.
2560 ;; Convert "n" preceded by odd number of \ to newline, and \\ to \.
2561 (when (and (dired-switches-escape-p switches)
2562 (string-match-p "\\\\" new-dir-name))
2563 (let (temp res)
2564 (mapc (lambda (char)
2565 (cond ((equal char ?\\)
2566 (if temp
2567 (setq res (concat res "\\")
2568 temp nil)
2569 (setq temp "\\")))
2570 ((and temp (equal char ?n))
2571 (setq res (concat res "\n")
2572 temp nil))
2573 (t
2574 (setq res (concat res temp (char-to-string char))
2575 temp nil))))
2576 new-dir-name)
2577 (setq new-dir-name res)))
2544 (dired-alist-add-1 new-dir-name 2578 (dired-alist-add-1 new-dir-name
2545 ;; Place a sub directory boundary between lines. 2579 ;; Place a sub directory boundary between lines.
2546 (save-excursion 2580 (save-excursion
2547 (goto-char (match-beginning 0)) 2581 (goto-char (match-beginning 0))
2548 (beginning-of-line) 2582 (beginning-of-line)
2549 (point-marker))))) 2583 (point-marker)))))
2550 (if (and (> count 1) (called-interactively-p 'interactive)) 2584 (if (and (> count 1) (called-interactively-p 'interactive))
2551 (message "Buffer includes %d directories" count))) 2585 (message "Buffer includes %d directories" count)))
2552 ;; We don't need to sort it because it is in buffer order per 2586 ;; We don't need to sort it because it is in buffer order per
diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el
index f24180b5c7f..296e2ee8b24 100644
--- a/lisp/eshell/em-unix.el
+++ b/lisp/eshell/em-unix.el
@@ -792,8 +792,6 @@ external command."
792 (funcall (or (pcomplete-find-completion-function (pcomplete-arg 1)) 792 (funcall (or (pcomplete-find-completion-function (pcomplete-arg 1))
793 pcomplete-default-completion-function))) 793 pcomplete-default-completion-function)))
794 794
795(defalias 'pcomplete/ssh 'pcomplete/rsh)
796
797(defvar block-size) 795(defvar block-size)
798(defvar by-bytes) 796(defvar by-bytes)
799(defvar dereference-links) 797(defvar dereference-links)
diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el
index f111fd91230..8218e91ddc7 100644
--- a/lisp/eshell/esh-util.el
+++ b/lisp/eshell/esh-util.el
@@ -483,7 +483,7 @@ list."
483 (insert-file-contents eshell-hosts-file) 483 (insert-file-contents eshell-hosts-file)
484 (goto-char (point-min)) 484 (goto-char (point-min))
485 (while (re-search-forward 485 (while (re-search-forward
486 "^\\(\\S-+\\)\\s-+\\(\\S-+\\)\\(\\s-*\\(\\S-+\\)\\)?" nil t) 486 "^\\([^#[:space:]]+\\)\\s-+\\(\\S-+\\)\\(\\s-*\\(\\S-+\\)\\)?" nil t)
487 (if (match-string 1) 487 (if (match-string 1)
488 (add-to-list 'hosts (match-string 1))) 488 (add-to-list 'hosts (match-string 1)))
489 (if (match-string 2) 489 (if (match-string 2)
diff --git a/lisp/files.el b/lisp/files.el
index f15c523400d..7a72775ac3f 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -510,14 +510,36 @@ and ignores this variable."
510 (other :tag "Query" other)) 510 (other :tag "Query" other))
511 :group 'find-file) 511 :group 'find-file)
512 512
513;; This is an odd variable IMO.
514;; You might wonder why it is needed, when we could just do:
515;; (set (make-local-variable 'enable-local-variables) nil)
516;; These two are not precisely the same.
517;; Setting this variable does not cause -*- mode settings to be
518;; ignored, whereas setting enable-local-variables does.
519;; Only three places in Emacs use this variable: tar and arc modes,
520;; and rmail. The first two don't need it. They already use
521;; inhibit-local-variables-regexps, which is probably enough, and
522;; could also just set enable-local-variables locally to nil.
523;; Them setting it has the side-effect that dir-locals cannot apply to
524;; eg tar files (?). FIXME Is this appropriate?
525;; AFAICS, rmail is the only thing that needs this, and the only
526;; reason it uses it is for BABYL files (which are obsolete).
527;; These contain "-*- rmail -*-" in the first line, which rmail wants
528;; to respect, so that find-file on a BABYL file will switch to
529;; rmail-mode automatically (this is nice, but hardly essential,
530;; since most people are used to explicitly running a command to
531;; access their mail; M-x gnus etc). Rmail files may happen to
532;; contain Local Variables sections in messages, which Rmail wants to
533;; ignore. So AFAICS the only reason this variable exists is for a
534;; minor convenience feature for handling of an obsolete Rmail file format.
513(defvar local-enable-local-variables t 535(defvar local-enable-local-variables t
514 "Like `enable-local-variables' but meant for buffer-local bindings. 536 "Like `enable-local-variables' but meant for buffer-local bindings.
515The meaningful values are nil and non-nil. The default is non-nil. 537The meaningful values are nil and non-nil. The default is non-nil.
516If a major mode sets this to nil, buffer-locally, then any local 538If a major mode sets this to nil, buffer-locally, then any local
517variables list in the file will be ignored. 539variables list in a file visited in that mode will be ignored.
518 540
519This variable does not affect the use of major modes 541This variable does not affect the use of major modes specified
520specified in a -*- line.") 542in a -*- line.")
521 543
522(defcustom enable-local-eval 'maybe 544(defcustom enable-local-eval 'maybe
523 "Control processing of the \"variable\" `eval' in a file's local variables. 545 "Control processing of the \"variable\" `eval' in a file's local variables.
@@ -2405,9 +2427,6 @@ If the element has the form (REGEXP FUNCTION NON-NIL), then after
2405calling FUNCTION (if it's not nil), we delete the suffix that matched 2427calling FUNCTION (if it's not nil), we delete the suffix that matched
2406REGEXP and search the list again for another match. 2428REGEXP and search the list again for another match.
2407 2429
2408If the file name matches `inhibit-first-line-modes-regexps',
2409then `auto-mode-alist' is not processed.
2410
2411The extensions whose FUNCTION is `archive-mode' should also 2430The extensions whose FUNCTION is `archive-mode' should also
2412appear in `auto-coding-alist' with `no-conversion' coding system. 2431appear in `auto-coding-alist' with `no-conversion' coding system.
2413 2432
@@ -2478,16 +2497,55 @@ of a script, mode MODE is enabled.
2478 2497
2479See also `auto-mode-alist'.") 2498See also `auto-mode-alist'.")
2480 2499
2481(defvar inhibit-first-line-modes-regexps 2500(define-obsolete-variable-alias 'inhibit-first-line-modes-regexps
2482 (mapcar 'purecopy '("\\.tar\\'" "\\.tgz\\'" "\\.tiff?\\'" 2501 'inhibit-file-local-variables-regexps "24.1")
2483 "\\.gif\\'" "\\.png\\'" "\\.jpe?g\\'")) 2502
2484 "List of regexps; if one matches a file name, don't look for `-*-'.") 2503;; TODO really this should be a list of modes (eg tar-mode), not regexps,
2485 2504;; because we are duplicating info from auto-mode-alist.
2486(defvar inhibit-first-line-modes-suffixes nil 2505;; TODO many elements of this list are also in auto-coding-alist.
2487 "List of regexps for what to ignore, for `inhibit-first-line-modes-regexps'. 2506(defvar inhibit-local-variables-regexps
2488When checking `inhibit-first-line-modes-regexps', we first discard 2507 (mapcar 'purecopy '("\\.tar\\'" "\\.t[bg]z\\'"
2508 "\\.arc\\'" "\\.zip\\'" "\\.lzh\\'" "\\.lha\\'"
2509 "\\.zoo\\'" "\\.[jew]ar\\'" "\\.xpi\\'" "\\.rar\\'"
2510 "\\.7z\\'"
2511 "\\.sx[dmicw]\\'" "\\.odt\\'"
2512 "\\.tiff?\\'" "\\.gif\\'" "\\.png\\'" "\\.jpe?g\\'"))
2513 "List of regexps matching file names in which to ignore local variables.
2514This includes `-*-' lines as well as trailing \"Local Variables\" sections.
2515Files matching this list are typically binary file formats.
2516They may happen to contain sequences that look like local variable
2517specifications, but are not really, or they may be containers for
2518member files with their own local variable sections, which are
2519not appropriate for the containing file.
2520See also `inhibit-local-variables-suffixes'.")
2521
2522(define-obsolete-variable-alias 'inhibit-first-line-modes-suffixes
2523 'inhibit-local-variables-suffixes "24.1")
2524
2525(defvar inhibit-local-variables-suffixes nil
2526 "List of regexps matching suffixes to remove from file names.
2527When checking `inhibit-local-variables-regexps', we first discard
2489from the end of the file name anything that matches one of these regexps.") 2528from the end of the file name anything that matches one of these regexps.")
2490 2529
2530;; TODO explicitly add case-fold-search t?
2531(defun inhibit-local-variables-p ()
2532 "Return non-nil if file local variables should be ignored.
2533This checks the file (or buffer) name against `inhibit-local-variables-regexps'
2534and `inhibit-local-variables-suffixes'."
2535 (let ((temp inhibit-local-variables-regexps)
2536 (name (if buffer-file-name
2537 (file-name-sans-versions buffer-file-name)
2538 (buffer-name))))
2539 (while (let ((sufs inhibit-local-variables-suffixes))
2540 (while (and sufs (not (string-match (car sufs) name)))
2541 (setq sufs (cdr sufs)))
2542 sufs)
2543 (setq name (substring name 0 (match-beginning 0))))
2544 (while (and temp
2545 (not (string-match (car temp) name)))
2546 (setq temp (cdr temp)))
2547 temp))
2548
2491(defvar auto-mode-interpreter-regexp 2549(defvar auto-mode-interpreter-regexp
2492 (purecopy "#![ \t]?\\([^ \t\n]*\ 2550 (purecopy "#![ \t]?\\([^ \t\n]*\
2493/bin/env[ \t]\\)?\\([^ \t\n]+\\)") 2551/bin/env[ \t]\\)?\\([^ \t\n]+\\)")
@@ -2550,21 +2608,24 @@ Also applies to `magic-fallback-mode-alist'.")
2550(defun set-auto-mode (&optional keep-mode-if-same) 2608(defun set-auto-mode (&optional keep-mode-if-same)
2551 "Select major mode appropriate for current buffer. 2609 "Select major mode appropriate for current buffer.
2552 2610
2553To find the right major mode, this function checks for a -*- mode tag, 2611To find the right major mode, this function checks for a -*- mode tag
2554checks for a `mode:' entry in the Local Variables section of the file, 2612checks for a `mode:' entry in the Local Variables section of the file,
2555checks if it uses an interpreter listed in `interpreter-mode-alist', 2613checks if it uses an interpreter listed in `interpreter-mode-alist',
2556matches the buffer beginning against `magic-mode-alist', 2614matches the buffer beginning against `magic-mode-alist',
2557compares the filename against the entries in `auto-mode-alist', 2615compares the filename against the entries in `auto-mode-alist',
2558then matches the buffer beginning against `magic-fallback-mode-alist'. 2616then matches the buffer beginning against `magic-fallback-mode-alist'.
2559 2617
2560If `enable-local-variables' is nil, this function does not check for 2618If `enable-local-variables' is nil, or if the file name matches
2561any mode: tag anywhere in the file. 2619`inhibit-local-variables-regexps', this function does not check
2620for any mode: tag anywhere in the file. If `local-enable-local-variables'
2621is nil, then the only mode: tag that can be relevant is a -*- one.
2562 2622
2563If the optional argument KEEP-MODE-IF-SAME is non-nil, then we 2623If the optional argument KEEP-MODE-IF-SAME is non-nil, then we
2564set the major mode only if that would change it. In other words 2624set the major mode only if that would change it. In other words
2565we don't actually set it to the same mode the buffer already has." 2625we don't actually set it to the same mode the buffer already has."
2566 ;; Look for -*-MODENAME-*- or -*- ... mode: MODENAME; ... -*- 2626 ;; Look for -*-MODENAME-*- or -*- ... mode: MODENAME; ... -*-
2567 (let (end done mode modes) 2627 (let ((try-locals (not (inhibit-local-variables-p)))
2628 end done mode modes)
2568 ;; Once we drop the deprecated feature where mode: is also allowed to 2629 ;; Once we drop the deprecated feature where mode: is also allowed to
2569 ;; specify minor-modes (ie, there can be more than one "mode:"), we can 2630 ;; specify minor-modes (ie, there can be more than one "mode:"), we can
2570 ;; remove this section and just let (hack-local-variables t) handle it. 2631 ;; remove this section and just let (hack-local-variables t) handle it.
@@ -2572,7 +2633,9 @@ we don't actually set it to the same mode the buffer already has."
2572 (save-excursion 2633 (save-excursion
2573 (goto-char (point-min)) 2634 (goto-char (point-min))
2574 (skip-chars-forward " \t\n") 2635 (skip-chars-forward " \t\n")
2636 ;; Note by design local-enable-local-variables does not matter here.
2575 (and enable-local-variables 2637 (and enable-local-variables
2638 try-locals
2576 (setq end (set-auto-mode-1)) 2639 (setq end (set-auto-mode-1))
2577 (if (save-excursion (search-forward ":" end t)) 2640 (if (save-excursion (search-forward ":" end t))
2578 ;; Find all specifications for the `mode:' variable 2641 ;; Find all specifications for the `mode:' variable
@@ -2603,8 +2666,12 @@ we don't actually set it to the same mode the buffer already has."
2603 (or (set-auto-mode-0 mode keep-mode-if-same) 2666 (or (set-auto-mode-0 mode keep-mode-if-same)
2604 ;; continuing would call minor modes again, toggling them off 2667 ;; continuing would call minor modes again, toggling them off
2605 (throw 'nop nil)))))) 2668 (throw 'nop nil))))))
2669 ;; hack-local-variables checks local-enable-local-variables etc, but
2670 ;; we might as well be explicit here for the sake of clarity.
2606 (and (not done) 2671 (and (not done)
2607 enable-local-variables 2672 enable-local-variables
2673 local-enable-local-variables
2674 try-locals
2608 (setq mode (hack-local-variables t)) 2675 (setq mode (hack-local-variables t))
2609 (not (memq mode modes)) ; already tried and failed 2676 (not (memq mode modes)) ; already tried and failed
2610 (if (not (functionp mode)) 2677 (if (not (functionp mode))
@@ -2714,38 +2781,24 @@ same, do nothing and return nil."
2714(defun set-auto-mode-1 () 2781(defun set-auto-mode-1 ()
2715 "Find the -*- spec in the buffer. 2782 "Find the -*- spec in the buffer.
2716Call with point at the place to start searching from. 2783Call with point at the place to start searching from.
2717If one is found, set point to the beginning 2784If one is found, set point to the beginning and return the position
2718and return the position of the end. 2785of the end. Otherwise, return nil; may change point.
2719Otherwise, return nil; point may be changed." 2786The variable `inhibit-local-variables-regexps' can cause a -*- spec to
2787be ignored; but `enable-local-variables' and `local-enable-local-variables'
2788have no effect."
2720 (let (beg end) 2789 (let (beg end)
2721 (and 2790 (and
2722 ;; Don't look for -*- if this file name matches any 2791 ;; Don't look for -*- if this file name matches any
2723 ;; of the regexps in inhibit-first-line-modes-regexps. 2792 ;; of the regexps in inhibit-local-variables-regexps.
2724 (let ((temp inhibit-first-line-modes-regexps) 2793 (not (inhibit-local-variables-p))
2725 (name (if buffer-file-name
2726 (file-name-sans-versions buffer-file-name)
2727 (buffer-name))))
2728 (while (let ((sufs inhibit-first-line-modes-suffixes))
2729 (while (and sufs (not (string-match (car sufs) name)))
2730 (setq sufs (cdr sufs)))
2731 sufs)
2732 (setq name (substring name 0 (match-beginning 0))))
2733 (while (and temp
2734 (not (string-match (car temp) name)))
2735 (setq temp (cdr temp)))
2736 (not temp))
2737
2738 (search-forward "-*-" (line-end-position 2794 (search-forward "-*-" (line-end-position
2739 ;; If the file begins with "#!" 2795 ;; If the file begins with "#!" (exec
2740 ;; (exec interpreter magic), look 2796 ;; interpreter magic), look for mode frobs
2741 ;; for mode frobs in the first two 2797 ;; in the first two lines. You cannot
2742 ;; lines. You cannot necessarily 2798 ;; necessarily put them in the first line
2743 ;; put them in the first line of 2799 ;; of such a file without screwing up the
2744 ;; such a file without screwing up 2800 ;; interpreter invocation. The same holds
2745 ;; the interpreter invocation. 2801 ;; for '\" in man pages (preprocessor
2746 ;; The same holds for
2747 ;; '\"
2748 ;; in man pages (preprocessor
2749 ;; magic for the `man' program). 2802 ;; magic for the `man' program).
2750 (and (looking-at "^\\(#!\\|'\\\\\"\\)") 2)) t) 2803 (and (looking-at "^\\(#!\\|'\\\\\"\\)") 2)) t)
2751 (progn 2804 (progn
@@ -3090,19 +3143,41 @@ Uses `hack-local-variables-apply' to apply the variables.
3090If MODE-ONLY is non-nil, all we do is check whether a \"mode:\" 3143If MODE-ONLY is non-nil, all we do is check whether a \"mode:\"
3091is specified, and return the corresponding mode symbol, or nil. 3144is specified, and return the corresponding mode symbol, or nil.
3092In this case, we try to ignore minor-modes, and only return a 3145In this case, we try to ignore minor-modes, and only return a
3093major-mode." 3146major-mode.
3147
3148If `enable-local-variables' or `local-enable-local-variables' is nil,
3149this function does nothing. If `inhibit-local-variables-regexps'
3150applies to the file in question, the file is not scanned for
3151local variables, but directory-local variables may still be applied."
3152 ;; We don't let inhibit-local-variables-p influence the value of
3153 ;; enable-local-variables, because then it would affect dir-local
3154 ;; variables. We don't want to search eg tar files for file local
3155 ;; variable sections, but there is no reason dir-locals cannot apply
3156 ;; to them. The real meaning of inhibit-local-variables-p is "do
3157 ;; not scan this file for local variables".
3094 (let ((enable-local-variables 3158 (let ((enable-local-variables
3095 (and local-enable-local-variables enable-local-variables)) 3159 (and local-enable-local-variables enable-local-variables))
3096 result) 3160 result)
3097 (unless mode-only 3161 (unless mode-only
3098 (setq file-local-variables-alist nil) 3162 (setq file-local-variables-alist nil)
3099 (report-errors "Directory-local variables error: %s" 3163 (report-errors "Directory-local variables error: %s"
3164 ;; Note this is a no-op if enable-local-variables is nil.
3100 (hack-dir-local-variables))) 3165 (hack-dir-local-variables)))
3101 (when (or mode-only enable-local-variables) 3166 ;; This entire function is basically a no-op if enable-local-variables
3102 ;; If MODE-ONLY is non-nil, and the prop line specifies a mode, 3167 ;; is nil. All it does is set file-local-variables-alist to nil.
3103 ;; then we're done, and have no need to scan further. 3168 (when enable-local-variables
3104 (unless (and (setq result (hack-local-variables-prop-line mode-only)) 3169 ;; This part used to ignore enable-local-variables when mode-only
3105 mode-only) 3170 ;; was non-nil. That was inappropriate, eg consider the
3171 ;; (artificial) example of:
3172 ;; (setq local-enable-local-variables nil)
3173 ;; Open a file foo.txt that contains "mode: sh".
3174 ;; It correctly opens in text-mode.
3175 ;; M-x set-visited-file name foo.c, and it incorrectly stays in text-mode.
3176 (unless (or (inhibit-local-variables-p)
3177 ;; If MODE-ONLY is non-nil, and the prop line specifies a
3178 ;; mode, then we're done, and have no need to scan further.
3179 (and (setq result (hack-local-variables-prop-line mode-only))
3180 mode-only))
3106 ;; Look for "Local variables:" line in last page. 3181 ;; Look for "Local variables:" line in last page.
3107 (save-excursion 3182 (save-excursion
3108 (goto-char (point-max)) 3183 (goto-char (point-max))
@@ -3192,14 +3267,13 @@ major-mode."
3192 (indirect-variable var)) 3267 (indirect-variable var))
3193 val) result) 3268 val) result)
3194 (error nil))))) 3269 (error nil)))))
3195 (forward-line 1))))))))) 3270 (forward-line 1))))))))
3196 ;; Now we've read all the local variables. 3271 ;; Now we've read all the local variables.
3197 ;; If MODE-ONLY is non-nil, return whether the mode was specified. 3272 ;; If MODE-ONLY is non-nil, return whether the mode was specified.
3198 (cond (mode-only result) 3273 (if mode-only result
3199 ;; Otherwise, set the variables. 3274 ;; Otherwise, set the variables.
3200 (enable-local-variables 3275 (hack-local-variables-filter result nil)
3201 (hack-local-variables-filter result nil) 3276 (hack-local-variables-apply)))))
3202 (hack-local-variables-apply)))))
3203 3277
3204(defun hack-local-variables-apply () 3278(defun hack-local-variables-apply ()
3205 "Apply the elements of `file-local-variables-alist'. 3279 "Apply the elements of `file-local-variables-alist'.
@@ -3611,7 +3685,7 @@ the old visited file has been renamed to the new name FILENAME."
3611 (interactive "FSet visited file name: ") 3685 (interactive "FSet visited file name: ")
3612 (if (buffer-base-buffer) 3686 (if (buffer-base-buffer)
3613 (error "An indirect buffer cannot visit a file")) 3687 (error "An indirect buffer cannot visit a file"))
3614 (let (truename) 3688 (let (truename old-try-locals)
3615 (if filename 3689 (if filename
3616 (setq filename 3690 (setq filename
3617 (if (string-equal filename "") 3691 (if (string-equal filename "")
@@ -3636,7 +3710,8 @@ the old visited file has been renamed to the new name FILENAME."
3636 (progn 3710 (progn
3637 (and filename (lock-buffer filename)) 3711 (and filename (lock-buffer filename))
3638 (unlock-buffer))) 3712 (unlock-buffer)))
3639 (setq buffer-file-name filename) 3713 (setq old-try-locals (not (inhibit-local-variables-p))
3714 buffer-file-name filename)
3640 (if filename ; make buffer name reflect filename. 3715 (if filename ; make buffer name reflect filename.
3641 (let ((new-name (file-name-nondirectory buffer-file-name))) 3716 (let ((new-name (file-name-nondirectory buffer-file-name)))
3642 (setq default-directory (file-name-directory buffer-file-name)) 3717 (setq default-directory (file-name-directory buffer-file-name))
@@ -3656,59 +3731,63 @@ the old visited file has been renamed to the new name FILENAME."
3656 (setq buffer-file-number 3731 (setq buffer-file-number
3657 (if filename 3732 (if filename
3658 (nthcdr 10 (file-attributes buffer-file-name)) 3733 (nthcdr 10 (file-attributes buffer-file-name))
3659 nil))) 3734 nil))
3660 ;; write-file-functions is normally used for things like ftp-find-file 3735 ;; write-file-functions is normally used for things like ftp-find-file
3661 ;; that visit things that are not local files as if they were files. 3736 ;; that visit things that are not local files as if they were files.
3662 ;; Changing to visit an ordinary local file instead should flush the hook. 3737 ;; Changing to visit an ordinary local file instead should flush the hook.
3663 (kill-local-variable 'write-file-functions) 3738 (kill-local-variable 'write-file-functions)
3664 (kill-local-variable 'local-write-file-hooks) 3739 (kill-local-variable 'local-write-file-hooks)
3665 (kill-local-variable 'revert-buffer-function) 3740 (kill-local-variable 'revert-buffer-function)
3666 (kill-local-variable 'backup-inhibited) 3741 (kill-local-variable 'backup-inhibited)
3667 ;; If buffer was read-only because of version control, 3742 ;; If buffer was read-only because of version control,
3668 ;; that reason is gone now, so make it writable. 3743 ;; that reason is gone now, so make it writable.
3669 (if vc-mode 3744 (if vc-mode
3670 (setq buffer-read-only nil)) 3745 (setq buffer-read-only nil))
3671 (kill-local-variable 'vc-mode) 3746 (kill-local-variable 'vc-mode)
3672 ;; Turn off backup files for certain file names. 3747 ;; Turn off backup files for certain file names.
3673 ;; Since this is a permanent local, the major mode won't eliminate it. 3748 ;; Since this is a permanent local, the major mode won't eliminate it.
3674 (and buffer-file-name 3749 (and buffer-file-name
3675 backup-enable-predicate 3750 backup-enable-predicate
3676 (not (funcall backup-enable-predicate buffer-file-name)) 3751 (not (funcall backup-enable-predicate buffer-file-name))
3677 (progn 3752 (progn
3678 (make-local-variable 'backup-inhibited) 3753 (make-local-variable 'backup-inhibited)
3679 (setq backup-inhibited t))) 3754 (setq backup-inhibited t)))
3680 (let ((oauto buffer-auto-save-file-name)) 3755 (let ((oauto buffer-auto-save-file-name))
3681 ;; If auto-save was not already on, turn it on if appropriate. 3756 ;; If auto-save was not already on, turn it on if appropriate.
3682 (if (not buffer-auto-save-file-name) 3757 (if (not buffer-auto-save-file-name)
3683 (and buffer-file-name auto-save-default 3758 (and buffer-file-name auto-save-default
3684 (auto-save-mode t)) 3759 (auto-save-mode t))
3685 ;; If auto save is on, start using a new name. 3760 ;; If auto save is on, start using a new name.
3686 ;; We deliberately don't rename or delete the old auto save 3761 ;; We deliberately don't rename or delete the old auto save
3687 ;; for the old visited file name. This is because perhaps 3762 ;; for the old visited file name. This is because perhaps
3688 ;; the user wants to save the new state and then compare with the 3763 ;; the user wants to save the new state and then compare with the
3689 ;; previous state from the auto save file. 3764 ;; previous state from the auto save file.
3690 (setq buffer-auto-save-file-name 3765 (setq buffer-auto-save-file-name
3691 (make-auto-save-file-name))) 3766 (make-auto-save-file-name)))
3692 ;; Rename the old auto save file if any. 3767 ;; Rename the old auto save file if any.
3693 (and oauto buffer-auto-save-file-name 3768 (and oauto buffer-auto-save-file-name
3694 (file-exists-p oauto) 3769 (file-exists-p oauto)
3695 (rename-file oauto buffer-auto-save-file-name t))) 3770 (rename-file oauto buffer-auto-save-file-name t)))
3696 (and buffer-file-name 3771 (and buffer-file-name
3697 (not along-with-file) 3772 (not along-with-file)
3698 (set-buffer-modified-p t)) 3773 (set-buffer-modified-p t))
3699 ;; Update the major mode, if the file name determines it. 3774 ;; Update the major mode, if the file name determines it.
3700 (condition-case nil 3775 (condition-case nil
3701 ;; Don't change the mode if it is special. 3776 ;; Don't change the mode if it is special.
3702 (or (not change-major-mode-with-file-name) 3777 (or (not change-major-mode-with-file-name)
3703 (get major-mode 'mode-class) 3778 (get major-mode 'mode-class)
3704 ;; Don't change the mode if the local variable list specifies it. 3779 ;; Don't change the mode if the local variable list specifies it.
3705 (hack-local-variables t) 3780 ;; The file name can influence whether the local variables apply.
3706 ;; TODO consider making normal-mode handle this case. 3781 (and old-try-locals
3707 (let ((old major-mode)) 3782 ;; h-l-v also checks it, but might as well be explcit.
3708 (set-auto-mode t) 3783 (not (inhibit-local-variables-p))
3709 (or (eq old major-mode) 3784 (hack-local-variables t))
3710 (hack-local-variables)))) 3785 ;; TODO consider making normal-mode handle this case.
3711 (error nil))) 3786 (let ((old major-mode))
3787 (set-auto-mode t)
3788 (or (eq old major-mode)
3789 (hack-local-variables))))
3790 (error nil))))
3712 3791
3713(defun write-file (filename &optional confirm) 3792(defun write-file (filename &optional confirm)
3714 "Write current buffer into file FILENAME. 3793 "Write current buffer into file FILENAME.
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index c7358779818..8e790962c34 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,7 @@
12012-01-21 Lars Magne Ingebrigtsen <larsi@gnus.org>
2
3 * mm-decode.el (mm-interactively-view-part): Fix prompt.
4
12012-01-10 Teodor Zlatanov <tzz@lifelogs.com> 52012-01-10 Teodor Zlatanov <tzz@lifelogs.com>
2 6
3 * nntp.el (nntp-send-authinfo): Query `auth-source-search' with the 7 * nntp.el (nntp-send-authinfo): Query `auth-source-search' with the
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
index 10e0fa2861c..dd3eb6c9d96 100644
--- a/lisp/gnus/mm-decode.el
+++ b/lisp/gnus/mm-decode.el
@@ -1353,7 +1353,7 @@ Use CMD as the process."
1353 (mailcap-mime-info type 'all))) 1353 (mailcap-mime-info type 'all)))
1354 (method (let ((minibuffer-local-completion-map 1354 (method (let ((minibuffer-local-completion-map
1355 mm-viewer-completion-map)) 1355 mm-viewer-completion-map))
1356 (completing-read "Viewer" methods)))) 1356 (completing-read "Viewer: " methods))))
1357 (when (string= method "") 1357 (when (string= method "")
1358 (error "No method given")) 1358 (error "No method given"))
1359 (if (string-match "^[^% \t]+$" method) 1359 (if (string-match "^[^% \t]+$" method)
diff --git a/lisp/help-macro.el b/lisp/help-macro.el
index 0bd6f3c4798..112c72778bc 100644
--- a/lisp/help-macro.el
+++ b/lisp/help-macro.el
@@ -184,9 +184,12 @@ and then returns."
184 (when config 184 (when config
185 (set-window-configuration config) 185 (set-window-configuration config)
186 (setq config nil)) 186 (setq config nil))
187 ;; `defn' must make sure that its frame is 187 ;; Temporarily rebind `minor-mode-map-alist'
188 ;; selected, so we won't iconify it below. 188 ;; to `new-minor-mode-map-alist' (Bug#10454).
189 (call-interactively defn) 189 (let ((minor-mode-map-alist new-minor-mode-map-alist))
190 ;; `defn' must make sure that its frame is
191 ;; selected, so we won't iconify it below.
192 (call-interactively defn))
190 (when new-frame 193 (when new-frame
191 ;; Do not iconify the selected frame. 194 ;; Do not iconify the selected frame.
192 (unless (eq new-frame (selected-frame)) 195 (unless (eq new-frame (selected-frame))
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index cbe548c2ccf..378cbc9badd 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -418,7 +418,10 @@ To prefer, for instance, utf-8, say the following:
418 (if (memq eol-type '(0 1 2)) 418 (if (memq eol-type '(0 1 2))
419 (setq base 419 (setq base
420 (coding-system-change-eol-conversion base eol-type))) 420 (coding-system-change-eol-conversion base eol-type)))
421 (set-default-coding-systems base))) 421 (set-default-coding-systems base)
422 (if (called-interactively-p 'interactive)
423 (or (eq base default-file-name-coding-system)
424 (message "The default value of `file-name-coding-system' was not changed because the specified coding system is not suitable for file names.")))))
422 425
423(defvar sort-coding-systems-predicate nil 426(defvar sort-coding-systems-predicate nil
424 "If non-nil, a predicate function to sort coding systems. 427 "If non-nil, a predicate function to sort coding systems.
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index 17163071d3f..d4dd4e4cf24 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -1668,6 +1668,7 @@ in-place."
1668 1668
1669;;; FILE I/O 1669;;; FILE I/O
1670 1670
1671;; TODO many elements of this list are also in inhibit-local-variables-regexps.
1671(defcustom auto-coding-alist 1672(defcustom auto-coding-alist
1672 ;; .exe and .EXE are added to support archive-mode looking at DOS 1673 ;; .exe and .EXE are added to support archive-mode looking at DOS
1673 ;; self-extracting exe archives. 1674 ;; self-extracting exe archives.
@@ -1677,7 +1678,7 @@ arc\\|zip\\|lzh\\|lha\\|zoo\\|[jew]ar\\|xpi\\|rar\\|7z\\|\
1677ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|7Z\\)\\'" 1678ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|7Z\\)\\'"
1678 . no-conversion-multibyte) 1679 . no-conversion-multibyte)
1679 ("\\.\\(exe\\|EXE\\)\\'" . no-conversion) 1680 ("\\.\\(exe\\|EXE\\)\\'" . no-conversion)
1680 ("\\.\\(sx[dmicw]\\|odt\\|tar\\|tgz\\)\\'" . no-conversion) 1681 ("\\.\\(sx[dmicw]\\|odt\\|tar\\|t[bg]z\\)\\'" . no-conversion)
1681 ("\\.\\(gz\\|Z\\|bz\\|bz2\\|xz\\|gpg\\)\\'" . no-conversion) 1682 ("\\.\\(gz\\|Z\\|bz\\|bz2\\|xz\\|gpg\\)\\'" . no-conversion)
1682 ("\\.\\(jpe?g\\|png\\|gif\\|tiff?\\|p[bpgn]m\\)\\'" . no-conversion) 1683 ("\\.\\(jpe?g\\|png\\|gif\\|tiff?\\|p[bpgn]m\\)\\'" . no-conversion)
1683 ("\\.pdf\\'" . no-conversion) 1684 ("\\.pdf\\'" . no-conversion)
diff --git a/lisp/isearch.el b/lisp/isearch.el
index a6cc69be9a6..ce759116860 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -102,7 +102,7 @@ in Isearch mode is always downcased."
102 :group 'isearch) 102 :group 'isearch)
103 103
104(defcustom search-nonincremental-instead t 104(defcustom search-nonincremental-instead t
105 "If non-nil, do a nonincremental search instead if exiting immediately. 105 "If non-nil, do a nonincremental search instead of exiting immediately.
106Actually, `isearch-edit-string' is called to let you enter the search 106Actually, `isearch-edit-string' is called to let you enter the search
107string, and RET terminates editing and does a nonincremental search." 107string, and RET terminates editing and does a nonincremental search."
108 :type 'boolean 108 :type 'boolean
diff --git a/lisp/jka-cmpr-hook.el b/lisp/jka-cmpr-hook.el
index d09e64634c3..600ed549731 100644
--- a/lisp/jka-cmpr-hook.el
+++ b/lisp/jka-cmpr-hook.el
@@ -119,7 +119,7 @@ based on the filename itself and `jka-compr-compression-info-list'."
119(defun jka-compr-install () 119(defun jka-compr-install ()
120 "Install jka-compr. 120 "Install jka-compr.
121This adds entries to `file-name-handler-alist' and `auto-mode-alist' 121This adds entries to `file-name-handler-alist' and `auto-mode-alist'
122and `inhibit-first-line-modes-suffixes'." 122and `inhibit-local-variables-suffixes'."
123 123
124 (setq jka-compr-file-name-handler-entry 124 (setq jka-compr-file-name-handler-entry
125 (cons (jka-compr-build-file-regexp) 'jka-compr-handler)) 125 (cons (jka-compr-build-file-regexp) 'jka-compr-handler))
@@ -145,12 +145,12 @@ and `inhibit-first-line-modes-suffixes'."
145 ;; are chosen right according to the file names 145 ;; are chosen right according to the file names
146 ;; sans `.gz'. 146 ;; sans `.gz'.
147 (push (list (jka-compr-info-regexp x) nil 'jka-compr) auto-mode-alist) 147 (push (list (jka-compr-info-regexp x) nil 'jka-compr) auto-mode-alist)
148 ;; Also add these regexps to 148 ;; Also add these regexps to inhibit-local-variables-suffixes,
149 ;; inhibit-first-line-modes-suffixes, so that a 149 ;; so that a -*- line in the first file of a compressed tar file,
150 ;; -*- line in the first file of a compressed tar 150 ;; or a Local Variables section in a member file at the end of
151 ;; file doesn't override tar-mode. 151 ;; the tar file don't override tar-mode.
152 (push (jka-compr-info-regexp x) 152 (push (jka-compr-info-regexp x)
153 inhibit-first-line-modes-suffixes))) 153 inhibit-local-variables-suffixes)))
154 (setq auto-mode-alist 154 (setq auto-mode-alist
155 (append auto-mode-alist jka-compr-mode-alist-additions)) 155 (append auto-mode-alist jka-compr-mode-alist-additions))
156 156
diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el
index 786e4292d5f..8a8d7cdbb52 100644
--- a/lisp/jka-compr.el
+++ b/lisp/jka-compr.el
@@ -657,16 +657,15 @@ It is not recommended to set this variable permanently to anything but nil.")
657(defun jka-compr-uninstall () 657(defun jka-compr-uninstall ()
658 "Uninstall jka-compr. 658 "Uninstall jka-compr.
659This removes the entries in `file-name-handler-alist' and `auto-mode-alist' 659This removes the entries in `file-name-handler-alist' and `auto-mode-alist'
660and `inhibit-first-line-modes-suffixes' that were added 660and `inhibit-local-variables-suffixes' that were added
661by `jka-compr-installed'." 661by `jka-compr-installed'."
662 ;; Delete from inhibit-first-line-modes-suffixes 662 ;; Delete from inhibit-local-variables-suffixes what jka-compr-install added.
663 ;; what jka-compr-install added.
664 (mapc 663 (mapc
665 (function (lambda (x) 664 (function (lambda (x)
666 (and (jka-compr-info-strip-extension x) 665 (and (jka-compr-info-strip-extension x)
667 (setq inhibit-first-line-modes-suffixes 666 (setq inhibit-local-variables-suffixes
668 (delete (jka-compr-info-regexp x) 667 (delete (jka-compr-info-regexp x)
669 inhibit-first-line-modes-suffixes))))) 668 inhibit-local-variables-suffixes)))))
670 jka-compr-compression-info-list--internal) 669 jka-compr-compression-info-list--internal)
671 670
672 (let* ((fnha (cons nil file-name-handler-alist)) 671 (let* ((fnha (cons nil file-name-handler-alist))
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index 03a5fe5b88e..d222dd1011d 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -243,7 +243,7 @@ PROPERTY is set persistent when KEY is a vector."
243 (aset key 3 nil)) 243 (aset key 3 nil))
244 (let ((hash (or (gethash key tramp-cache-data) 244 (let ((hash (or (gethash key tramp-cache-data)
245 (puthash key (make-hash-table :test 'equal) 245 (puthash key (make-hash-table :test 'equal)
246 tramp-cache-data)))) 246 tramp-cache-data))))
247 (puthash property value hash) 247 (puthash property value hash)
248 (setq tramp-cache-data-changed t) 248 (setq tramp-cache-data-changed t)
249 (tramp-message key 7 "%s %s" property value) 249 (tramp-message key 7 "%s %s" property value)
@@ -329,10 +329,15 @@ KEY identifies the connection, it is either a process or a vector."
329 tramp-cache-data-changed 329 tramp-cache-data-changed
330 (stringp tramp-persistency-file-name)) 330 (stringp tramp-persistency-file-name))
331 (let ((cache (copy-hash-table tramp-cache-data))) 331 (let ((cache (copy-hash-table tramp-cache-data)))
332 ;; Remove temporary data. 332 ;; Remove temporary data. If there is the key "login-as", we
333 ;; don't save either, because all other properties might
334 ;; depend on the login name, and we want to give the
335 ;; possibility to use another login name later on.
333 (maphash 336 (maphash
334 (lambda (key value) 337 (lambda (key value)
335 (if (and (vectorp key) (not (tramp-file-name-localname key))) 338 (if (and (vectorp key)
339 (not (tramp-file-name-localname key))
340 (not (gethash "login-as" value)))
336 (progn 341 (progn
337 (remhash "process-name" value) 342 (remhash "process-name" value)
338 (remhash "process-buffer" value) 343 (remhash "process-buffer" value)
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 2478253841f..38e19730a6d 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -380,7 +380,7 @@ detected as prompt when being sent on echoing hosts, therefore.")
380 (tramp-remote-shell "/bin/sh") 380 (tramp-remote-shell "/bin/sh")
381 (tramp-remote-shell-args ("-c")) 381 (tramp-remote-shell-args ("-c"))
382 (tramp-copy-program "pscp") 382 (tramp-copy-program "pscp")
383 (tramp-copy-args (("-P" "%p") ("-scp") ("-p" "%k") 383 (tramp-copy-args (("-l" "%u") ("-P" "%p") ("-scp") ("-p" "%k")
384 ("-q") ("-r"))) 384 ("-q") ("-r")))
385 (tramp-copy-keep-date t) 385 (tramp-copy-keep-date t)
386 (tramp-copy-recursive t) 386 (tramp-copy-recursive t)
@@ -394,7 +394,7 @@ detected as prompt when being sent on echoing hosts, therefore.")
394 (tramp-remote-shell "/bin/sh") 394 (tramp-remote-shell "/bin/sh")
395 (tramp-remote-shell-args ("-c")) 395 (tramp-remote-shell-args ("-c"))
396 (tramp-copy-program "pscp") 396 (tramp-copy-program "pscp")
397 (tramp-copy-args (("-P" "%p") ("-sftp") ("-p" "%k") 397 (tramp-copy-args (("-l" "%u") ("-P" "%p") ("-sftp") ("-p" "%k")
398 ("-q") ("-r"))) 398 ("-q") ("-r")))
399 (tramp-copy-keep-date t) 399 (tramp-copy-keep-date t)
400 (tramp-copy-recursive t) 400 (tramp-copy-recursive t)
@@ -419,13 +419,12 @@ detected as prompt when being sent on echoing hosts, therefore.")
419 `(,(concat "\\`" (regexp-opt '("su" "sudo" "ksu")) "\\'") 419 `(,(concat "\\`" (regexp-opt '("su" "sudo" "ksu")) "\\'")
420 nil "root")) 420 nil "root"))
421;; Do not add "ssh" based methods, otherwise ~/.ssh/config would be ignored. 421;; Do not add "ssh" based methods, otherwise ~/.ssh/config would be ignored.
422;; Do not add "plink" based methods, they ask interactively for the user.
422;;;###tramp-autoload 423;;;###tramp-autoload
423(add-to-list 'tramp-default-user-alist 424(add-to-list 'tramp-default-user-alist
424 `(,(concat 425 `(,(concat
425 "\\`" 426 "\\`"
426 (regexp-opt 427 (regexp-opt '("rcp" "remcp" "rsh" "telnet" "krlogin" "fcp"))
427 '("rcp" "remcp" "rsh" "telnet" "krlogin"
428 "plink" "plink1" "pscp" "psftp" "fcp"))
429 "\\'") 428 "\\'")
430 nil ,(user-login-name))) 429 nil ,(user-login-name)))
431 430
@@ -2281,8 +2280,10 @@ The method used must be an out-of-band method."
2281 ;; Set variables for computing the prompt for reading 2280 ;; Set variables for computing the prompt for reading
2282 ;; password. 2281 ;; password.
2283 (setq tramp-current-method (tramp-file-name-method v) 2282 (setq tramp-current-method (tramp-file-name-method v)
2284 tramp-current-user (tramp-file-name-user v) 2283 tramp-current-user (or (tramp-file-name-user v)
2285 tramp-current-host (tramp-file-name-real-host v)) 2284 (tramp-get-connection-property
2285 v "login-as" nil))
2286 tramp-current-host (tramp-file-name-real-host v))
2286 2287
2287 ;; Expand hops. Might be necessary for gateway methods. 2288 ;; Expand hops. Might be necessary for gateway methods.
2288 (setq v (car (tramp-compute-multi-hops v))) 2289 (setq v (car (tramp-compute-multi-hops v)))
@@ -2309,8 +2310,15 @@ The method used must be an out-of-band method."
2309 (setq port (string-to-number (match-string 2 host)) 2310 (setq port (string-to-number (match-string 2 host))
2310 host (string-to-number (match-string 1 host)))) 2311 host (string-to-number (match-string 1 host))))
2311 2312
2313 ;; Check for user. There might be an interactive setting.
2314 (setq user (or (tramp-file-name-user v)
2315 (tramp-get-connection-property v "login-as" nil)))
2316
2312 ;; Compose copy command. 2317 ;; Compose copy command.
2313 (setq spec (format-spec-make 2318 (setq host (or host "")
2319 user (or user "")
2320 port (or port "")
2321 spec (format-spec-make
2314 ?h host ?u user ?p port 2322 ?h host ?u user ?p port
2315 ?t (tramp-get-connection-property 2323 ?t (tramp-get-connection-property
2316 (tramp-get-connection-process v) "temp-file" "") 2324 (tramp-get-connection-process v) "temp-file" "")
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index afb7ab4312b..f13315bc662 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -460,6 +460,12 @@ usually suffice.")
460 "Regexp which matches `tramp-echo-mark' as it gets echoed by 460 "Regexp which matches `tramp-echo-mark' as it gets echoed by
461the remote shell.") 461the remote shell.")
462 462
463(defcustom tramp-local-end-of-line
464 (if (memq system-type '(windows-nt)) "\r\n" "\n")
465 "*String used for end of line in local processes."
466 :group 'tramp
467 :type 'string)
468
463(defcustom tramp-rsh-end-of-line "\n" 469(defcustom tramp-rsh-end-of-line "\n"
464 "*String used for end of line in rsh connections. 470 "*String used for end of line in rsh connections.
465I don't think this ever needs to be changed, so please tell me about it 471I don't think this ever needs to be changed, so please tell me about it
@@ -1902,7 +1908,7 @@ Falls back to normal file name handler if no Tramp file name handler exists."
1902 ;; operations shall return at least a default value 1908 ;; operations shall return at least a default value
1903 ;; in order to give the user a chance to correct the 1909 ;; in order to give the user a chance to correct the
1904 ;; file name in the minibuffer. 1910 ;; file name in the minibuffer.
1905 ;; We cannot use 'debug as error handler. In order 1911 ;; We cannot use `debug' as error handler. In order
1906 ;; to get a full backtrace, one could apply 1912 ;; to get a full backtrace, one could apply
1907 ;; (setq debug-on-error t debug-on-signal t) 1913 ;; (setq debug-on-error t debug-on-signal t)
1908 (error 1914 (error
@@ -3109,14 +3115,16 @@ beginning of local filename are not substituted."
3109(defun tramp-action-login (proc vec) 3115(defun tramp-action-login (proc vec)
3110 "Send the login name." 3116 "Send the login name."
3111 (when (not (stringp tramp-current-user)) 3117 (when (not (stringp tramp-current-user))
3112 (save-window-excursion 3118 (setq tramp-current-user
3113 (let ((enable-recursive-minibuffers t)) 3119 (with-connection-property vec "login-as"
3114 (pop-to-buffer (tramp-get-connection-buffer vec)) 3120 (save-window-excursion
3115 (setq tramp-current-user (read-string (match-string 0)))))) 3121 (let ((enable-recursive-minibuffers t))
3116 (tramp-message vec 3 "Sending login name `%s'" tramp-current-user) 3122 (pop-to-buffer (tramp-get-connection-buffer vec))
3123 (read-string (match-string 0)))))))
3117 (with-current-buffer (tramp-get-connection-buffer vec) 3124 (with-current-buffer (tramp-get-connection-buffer vec)
3118 (tramp-message vec 6 "\n%s" (buffer-string))) 3125 (tramp-message vec 6 "\n%s" (buffer-string)))
3119 (tramp-send-string vec tramp-current-user)) 3126 (tramp-message vec 3 "Sending login name `%s'" tramp-current-user)
3127 (tramp-send-string vec (concat tramp-current-user tramp-local-end-of-line)))
3120 3128
3121(defun tramp-action-password (proc vec) 3129(defun tramp-action-password (proc vec)
3122 "Query the user for a password." 3130 "Query the user for a password."
@@ -3148,7 +3156,7 @@ See also `tramp-action-yn'."
3148 (throw 'tramp-action 'permission-denied)) 3156 (throw 'tramp-action 'permission-denied))
3149 (with-current-buffer (tramp-get-connection-buffer vec) 3157 (with-current-buffer (tramp-get-connection-buffer vec)
3150 (tramp-message vec 6 "\n%s" (buffer-string))) 3158 (tramp-message vec 6 "\n%s" (buffer-string)))
3151 (tramp-send-string vec "yes")))) 3159 (tramp-send-string vec (concat "yes" tramp-local-end-of-line)))))
3152 3160
3153(defun tramp-action-yn (proc vec) 3161(defun tramp-action-yn (proc vec)
3154 "Ask the user for confirmation using `y-or-n-p'. 3162 "Ask the user for confirmation using `y-or-n-p'.
@@ -3162,7 +3170,7 @@ See also `tramp-action-yesno'."
3162 (throw 'tramp-action 'permission-denied)) 3170 (throw 'tramp-action 'permission-denied))
3163 (with-current-buffer (tramp-get-connection-buffer vec) 3171 (with-current-buffer (tramp-get-connection-buffer vec)
3164 (tramp-message vec 6 "\n%s" (buffer-string))) 3172 (tramp-message vec 6 "\n%s" (buffer-string)))
3165 (tramp-send-string vec "y")))) 3173 (tramp-send-string vec (concat "y" tramp-local-end-of-line)))))
3166 3174
3167(defun tramp-action-terminal (proc vec) 3175(defun tramp-action-terminal (proc vec)
3168 "Tell the remote host which terminal type to use. 3176 "Tell the remote host which terminal type to use.
@@ -3170,7 +3178,7 @@ The terminal type can be configured with `tramp-terminal-type'."
3170 (tramp-message vec 5 "Setting `%s' as terminal type." tramp-terminal-type) 3178 (tramp-message vec 5 "Setting `%s' as terminal type." tramp-terminal-type)
3171 (with-current-buffer (tramp-get-connection-buffer vec) 3179 (with-current-buffer (tramp-get-connection-buffer vec)
3172 (tramp-message vec 6 "\n%s" (buffer-string))) 3180 (tramp-message vec 6 "\n%s" (buffer-string)))
3173 (tramp-send-string vec tramp-terminal-type)) 3181 (tramp-send-string vec (concat tramp-terminal-type tramp-local-end-of-line)))
3174 3182
3175(defun tramp-action-process-alive (proc vec) 3183(defun tramp-action-process-alive (proc vec)
3176 "Check, whether a process has finished." 3184 "Check, whether a process has finished."
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el
index 76b9f304164..509bb203f78 100644
--- a/lisp/progmodes/cc-cmds.el
+++ b/lisp/progmodes/cc-cmds.el
@@ -4382,11 +4382,8 @@ Optional prefix ARG means justify paragraph as well."
4382 (let ((fill-paragraph-function 4382 (let ((fill-paragraph-function
4383 ;; Avoid infinite recursion. 4383 ;; Avoid infinite recursion.
4384 (if (not (eq fill-paragraph-function 'c-fill-paragraph)) 4384 (if (not (eq fill-paragraph-function 'c-fill-paragraph))
4385 fill-paragraph-function)) 4385 fill-paragraph-function)))
4386 (start-point (point-marker))) 4386 (c-mask-paragraph t nil 'fill-paragraph arg))
4387 (c-mask-paragraph
4388 t nil (lambda () (fill-region-as-paragraph (point-min) (point-max) arg)))
4389 (goto-char start-point))
4390 ;; Always return t. This has the effect that if filling isn't done 4387 ;; Always return t. This has the effect that if filling isn't done
4391 ;; above, it isn't done at all, and it's therefore effectively 4388 ;; above, it isn't done at all, and it's therefore effectively
4392 ;; disabled in normal code. 4389 ;; disabled in normal code.
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 2e0294341da..25344fe96a7 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -2074,7 +2074,7 @@ comment at the start of cc-engine.el for more info."
2074;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 2074;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2075;; We maintain a simple cache of positions which aren't in a literal, so as to 2075;; We maintain a simple cache of positions which aren't in a literal, so as to
2076;; speed up testing for non-literality. 2076;; speed up testing for non-literality.
2077(defconst c-state-nonlit-pos-interval 10000) 2077(defconst c-state-nonlit-pos-interval 3000)
2078;; The approximate interval between entries in `c-state-nonlit-pos-cache'. 2078;; The approximate interval between entries in `c-state-nonlit-pos-cache'.
2079 2079
2080(defvar c-state-nonlit-pos-cache nil) 2080(defvar c-state-nonlit-pos-cache nil)
@@ -2129,7 +2129,7 @@ comment at the start of cc-engine.el for more info."
2129 (widen) 2129 (widen)
2130 (save-excursion 2130 (save-excursion
2131 (let ((c c-state-nonlit-pos-cache) 2131 (let ((c c-state-nonlit-pos-cache)
2132 pos npos lit) 2132 pos npos lit macro-beg)
2133 ;; Trim the cache to take account of buffer changes. 2133 ;; Trim the cache to take account of buffer changes.
2134 (while (and c (> (car c) c-state-nonlit-pos-cache-limit)) 2134 (while (and c (> (car c) c-state-nonlit-pos-cache-limit))
2135 (setq c (cdr c))) 2135 (setq c (cdr c)))
@@ -2139,16 +2139,32 @@ comment at the start of cc-engine.el for more info."
2139 (setq c (cdr c))) 2139 (setq c (cdr c)))
2140 (setq pos (or (car c) (point-min))) 2140 (setq pos (or (car c) (point-min)))
2141 2141
2142 (while (<= (setq npos (+ pos c-state-nonlit-pos-interval)) 2142 (while
2143 here) 2143 ;; Add an element to `c-state-nonlit-pos-cache' each iteration.
2144 (setq lit (car (cddr (c-state-pp-to-literal pos npos)))) 2144 (and
2145 (setq pos (or (cdr lit) npos)) ; end of literal containing npos. 2145 (<= (setq npos (+ pos c-state-nonlit-pos-interval)) here)
2146 (progn
2147 (setq lit (car (cddr (c-state-pp-to-literal pos npos))))
2148 (cond
2149 ((null lit)
2150 (setq pos npos)
2151 t)
2152 ((<= (cdr lit) here)
2153 (setq pos (cdr lit))
2154 t)
2155 (t
2156 (setq pos (car lit))
2157 nil))))
2158
2146 (goto-char pos) 2159 (goto-char pos)
2147 (when (and (c-beginning-of-macro) (/= (point) pos)) 2160 (when (and (c-beginning-of-macro) (/= (point) pos))
2148 (c-syntactic-end-of-macro) 2161 (setq macro-beg (point))
2149 (or (eobp) (forward-char)) 2162 (c-syntactic-end-of-macro)
2150 (setq pos (point))) 2163 (or (eobp) (forward-char))
2151 (setq c-state-nonlit-pos-cache (cons pos c-state-nonlit-pos-cache))) 2164 (setq pos (if (<= (point) here)
2165 (point)
2166 macro-beg)))
2167 (setq c-state-nonlit-pos-cache (cons pos c-state-nonlit-pos-cache)))
2152 2168
2153 (if (> pos c-state-nonlit-pos-cache-limit) 2169 (if (> pos c-state-nonlit-pos-cache-limit)
2154 (setq c-state-nonlit-pos-cache-limit pos)) 2170 (setq c-state-nonlit-pos-cache-limit pos))
@@ -4351,6 +4367,78 @@ comment at the start of cc-engine.el for more info."
4351 (t 'c))) ; Assuming the range is valid. 4367 (t 'c))) ; Assuming the range is valid.
4352 range)) 4368 range))
4353 4369
4370(defsubst c-determine-limit-get-base (start try-size)
4371 ;; Get a "safe place" approximately TRY-SIZE characters before START.
4372 ;; This doesn't preserve point.
4373 (let* ((pos (max (- start try-size) (point-min)))
4374 (base (c-state-safe-place pos))
4375 (s (parse-partial-sexp base pos)))
4376 (if (or (nth 4 s) (nth 3 s)) ; comment or string
4377 (nth 8 s)
4378 (point))))
4379
4380(defun c-determine-limit (how-far-back &optional start try-size)
4381 ;; Return a buffer position HOW-FAR-BACK non-literal characters from START
4382 ;; (default point). This is done by going back further in the buffer then
4383 ;; searching forward for literals. The position found won't be in a
4384 ;; literal. We start searching for the sought position TRY-SIZE (default
4385 ;; twice HOW-FAR-BACK) bytes back from START. This function must be fast.
4386 ;; :-)
4387 (save-excursion
4388 (let* ((start (or start (point)))
4389 (try-size (or try-size (* 2 how-far-back)))
4390 (base (c-determine-limit-get-base start try-size))
4391 (pos base)
4392
4393 (s (parse-partial-sexp pos pos)) ; null state.
4394 stack elt size
4395 (count 0))
4396 (while (< pos start)
4397 ;; Move forward one literal each time round this loop.
4398 ;; Move forward to the start of a comment or string.
4399 (setq s (parse-partial-sexp
4400 pos
4401 start
4402 nil ; target-depth
4403 nil ; stop-before
4404 s ; state
4405 'syntax-table)) ; stop-comment
4406
4407 ;; Gather details of the non-literal-bit - starting pos and size.
4408 (setq size (- (if (or (nth 4 s) (nth 3 s))
4409 (nth 8 s)
4410 (point))
4411 pos))
4412 (if (> size 0)
4413 (setq stack (cons (cons pos size) stack)))
4414
4415 ;; Move forward to the end of the comment/string.
4416 (if (or (nth 4 s) (nth 3 s))
4417 (setq s (parse-partial-sexp
4418 (point)
4419 start
4420 nil ; target-depth
4421 nil ; stop-before
4422 s ; state
4423 'syntax-table))) ; stop-comment
4424 (setq pos (point)))
4425
4426 ;; Now try and find enough non-literal characters recorded on the stack.
4427 ;; Go back one recorded literal each time round this loop.
4428 (while (and (< count how-far-back)
4429 stack)
4430 (setq elt (car stack)
4431 stack (cdr stack))
4432 (setq count (+ count (cdr elt))))
4433
4434 ;; Have we found enough yet?
4435 (cond
4436 ((>= count how-far-back)
4437 (+ (car elt) (- count how-far-back)))
4438 ((eq base (point-min))
4439 (point-min))
4440 (t
4441 (c-determine-limit (- how-far-back count) base try-size))))))
4354 4442
4355;; `c-find-decl-spots' and accompanying stuff. 4443;; `c-find-decl-spots' and accompanying stuff.
4356 4444
@@ -4487,13 +4575,14 @@ comment at the start of cc-engine.el for more info."
4487 ;; Call CFD-FUN for each possible spot for a declaration, cast or 4575 ;; Call CFD-FUN for each possible spot for a declaration, cast or
4488 ;; label from the point to CFD-LIMIT. 4576 ;; label from the point to CFD-LIMIT.
4489 ;; 4577 ;;
4490 ;; CFD-FUN is called with point at the start of the spot. It's 4578 ;; CFD-FUN is called with point at the start of the spot. It's passed two
4491 ;; passed two arguments: The first is the end position of the token 4579 ;; arguments: The first is the end position of the token preceding the spot,
4492 ;; preceding the spot, or 0 for the implicit match at bob. The 4580 ;; or 0 for the implicit match at bob. The second is a flag that is t when
4493 ;; second is a flag that is t when the match is inside a macro. If 4581 ;; the match is inside a macro. Point should be moved forward by at least
4494 ;; CFD-FUN adds `c-decl-end' properties somewhere below the current 4582 ;; one token.
4495 ;; spot, it should return non-nil to ensure that the next search 4583 ;;
4496 ;; will find them. 4584 ;; If CFD-FUN adds `c-decl-end' properties somewhere below the current spot,
4585 ;; it should return non-nil to ensure that the next search will find them.
4497 ;; 4586 ;;
4498 ;; Such a spot is: 4587 ;; Such a spot is:
4499 ;; o The first token after bob. 4588 ;; o The first token after bob.
@@ -4867,7 +4956,8 @@ comment at the start of cc-engine.el for more info."
4867 (goto-char cfd-continue-pos) 4956 (goto-char cfd-continue-pos)
4868 (if (= cfd-continue-pos cfd-limit) 4957 (if (= cfd-continue-pos cfd-limit)
4869 (setq cfd-match-pos cfd-limit) 4958 (setq cfd-match-pos cfd-limit)
4870 (c-find-decl-prefix-search))))) 4959 (c-find-decl-prefix-search))))) ; Moves point, sets cfd-continue-pos,
4960 ; cfd-match-pos, etc.
4871 4961
4872 4962
4873;; A cache for found types. 4963;; A cache for found types.
@@ -8047,6 +8137,23 @@ comment at the start of cc-engine.el for more info."
8047 next-open-brace (c-pull-open-brace paren-state))) 8137 next-open-brace (c-pull-open-brace paren-state)))
8048 open-brace)) 8138 open-brace))
8049 8139
8140(defun c-cheap-inside-bracelist-p (paren-state)
8141 ;; Return the position of the L-brace if point is inside a brace list
8142 ;; initialization of an array, etc. This is an approximate function,
8143 ;; designed for speed over accuracy. It will not find every bracelist, but
8144 ;; a non-nil result is reliable. We simply search for "= {" (naturally with
8145 ;; syntactic whitespace allowed). PAREN-STATE is the normal thing that it
8146 ;; is everywhere else.
8147 (let (b-pos)
8148 (save-excursion
8149 (while
8150 (and (setq b-pos (c-pull-open-brace paren-state))
8151 (progn (goto-char b-pos)
8152 (c-backward-sws)
8153 (c-backward-token-2)
8154 (not (looking-at "=")))))
8155 b-pos)))
8156
8050(defun c-inside-bracelist-p (containing-sexp paren-state) 8157(defun c-inside-bracelist-p (containing-sexp paren-state)
8051 ;; return the buffer position of the beginning of the brace list 8158 ;; return the buffer position of the beginning of the brace list
8052 ;; statement if we're inside a brace list, otherwise return nil. 8159 ;; statement if we're inside a brace list, otherwise return nil.
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index e7d00815708..2d116e1ecdc 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -446,10 +446,12 @@
446 ;; `parse-sexp-lookup-properties' (when it exists). 446 ;; `parse-sexp-lookup-properties' (when it exists).
447 (parse-sexp-lookup-properties 447 (parse-sexp-lookup-properties
448 (cc-eval-when-compile 448 (cc-eval-when-compile
449 (boundp 'parse-sexp-lookup-properties)))) 449 (boundp 'parse-sexp-lookup-properties)))
450 (BOD-limit
451 (c-determine-limit 1000)))
450 (goto-char 452 (goto-char
451 (let ((here (point))) 453 (let ((here (point)))
452 (if (eq (car (c-beginning-of-decl-1)) 'same) 454 (if (eq (car (c-beginning-of-decl-1 BOD-limit)) 'same)
453 (point) 455 (point)
454 here))) 456 here)))
455 ,(c-make-font-lock-search-form regexp highlights)) 457 ,(c-make-font-lock-search-form regexp highlights))
@@ -1240,6 +1242,7 @@ casts and declarations are fontified. Used on level 2 and higher."
1240 ;; it finds any. That's necessary so that we later will 1242 ;; it finds any. That's necessary so that we later will
1241 ;; stop inside them to fontify types there. 1243 ;; stop inside them to fontify types there.
1242 (c-parse-and-markup-<>-arglists t) 1244 (c-parse-and-markup-<>-arglists t)
1245 lbrace ; position of some {.
1243 ;; The font-lock package in Emacs is known to clobber 1246 ;; The font-lock package in Emacs is known to clobber
1244 ;; `parse-sexp-lookup-properties' (when it exists). 1247 ;; `parse-sexp-lookup-properties' (when it exists).
1245 (parse-sexp-lookup-properties 1248 (parse-sexp-lookup-properties
@@ -1351,7 +1354,6 @@ casts and declarations are fontified. Used on level 2 and higher."
1351 (or (looking-at c-typedef-key) 1354 (or (looking-at c-typedef-key)
1352 (goto-char start-pos))) 1355 (goto-char start-pos)))
1353 1356
1354 ;; Now analyze the construct.
1355 ;; In QT, "more" is an irritating keyword that expands to nothing. 1357 ;; In QT, "more" is an irritating keyword that expands to nothing.
1356 ;; We skip over it to prevent recognition of "more slots: <symbol>" 1358 ;; We skip over it to prevent recognition of "more slots: <symbol>"
1357 ;; as a bitfield declaration. 1359 ;; as a bitfield declaration.
@@ -1360,6 +1362,8 @@ casts and declarations are fontified. Used on level 2 and higher."
1360 (concat "\\(more\\)\\([^" c-symbol-chars "]\\|$\\)"))) 1362 (concat "\\(more\\)\\([^" c-symbol-chars "]\\|$\\)")))
1361 (goto-char (match-end 1)) 1363 (goto-char (match-end 1))
1362 (c-forward-syntactic-ws)) 1364 (c-forward-syntactic-ws))
1365
1366 ;; Now analyze the construct.
1363 (setq decl-or-cast (c-forward-decl-or-cast-1 1367 (setq decl-or-cast (c-forward-decl-or-cast-1
1364 match-pos context last-cast-end)) 1368 match-pos context last-cast-end))
1365 1369
@@ -1428,6 +1432,39 @@ casts and declarations are fontified. Used on level 2 and higher."
1428 (c-fontify-recorded-types-and-refs) 1432 (c-fontify-recorded-types-and-refs)
1429 nil) 1433 nil)
1430 1434
1435 ;; Restore point, since at this point in the code it has been
1436 ;; left undefined by c-forward-decl-or-cast-1 above.
1437 ((progn (goto-char start-pos) nil))
1438
1439 ;; If point is inside a bracelist, there's no point checking it
1440 ;; being at a declarator.
1441 ((let ((paren-state (c-parse-state)))
1442 (setq lbrace (c-cheap-inside-bracelist-p paren-state)))
1443 ;; Move past this bracelist to prevent an endless loop.
1444 (goto-char lbrace)
1445 (unless (c-safe (progn (forward-list) t))
1446 (goto-char start-pos)
1447 (c-forward-token-2))
1448 nil)
1449
1450 ;; If point is just after a ")" which is followed by an
1451 ;; identifier which isn't a label, or at the matching "(", we're
1452 ;; at either a macro invocation, a cast, or a
1453 ;; for/while/etc. statement. The cast case is handled above.
1454 ;; None of these cases can contain a declarator.
1455 ((or (and (eq (char-before match-pos) ?\))
1456 (c-on-identifier)
1457 (save-excursion (not (c-forward-label))))
1458 (and (eq (char-after) ?\()
1459 (save-excursion
1460 (and
1461 (progn (c-backward-token-2) (c-on-identifier))
1462 (save-excursion (not (c-forward-label)))
1463 (progn (c-backward-token-2)
1464 (eq (char-after) ?\())))))
1465 (c-forward-token-2) ; Must prevent looping.
1466 nil)
1467
1431 ((and (not c-enums-contain-decls) 1468 ((and (not c-enums-contain-decls)
1432 ;; An optimization quickly to eliminate scans of long enum 1469 ;; An optimization quickly to eliminate scans of long enum
1433 ;; declarations in the next cond arm. 1470 ;; declarations in the next cond arm.
@@ -1441,13 +1478,14 @@ casts and declarations are fontified. Used on level 2 and higher."
1441 (progn 1478 (progn
1442 (c-backward-token-2) 1479 (c-backward-token-2)
1443 (looking-at c-brace-list-key))))))) 1480 (looking-at c-brace-list-key)))))))
1444 t) 1481 (c-forward-token-2)
1482 nil)
1445 1483
1446 (t 1484 (t
1447 ;; Are we at a declarator? Try to go back to the declaration 1485 ;; Are we at a declarator? Try to go back to the declaration
1448 ;; to check this. If we get there, check whether a "typedef" 1486 ;; to check this. If we get there, check whether a "typedef"
1449 ;; is there, then fontify the declarators accordingly. 1487 ;; is there, then fontify the declarators accordingly.
1450 (let ((decl-search-lim (max (- (point) 50000) (point-min))) 1488 (let ((decl-search-lim (c-determine-limit 1000))
1451 paren-state bod-res encl-pos is-typedef 1489 paren-state bod-res encl-pos is-typedef
1452 c-recognize-knr-p) ; Strictly speaking, bogus, but it 1490 c-recognize-knr-p) ; Strictly speaking, bogus, but it
1453 ; speeds up lisp.h tremendously. 1491 ; speeds up lisp.h tremendously.
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index b74d878516d..0c86b68f1d9 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -490,6 +490,7 @@ that requires a literal mode spec at compile time."
490 (make-local-variable 'paragraph-ignore-fill-prefix) 490 (make-local-variable 'paragraph-ignore-fill-prefix)
491 (make-local-variable 'adaptive-fill-mode) 491 (make-local-variable 'adaptive-fill-mode)
492 (make-local-variable 'adaptive-fill-regexp) 492 (make-local-variable 'adaptive-fill-regexp)
493 (make-local-variable 'fill-paragraph-handle-comment)
493 494
494 ;; now set their values 495 ;; now set their values
495 (set (make-local-variable 'parse-sexp-ignore-comments) t) 496 (set (make-local-variable 'parse-sexp-ignore-comments) t)
@@ -500,6 +501,9 @@ that requires a literal mode spec at compile time."
500 (set (make-local-variable 'comment-line-break-function) 501 (set (make-local-variable 'comment-line-break-function)
501 'c-indent-new-comment-line) 502 'c-indent-new-comment-line)
502 503
504 ;; For the benefit of adaptive file, which otherwise mis-fills.
505 (setq fill-paragraph-handle-comment nil)
506
503 ;; Install `c-fill-paragraph' on `fill-paragraph-function' so that a 507 ;; Install `c-fill-paragraph' on `fill-paragraph-function' so that a
504 ;; direct call to `fill-paragraph' behaves better. This still 508 ;; direct call to `fill-paragraph' behaves better. This still
505 ;; doesn't work with filladapt but it's better than nothing. 509 ;; doesn't work with filladapt but it's better than nothing.
diff --git a/lisp/subr.el b/lisp/subr.el
index 14f9192405c..c9e213c86a0 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1857,12 +1857,30 @@ FILE should be the name of a library, with no directory name."
1857 1857
1858(defun display-delayed-warnings () 1858(defun display-delayed-warnings ()
1859 "Display delayed warnings from `delayed-warnings-list'. 1859 "Display delayed warnings from `delayed-warnings-list'.
1860This is the default value of `delayed-warnings-hook'." 1860Used from `delayed-warnings-hook' (which see)."
1861 (dolist (warning (nreverse delayed-warnings-list)) 1861 (dolist (warning (nreverse delayed-warnings-list))
1862 (apply 'display-warning warning)) 1862 (apply 'display-warning warning))
1863 (setq delayed-warnings-list nil)) 1863 (setq delayed-warnings-list nil))
1864 1864
1865(defvar delayed-warnings-hook '(display-delayed-warnings) 1865(defun collapse-delayed-warnings ()
1866 "Remove duplicates from `delayed-warnings-list'.
1867Collapse identical adjacent warnings into one (plus count).
1868Used from `delayed-warnings-hook' (which see)."
1869 (let ((count 1)
1870 collapsed warning)
1871 (while delayed-warnings-list
1872 (setq warning (pop delayed-warnings-list))
1873 (if (equal warning (car delayed-warnings-list))
1874 (setq count (1+ count))
1875 (when (> count 1)
1876 (setcdr warning (cons (format "%s [%d times]" (cadr warning) count)
1877 (cddr warning)))
1878 (setq count 1))
1879 (push warning collapsed)))
1880 (setq delayed-warnings-list (nreverse collapsed))))
1881
1882(defvar delayed-warnings-hook '(collapse-delayed-warnings
1883 display-delayed-warnings)
1866 "Normal hook run to process delayed warnings. 1884 "Normal hook run to process delayed warnings.
1867Functions in this hook should access the `delayed-warnings-list' 1885Functions in this hook should access the `delayed-warnings-list'
1868variable (which see) and remove from it the warnings they process.") 1886variable (which see) and remove from it the warnings they process.")
diff --git a/lisp/vc/pcvs.el b/lisp/vc/pcvs.el
index 1066ebc7f81..9ba65cda143 100644
--- a/lisp/vc/pcvs.el
+++ b/lisp/vc/pcvs.el
@@ -31,19 +31,19 @@
31 31
32;;; Commentary: 32;;; Commentary:
33 33
34;; PCL-CVS is a front-end to the CVS version control system. For people 34;; PCL-CVS is a front-end to the CVS version control system.
35;; familiar with VC, it is somewhat like VC-dired: it presents the status of 35;; It presents the status of all the files in your working area and
36;; all the files in your working area and allows you to commit/update several 36;; allows you to commit/update several of them at a time.
37;; of them at a time. Compared to VC-dired, it is considerably better and 37;; Compare with the general Emacs utility vc-dir, which tries
38;; faster (but only for CVS). 38;; to be VCS-agnostic. You may find PCL-CVS better/faster for CVS.
39 39
40;; PCL-CVS was originally written by Per Cederqvist many years ago. This 40;; PCL-CVS was originally written by Per Cederqvist many years ago. This
41;; version derives from the XEmacs-21 version, itself based on the 2.0b2 41;; version derives from the XEmacs-21 version, itself based on the 2.0b2
42;; version (last release from Per). It is a thorough rework. 42;; version (last release from Per). It is a thorough rework.
43 43
44;; Contrary to what you'd expect, PCL-CVS is not a replacement for VC but only 44;; PCL-CVS is not a replacement for VC, but adds extra functionality.
45;; for VC-dired. As such, I've tried to make PCL-CVS and VC interoperate 45;; As such, I've tried to make PCL-CVS and VC interoperate seamlessly
46;; seamlessly (I also use VC). 46;; (I also use VC).
47 47
48;; To use PCL-CVS just use `M-x cvs-examine RET <dir> RET'. 48;; To use PCL-CVS just use `M-x cvs-examine RET <dir> RET'.
49;; There is a TeXinfo manual, which can be helpful to get started. 49;; There is a TeXinfo manual, which can be helpful to get started.
diff --git a/lisp/vc/vc-dav.el b/lisp/vc/vc-dav.el
index 6f9a6d6b7df..9d55e9c7b43 100644
--- a/lisp/vc/vc-dav.el
+++ b/lisp/vc/vc-dav.el
@@ -170,10 +170,7 @@ It should return a status of either 0 (no differences found), or
170;; Return a dav-specific mode line string for URL. Are there any 170;; Return a dav-specific mode line string for URL. Are there any
171;; specific states that we want exposed? 171;; specific states that we want exposed?
172;; 172;;
173;; vc-dav-dired-state-info(url) 173;; vc-dir support
174;; Translate the `vc-state' property of URL into a string that can
175;; be used in a vc-dired buffer. Are there any extra states that
176;; we want exposed?
177;; 174;;
178;; vc-dav-receive-file(url rev) 175;; vc-dav-receive-file(url rev)
179;; Let this backend `receive' a file that is already registered 176;; Let this backend `receive' a file that is already registered
diff --git a/lisp/windmove.el b/lisp/windmove.el
index 10a564419fb..0523530869b 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -417,17 +417,17 @@ supplied, if ARG is greater or smaller than zero, respectively."
417 (- (nth 3 edges) 1)))) 417 (- (nth 3 edges) 1))))
418 (cond 418 (cond
419 ((> effective-arg 0) 419 ((> effective-arg 0)
420 top-left) 420 top-left)
421 ((< effective-arg 0) 421 ((< effective-arg 0)
422 bottom-right) 422 bottom-right)
423 ((= effective-arg 0) 423 ((= effective-arg 0)
424 (windmove-coord-add 424 (windmove-coord-add
425 top-left 425 top-left
426 (let ((col-row 426 ;; Don't care whether window is horizontally scrolled -
427 (posn-col-row 427 ;; `posn-at-point' handles that already. See also:
428 (posn-at-point (window-point window) window)))) 428 ;; http://lists.gnu.org/archive/html/emacs-devel/2012-01/msg00638.html
429 (cons (- (car col-row) (window-hscroll window)) 429 (posn-col-row
430 (cdr col-row))))))))) 430 (posn-at-point (window-point window) window))))))))
431 431
432;; This uses the reference location in the current window (calculated 432;; This uses the reference location in the current window (calculated
433;; by `windmove-reference-loc' above) to find a reference location 433;; by `windmove-reference-loc' above) to find a reference location
diff --git a/lisp/window.el b/lisp/window.el
index 54e5ec9c74c..9122904b0bb 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -3568,7 +3568,7 @@ specific buffers."
3568 )) 3568 ))
3569 3569
3570;;; Window states, how to get them and how to put them in a window. 3570;;; Window states, how to get them and how to put them in a window.
3571(defun window--state-get-1 (window &optional ignore) 3571(defun window--state-get-1 (window &optional writable)
3572 "Helper function for `window-state-get'." 3572 "Helper function for `window-state-get'."
3573 (let* ((type 3573 (let* ((type
3574 (cond 3574 (cond
@@ -3585,29 +3585,22 @@ specific buffers."
3585 (normal-height . ,(window-normal-size window)) 3585 (normal-height . ,(window-normal-size window))
3586 (normal-width . ,(window-normal-size window t)) 3586 (normal-width . ,(window-normal-size window t))
3587 (combination-limit . ,(window-combination-limit window)) 3587 (combination-limit . ,(window-combination-limit window))
3588 ,@(let (list) 3588 ,@(let ((parameters (window-parameters window))
3589 ;; Make copies of persistent window parameters whose cdr 3589 list)
3590 ;; is either t or, when IGNORE is non-nil, is either nil 3590 ;; Make copies of those window parameters whose
3591 ;; or `state'. 3591 ;; persistence property is `writable' if WRITABLE is
3592 (dolist (pers window-persistent-parameters) 3592 ;; non-nil and non-nil if WRITABLE is nil.
3593 (when (and (consp pers) 3593 (dolist (par parameters)
3594 (or (eq (cdr pers) t) 3594 (let ((pers (cdr (assq (car par)
3595 (and (memq (cdr pers) '(state nil)) 3595 window-persistent-parameters))))
3596 (not ignore)))) 3596 (when (and pers (or (not writable) (eq pers 'writable)))
3597 (let ((par (assq (car pers) (window-parameters window)))) 3597 (setq list (cons (cons (car par) (cdr par)) list)))))
3598 (setq list (cons (cons (car pers) (when par (cdr par))) 3598 ;; Add `clone-of' parameter if necessary.
3599 list))))) 3599 (let ((pers (cdr (assq 'clone-of
3600 ;; Save `clone-of' parameter unless IGNORE or 3600 window-persistent-parameters))))
3601 ;; `window-persistent-parameters' prevail. 3601 (when (and pers (or (not writable) (eq pers 'writable))
3602 (when (and (not (assq 'clone-of (window-parameters window))) 3602 (not (assq 'clone-of list)))
3603 (let ((clone-of 3603 (setq list (cons (cons 'clone-of window) list))))
3604 (assq 'clone-of
3605 window-persistent-parameters)))
3606 (when clone-of
3607 (if ignore
3608 (eq (cdr clone-of) t)
3609 (memq (cdr clone-of) '(state nil))))))
3610 (setq list (cons (cons 'clone-of window) list)))
3611 (when list 3604 (when list
3612 `((parameters . ,list)))) 3605 `((parameters . ,list))))
3613 ,@(when buffer 3606 ,@(when buffer
@@ -3628,31 +3621,34 @@ specific buffers."
3628 (scroll-bars . ,(window-scroll-bars window)) 3621 (scroll-bars . ,(window-scroll-bars window))
3629 (vscroll . ,(window-vscroll window)) 3622 (vscroll . ,(window-vscroll window))
3630 (dedicated . ,(window-dedicated-p window)) 3623 (dedicated . ,(window-dedicated-p window))
3631 (point . ,(if ignore point (copy-marker point))) 3624 (point . ,(if writable point (copy-marker point)))
3632 (start . ,(if ignore start (copy-marker start))) 3625 (start . ,(if writable start (copy-marker start)))
3633 ,@(when mark 3626 ,@(when mark
3634 `((mark . ,(if ignore 3627 `((mark . ,(if writable
3635 mark (copy-marker mark)))))))))))) 3628 mark (copy-marker mark))))))))))))
3636 (tail 3629 (tail
3637 (when (memq type '(vc hc)) 3630 (when (memq type '(vc hc))
3638 (let (list) 3631 (let (list)
3639 (setq window (window-child window)) 3632 (setq window (window-child window))
3640 (while window 3633 (while window
3641 (setq list (cons (window--state-get-1 window ignore) list)) 3634 (setq list (cons (window--state-get-1 window writable) list))
3642 (setq window (window-right window))) 3635 (setq window (window-right window)))
3643 (nreverse list))))) 3636 (nreverse list)))))
3644 (append head tail))) 3637 (append head tail)))
3645 3638
3646(defun window-state-get (&optional window ignore) 3639(defun window-state-get (&optional window writable)
3647 "Return state of WINDOW as a Lisp object. 3640 "Return state of WINDOW as a Lisp object.
3648WINDOW can be any window and defaults to the root window of the 3641WINDOW can be any window and defaults to the root window of the
3649selected frame. 3642selected frame.
3650 3643
3651Optional argument IGNORE non-nil means do not use markers for 3644Optional argument WRITABLE non-nil means do not use markers for
3652sampling positions like `window-point' or `window-start' and do 3645sampling `window-point' and `window-start'. Together, WRITABLE
3653not record parameters unless `window-persistent-parameters' 3646and the variable `window-persistent-parameters' specify which
3654requests it. IGNORE should be non-nil when the return value 3647window parameters are saved by this function. WRITABLE should be
3655shall be written to a file and read back in another session. 3648non-nil when the return value shall be written to a file and read
3649back in another session. Otherwise, an application may run into
3650an `invalid-read-syntax' error while attempting to read back the
3651value from file.
3656 3652
3657The return value can be used as argument for `window-state-put' 3653The return value can be used as argument for `window-state-put'
3658to put the state recorded here into an arbitrary window. The 3654to put the state recorded here into an arbitrary window. The
@@ -3678,7 +3674,7 @@ value can be also stored on disk and read back in a new session."
3678 ;; These are probably not needed. 3674 ;; These are probably not needed.
3679 ,@(when (window-size-fixed-p window) `((fixed-height . t))) 3675 ,@(when (window-size-fixed-p window) `((fixed-height . t)))
3680 ,@(when (window-size-fixed-p window t) `((fixed-width . t)))) 3676 ,@(when (window-size-fixed-p window t) `((fixed-width . t))))
3681 (window--state-get-1 window ignore))) 3677 (window--state-get-1 window writable)))
3682 3678
3683(defvar window-state-put-list nil 3679(defvar window-state-put-list nil
3684 "Helper variable for `window-state-put'.") 3680 "Helper variable for `window-state-put'.")
@@ -3757,15 +3753,13 @@ value can be also stored on disk and read back in a new session."
3757 (state (cdr (assq 'buffer item)))) 3753 (state (cdr (assq 'buffer item))))
3758 (when combination-limit 3754 (when combination-limit
3759 (set-window-combination-limit window combination-limit)) 3755 (set-window-combination-limit window combination-limit))
3760 ;; Assign saved window parameters. If a parameter's value is nil, 3756 ;; Reset window's parameters and assign saved ones (we might want
3761 ;; don't assign it unless the new window has it set already (which 3757 ;; a `remove-window-parameters' function here).
3762 ;; shouldn't happen unless some `window-configuration-change-hook' 3758 (dolist (parameter (window-parameters window))
3763 ;; function installed it). 3759 (set-window-parameter window (car parameter) nil))
3764 (when parameters 3760 (when parameters
3765 (dolist (parameter parameters) 3761 (dolist (parameter parameters)
3766 (when (or (cdr parameter) 3762 (set-window-parameter window (car parameter) (cdr parameter))))
3767 (window-parameter window (car parameter)))
3768 (set-window-parameter window (car parameter) (cdr parameter)))))
3769 ;; Process buffer related state. 3763 ;; Process buffer related state.
3770 (when state 3764 (when state
3771 ;; We don't want to raise an error here so we create a buffer if 3765 ;; We don't want to raise an error here so we create a buffer if