summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
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.el307
-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, 713 insertions, 267 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2813d80d9ff..97281db4c7c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,136 @@
+2012-01-23 Mike Lamb <mrlamb@gmail.com> (tiny change)
+
+ * eshell/esh-util.el (eshell-read-hosts-file):
+ Skip comment lines. (Bug#10549)
+
+ * eshell/em-unix.el (pcomplete/ssh): Remove. (Bug#10548)
+
+2012-01-23 Juanma Barranquero <lekktu@gmail.com>
+
+ * subr.el (display-delayed-warnings): Doc fix.
+ (collapse-delayed-warnings): New function to collapse identical
+ adjacent warnings.
+ (delayed-warnings-hook): Add it.
+
+2012-01-22 Michael Albinus <michael.albinus@gmx.de>
+
+ * net/tramp.el (tramp-action-login): Set connection property "login-as".
+
+ * net/tramp-cache.el (tramp-dump-connection-properties): Do not dump
+ properties, when "login-as" is set.
+
+ * net/tramp-sh.el (tramp-methods): Add user spec to "pscp" and "psftp".
+ (tramp-default-user-alist): Don't add "pscp".
+ (tramp-do-copy-or-rename-file-out-of-band): Use connection
+ property "login-as", if set. (Bug#10530)
+
+2012-01-21 Michael Albinus <michael.albinus@gmx.de>
+
+ * net/tramp-sh.el (tramp-default-user-alist): Don't add "plink",
+ "plink1" and "psftp". (Bug#10530)
+
+2012-01-21 Kenichi Handa <handa@m17n.org>
+
+ * international/mule-cmds.el (prefer-coding-system): Show a
+ warning message if the default value of file-name-coding-system
+ was not changed.
+
+2012-01-21 Jérémy Compostella <jeremy.compostella@gmail.com>
+
+ * windmove.el (windmove-reference-loc): Fix
+ windmove-reference-loc miscalculation.
+
+2012-01-21 Jay Belanger <jay.p.belanger@gmail.com>
+
+ * calc/calc-units.el (math-put-default-units): Don't use "1" as a
+ default unit.
+
+2012-01-21 Glenn Morris <rgm@gnu.org>
+
+ * international/mule.el (auto-coding-alist): Add .tbz.
+
+ * files.el (local-enable-local-variables): Doc fix.
+ (inhibit-local-variables-regexps): Rename from
+ inhibit-first-line-modes-regexps. Keep old name as obsolete alias.
+ Doc fix. Add some extensions from auto-coding-alist.
+ (inhibit-local-variables-suffixes):
+ Rename from inhibit-first-line-modes-suffixes. Doc fix.
+ (inhibit-local-variables-p):
+ New function, extracted from set-auto-mode-1.
+ (set-auto-mode): Doc fix. Respect inhibit-local-variables-regexps.
+ (set-auto-mode-1): Doc fix. Use inhibit-local-variables-p.
+ (hack-local-variables): Doc fix. Make the mode-only case
+ respect enable-local-variables and friends.
+ Respect inhibit-local-variables-regexps for file-locals, but
+ not for directory-locals.
+ (set-visited-file-name):
+ Take account of inhibit-local-variables-regexps.
+ Whether it applies may change as the file name is changed.
+ * jka-cmpr-hook.el (jka-compr-install):
+ * jka-compr.el (jka-compr-uninstall):
+ Update for inhibit-first-line-modes-suffixes name change.
+
+2012-01-20 Martin Rudalics <rudalics@gmx.at>
+
+ * help-macro.el (make-help-screen): Temporarily restore original
+ binding for minor-mode-map-alist (Bug#10454).
+
+2012-01-19 Julien Danjou <julien@danjou.info>
+
+ * color.el (color-name-to-rgb): Use the white color to find the max
+ color component value and return correctly computed values.
+ (color-name-to-rgb): Add missing float conversion for max value.
+
+2012-01-19 Martin Rudalics <rudalics@gmx.at>
+
+ * window.el (window--state-get-1, window-state-get): Do not use
+ special state value for window-persistent-parameters. Rename
+ argument IGNORE to WRITABLE. Rewrite doc-string.
+ (window--state-put-2): Reset all window parameters to nil before
+ assigning values of persistent parameters.
+
+2012-01-18 Alan Mackenzie <acm@muc.de>
+
+ Eliminate sluggishness and hangs in fontification of "semicolon
+ deserts".
+
+ * progmodes/cc-engine.el (c-state-nonlit-pos-interval): change
+ value 10000 -> 3000.
+ (c-state-safe-place): Reformulate so it doesn't stack up an
+ infinite number of wrong entries in c-state-nonlit-pos-cache.
+ (c-determine-limit-get-base, c-determine-limit): New functions to
+ determine backward search limits disregarding literals.
+ (c-find-decl-spots): Amend commenting.
+ (c-cheap-inside-bracelist-p): New function which detects "={".
+
+ * progmodes/cc-fonts.el
+ (c-make-font-lock-BO-decl-search-function): Give a limit to a
+ backward search.
+ (c-font-lock-declarations): Fix an occurrence of point being
+ undefined. Check additionally for point being in a bracelist or
+ near a macro invocation without a semicolon so as to avoid a
+ fruitless time consuming search for a declarator. Give a more
+ precise search limit for declarators using the new
+ c-determine-limit.
+
+2012-01-18 Glenn Morris <rgm@gnu.org>
+
+ * files.el (auto-mode-alist, inhibit-first-line-modes-regexps)
+ (set-auto-mode): Doc fixes.
+
+2012-01-17 Glenn Morris <rgm@gnu.org>
+
+ * isearch.el (search-nonincremental-instead): Fix doc typo.
+
+ * dired.el (dired-insert-directory): Handle newlines in directory name.
+ (dired-build-subdir-alist): Unescape newlines in directory name.
+
+2012-01-17 Michael Albinus <michael.albinus@gmx.de>
+
+ * net/tramp.el (tramp-local-end-of-line): New defcustom.
+ (tramp-action-login, tramp-action-yesno, tramp-action-yn)
+ (tramp-action-terminal): Use it. (Bug#10530)
+
2012-01-16 Stefan Monnier <monnier@iro.umontreal.ca>
* minibuffer.el (completion--replace): Strip properties (bug#10062).
@@ -34,6 +167,17 @@
* dired.el (dired-get-filename): Fix 'verbatim case of previous change.
+2012-01-13 Alan Mackenzie <acm@muc.de>
+
+ Fix filling for when filladapt mode is enabled.
+
+ * progmodes/cc-cmds.el (c-fill-paragraph): In the invocation of
+ c-mask-paragraph, pass in `fill-paragraph' rather than
+ `fill-region-as-paragraph'. (This is a reversion of a previous
+ change.)
+ * progmodes/cc-mode.el (c-basic-common-init): Make
+ fill-paragraph-handle-comment buffer local and set it to nil.
+
2012-01-13 Glenn Morris <rgm@gnu.org>
* 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."
(defun math-put-default-units (expr)
"Put the units in EXPR in the default units table."
- (let* ((units (math-get-units expr))
- (standard-units (math-get-standard-units expr))
+ (let ((units (math-get-units expr)))
+ (unless (eq units 1)
+ (let* ((standard-units (math-get-standard-units expr))
(default-units (gethash
standard-units
math-default-units-table)))
- (cond
- ((not default-units)
- (puthash standard-units (list units) math-default-units-table))
- ((not (equal units (car default-units)))
- (puthash standard-units
- (list units (car default-units))
- math-default-units-table)))))
+ (cond
+ ((not default-units)
+ (puthash standard-units (list units) math-default-units-table))
+ ((not (equal units (car default-units)))
+ (puthash standard-units
+ (list units (car default-units))
+ math-default-units-table)))))))
(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 @@
;;; semantic/wisent/js-wy.el --- Generated parser support file
;; Copyright (C) 2005, 2009-2012 Free Software Foundation, Inc.
-;; Copyright (C) 1998-2011 Ecma International
+;; Copyright (C) 1998-2011 Ecma International.
;; This file is part of GNU Emacs.
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 @@
;;; semantic/wisent/python-wy.el --- Generated parser support file
;; Copyright (C) 2002-2004, 2007, 2010-2012 Free Software Foundation, Inc.
-;; Copyright (C) 2001-2010 Python Software Foundation
+;; Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+;; 2009, 2010 Python Software Foundation; All Rights Reserved
;; This file is part of GNU Emacs.
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.
Optional arg FRAME specifies the frame where the color is to be
displayed. If FRAME is omitted or nil, use the selected frame.
If FRAME cannot display COLOR, return nil."
- (mapcar (lambda (x) (/ x 65535.0)) (color-values color frame)))
+ ;; `colors-values' maximum value is either 65535 or 65280 depending on the
+ ;; display system. So we use a white conversion to get the max value.
+ (let ((valmax (float (car (color-values "#ffffff")))))
+ (mapcar (lambda (x) (/ x valmax)) (color-values color frame))))
(defun color-rgb-to-hex (red green blue)
"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.")
"\\015"
(text-properties-at (match-beginning 0)))
nil t))
- (set-marker end nil)))
+ (set-marker end nil))
+ ;; Replace any newlines in DIR with literal "\n"s, for the sake
+ ;; of the header line. To disambiguate a literal "\n" in the
+ ;; actual dirname, we also replace "\" with "\\".
+ ;; Personally, I think this should always be done, irrespective
+ ;; of the value of dired-actual-switches, because:
+ ;; i) Dired simply does not work with an unescaped newline in
+ ;; the directory name used in the header (bug=10469#28), and
+ ;; ii) "\" is always replaced with "\\" in the listing, so doing
+ ;; it in the header as well makes things consistent.
+ ;; But at present it is only done if "-b" is in ls-switches,
+ ;; because newlines in dirnames are uncommon, and people may
+ ;; have gotten used to seeing unescaped "\" in the headers.
+ ;; Note: adjust dired-build-subdir-alist if you change this.
+ (setq dir (replace-regexp-in-string "\\\\" "\\\\" dir nil t)
+ dir (replace-regexp-in-string "\n" "\\n" dir nil t)))
(dired-insert-set-properties opoint (point))
;; If we used --dired and it worked, the lines are already indented.
;; Otherwise, indent them.
@@ -2541,12 +2556,31 @@ instead of `dired-actual-switches'."
(delete-region (point) (match-end 1))
(insert new-dir-name))
(setq count (1+ count))
+ ;; Undo any escaping of newlines and \ by dired-insert-directory.
+ ;; Convert "n" preceded by odd number of \ to newline, and \\ to \.
+ (when (and (dired-switches-escape-p switches)
+ (string-match-p "\\\\" new-dir-name))
+ (let (temp res)
+ (mapc (lambda (char)
+ (cond ((equal char ?\\)
+ (if temp
+ (setq res (concat res "\\")
+ temp nil)
+ (setq temp "\\")))
+ ((and temp (equal char ?n))
+ (setq res (concat res "\n")
+ temp nil))
+ (t
+ (setq res (concat res temp (char-to-string char))
+ temp nil))))
+ new-dir-name)
+ (setq new-dir-name res)))
(dired-alist-add-1 new-dir-name
- ;; Place a sub directory boundary between lines.
- (save-excursion
- (goto-char (match-beginning 0))
- (beginning-of-line)
- (point-marker)))))
+ ;; Place a sub directory boundary between lines.
+ (save-excursion
+ (goto-char (match-beginning 0))
+ (beginning-of-line)
+ (point-marker)))))
(if (and (> count 1) (called-interactively-p 'interactive))
(message "Buffer includes %d directories" count)))
;; 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."
(funcall (or (pcomplete-find-completion-function (pcomplete-arg 1))
pcomplete-default-completion-function)))
-(defalias 'pcomplete/ssh 'pcomplete/rsh)
-
(defvar block-size)
(defvar by-bytes)
(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."
(insert-file-contents eshell-hosts-file)
(goto-char (point-min))
(while (re-search-forward
- "^\\(\\S-+\\)\\s-+\\(\\S-+\\)\\(\\s-*\\(\\S-+\\)\\)?" nil t)
+ "^\\([^#[:space:]]+\\)\\s-+\\(\\S-+\\)\\(\\s-*\\(\\S-+\\)\\)?" nil t)
(if (match-string 1)
(add-to-list 'hosts (match-string 1)))
(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."
(other :tag "Query" other))
:group 'find-file)
+;; This is an odd variable IMO.
+;; You might wonder why it is needed, when we could just do:
+;; (set (make-local-variable 'enable-local-variables) nil)
+;; These two are not precisely the same.
+;; Setting this variable does not cause -*- mode settings to be
+;; ignored, whereas setting enable-local-variables does.
+;; Only three places in Emacs use this variable: tar and arc modes,
+;; and rmail. The first two don't need it. They already use
+;; inhibit-local-variables-regexps, which is probably enough, and
+;; could also just set enable-local-variables locally to nil.
+;; Them setting it has the side-effect that dir-locals cannot apply to
+;; eg tar files (?). FIXME Is this appropriate?
+;; AFAICS, rmail is the only thing that needs this, and the only
+;; reason it uses it is for BABYL files (which are obsolete).
+;; These contain "-*- rmail -*-" in the first line, which rmail wants
+;; to respect, so that find-file on a BABYL file will switch to
+;; rmail-mode automatically (this is nice, but hardly essential,
+;; since most people are used to explicitly running a command to
+;; access their mail; M-x gnus etc). Rmail files may happen to
+;; contain Local Variables sections in messages, which Rmail wants to
+;; ignore. So AFAICS the only reason this variable exists is for a
+;; minor convenience feature for handling of an obsolete Rmail file format.
(defvar local-enable-local-variables t
"Like `enable-local-variables' but meant for buffer-local bindings.
The meaningful values are nil and non-nil. The default is non-nil.
If a major mode sets this to nil, buffer-locally, then any local
-variables list in the file will be ignored.
+variables list in a file visited in that mode will be ignored.
-This variable does not affect the use of major modes
-specified in a -*- line.")
+This variable does not affect the use of major modes specified
+in a -*- line.")
(defcustom enable-local-eval 'maybe
"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
calling FUNCTION (if it's not nil), we delete the suffix that matched
REGEXP and search the list again for another match.
-If the file name matches `inhibit-first-line-modes-regexps',
-then `auto-mode-alist' is not processed.
-
The extensions whose FUNCTION is `archive-mode' should also
appear in `auto-coding-alist' with `no-conversion' coding system.
@@ -2478,16 +2497,55 @@ of a script, mode MODE is enabled.
See also `auto-mode-alist'.")
-(defvar inhibit-first-line-modes-regexps
- (mapcar 'purecopy '("\\.tar\\'" "\\.tgz\\'" "\\.tiff?\\'"
- "\\.gif\\'" "\\.png\\'" "\\.jpe?g\\'"))
- "List of regexps; if one matches a file name, don't look for `-*-'.")
+(define-obsolete-variable-alias 'inhibit-first-line-modes-regexps
+ 'inhibit-file-local-variables-regexps "24.1")
+
+;; TODO really this should be a list of modes (eg tar-mode), not regexps,
+;; because we are duplicating info from auto-mode-alist.
+;; TODO many elements of this list are also in auto-coding-alist.
+(defvar inhibit-local-variables-regexps
+ (mapcar 'purecopy '("\\.tar\\'" "\\.t[bg]z\\'"
+ "\\.arc\\'" "\\.zip\\'" "\\.lzh\\'" "\\.lha\\'"
+ "\\.zoo\\'" "\\.[jew]ar\\'" "\\.xpi\\'" "\\.rar\\'"
+ "\\.7z\\'"
+ "\\.sx[dmicw]\\'" "\\.odt\\'"
+ "\\.tiff?\\'" "\\.gif\\'" "\\.png\\'" "\\.jpe?g\\'"))
+ "List of regexps matching file names in which to ignore local variables.
+This includes `-*-' lines as well as trailing \"Local Variables\" sections.
+Files matching this list are typically binary file formats.
+They may happen to contain sequences that look like local variable
+specifications, but are not really, or they may be containers for
+member files with their own local variable sections, which are
+not appropriate for the containing file.
+See also `inhibit-local-variables-suffixes'.")
+
+(define-obsolete-variable-alias 'inhibit-first-line-modes-suffixes
+ 'inhibit-local-variables-suffixes "24.1")
-(defvar inhibit-first-line-modes-suffixes nil
- "List of regexps for what to ignore, for `inhibit-first-line-modes-regexps'.
-When checking `inhibit-first-line-modes-regexps', we first discard
+(defvar inhibit-local-variables-suffixes nil
+ "List of regexps matching suffixes to remove from file names.
+When checking `inhibit-local-variables-regexps', we first discard
from the end of the file name anything that matches one of these regexps.")
+;; TODO explicitly add case-fold-search t?
+(defun inhibit-local-variables-p ()
+ "Return non-nil if file local variables should be ignored.
+This checks the file (or buffer) name against `inhibit-local-variables-regexps'
+and `inhibit-local-variables-suffixes'."
+ (let ((temp inhibit-local-variables-regexps)
+ (name (if buffer-file-name
+ (file-name-sans-versions buffer-file-name)
+ (buffer-name))))
+ (while (let ((sufs inhibit-local-variables-suffixes))
+ (while (and sufs (not (string-match (car sufs) name)))
+ (setq sufs (cdr sufs)))
+ sufs)
+ (setq name (substring name 0 (match-beginning 0))))
+ (while (and temp
+ (not (string-match (car temp) name)))
+ (setq temp (cdr temp)))
+ temp))
+
(defvar auto-mode-interpreter-regexp
(purecopy "#![ \t]?\\([^ \t\n]*\
/bin/env[ \t]\\)?\\([^ \t\n]+\\)")
@@ -2550,21 +2608,24 @@ Also applies to `magic-fallback-mode-alist'.")
(defun set-auto-mode (&optional keep-mode-if-same)
"Select major mode appropriate for current buffer.
-To find the right major mode, this function checks for a -*- mode tag,
+To find the right major mode, this function checks for a -*- mode tag
checks for a `mode:' entry in the Local Variables section of the file,
checks if it uses an interpreter listed in `interpreter-mode-alist',
matches the buffer beginning against `magic-mode-alist',
compares the filename against the entries in `auto-mode-alist',
then matches the buffer beginning against `magic-fallback-mode-alist'.
-If `enable-local-variables' is nil, this function does not check for
-any mode: tag anywhere in the file.
+If `enable-local-variables' is nil, or if the file name matches
+`inhibit-local-variables-regexps', this function does not check
+for any mode: tag anywhere in the file. If `local-enable-local-variables'
+is nil, then the only mode: tag that can be relevant is a -*- one.
If the optional argument KEEP-MODE-IF-SAME is non-nil, then we
set the major mode only if that would change it. In other words
we don't actually set it to the same mode the buffer already has."
;; Look for -*-MODENAME-*- or -*- ... mode: MODENAME; ... -*-
- (let (end done mode modes)
+ (let ((try-locals (not (inhibit-local-variables-p)))
+ end done mode modes)
;; Once we drop the deprecated feature where mode: is also allowed to
;; specify minor-modes (ie, there can be more than one "mode:"), we can
;; 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."
(save-excursion
(goto-char (point-min))
(skip-chars-forward " \t\n")
+ ;; Note by design local-enable-local-variables does not matter here.
(and enable-local-variables
+ try-locals
(setq end (set-auto-mode-1))
(if (save-excursion (search-forward ":" end t))
;; 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."
(or (set-auto-mode-0 mode keep-mode-if-same)
;; continuing would call minor modes again, toggling them off
(throw 'nop nil))))))
+ ;; hack-local-variables checks local-enable-local-variables etc, but
+ ;; we might as well be explicit here for the sake of clarity.
(and (not done)
enable-local-variables
+ local-enable-local-variables
+ try-locals
(setq mode (hack-local-variables t))
(not (memq mode modes)) ; already tried and failed
(if (not (functionp mode))
@@ -2714,38 +2781,24 @@ same, do nothing and return nil."
(defun set-auto-mode-1 ()
"Find the -*- spec in the buffer.
Call with point at the place to start searching from.
-If one is found, set point to the beginning
-and return the position of the end.
-Otherwise, return nil; point may be changed."
+If one is found, set point to the beginning and return the position
+of the end. Otherwise, return nil; may change point.
+The variable `inhibit-local-variables-regexps' can cause a -*- spec to
+be ignored; but `enable-local-variables' and `local-enable-local-variables'
+have no effect."
(let (beg end)
(and
;; Don't look for -*- if this file name matches any
- ;; of the regexps in inhibit-first-line-modes-regexps.
- (let ((temp inhibit-first-line-modes-regexps)
- (name (if buffer-file-name
- (file-name-sans-versions buffer-file-name)
- (buffer-name))))
- (while (let ((sufs inhibit-first-line-modes-suffixes))
- (while (and sufs (not (string-match (car sufs) name)))
- (setq sufs (cdr sufs)))
- sufs)
- (setq name (substring name 0 (match-beginning 0))))
- (while (and temp
- (not (string-match (car temp) name)))
- (setq temp (cdr temp)))
- (not temp))
-
+ ;; of the regexps in inhibit-local-variables-regexps.
+ (not (inhibit-local-variables-p))
(search-forward "-*-" (line-end-position
- ;; If the file begins with "#!"
- ;; (exec interpreter magic), look
- ;; for mode frobs in the first two
- ;; lines. You cannot necessarily
- ;; put them in the first line of
- ;; such a file without screwing up
- ;; the interpreter invocation.
- ;; The same holds for
- ;; '\"
- ;; in man pages (preprocessor
+ ;; If the file begins with "#!" (exec
+ ;; interpreter magic), look for mode frobs
+ ;; in the first two lines. You cannot
+ ;; necessarily put them in the first line
+ ;; of such a file without screwing up the
+ ;; interpreter invocation. The same holds
+ ;; for '\" in man pages (preprocessor
;; magic for the `man' program).
(and (looking-at "^\\(#!\\|'\\\\\"\\)") 2)) t)
(progn
@@ -3090,19 +3143,41 @@ Uses `hack-local-variables-apply' to apply the variables.
If MODE-ONLY is non-nil, all we do is check whether a \"mode:\"
is specified, and return the corresponding mode symbol, or nil.
In this case, we try to ignore minor-modes, and only return a
-major-mode."
+major-mode.
+
+If `enable-local-variables' or `local-enable-local-variables' is nil,
+this function does nothing. If `inhibit-local-variables-regexps'
+applies to the file in question, the file is not scanned for
+local variables, but directory-local variables may still be applied."
+ ;; We don't let inhibit-local-variables-p influence the value of
+ ;; enable-local-variables, because then it would affect dir-local
+ ;; variables. We don't want to search eg tar files for file local
+ ;; variable sections, but there is no reason dir-locals cannot apply
+ ;; to them. The real meaning of inhibit-local-variables-p is "do
+ ;; not scan this file for local variables".
(let ((enable-local-variables
(and local-enable-local-variables enable-local-variables))
result)
(unless mode-only
(setq file-local-variables-alist nil)
(report-errors "Directory-local variables error: %s"
+ ;; Note this is a no-op if enable-local-variables is nil.
(hack-dir-local-variables)))
- (when (or mode-only enable-local-variables)
- ;; If MODE-ONLY is non-nil, and the prop line specifies a mode,
- ;; then we're done, and have no need to scan further.
- (unless (and (setq result (hack-local-variables-prop-line mode-only))
- mode-only)
+ ;; This entire function is basically a no-op if enable-local-variables
+ ;; is nil. All it does is set file-local-variables-alist to nil.
+ (when enable-local-variables
+ ;; This part used to ignore enable-local-variables when mode-only
+ ;; was non-nil. That was inappropriate, eg consider the
+ ;; (artificial) example of:
+ ;; (setq local-enable-local-variables nil)
+ ;; Open a file foo.txt that contains "mode: sh".
+ ;; It correctly opens in text-mode.
+ ;; M-x set-visited-file name foo.c, and it incorrectly stays in text-mode.
+ (unless (or (inhibit-local-variables-p)
+ ;; If MODE-ONLY is non-nil, and the prop line specifies a
+ ;; mode, then we're done, and have no need to scan further.
+ (and (setq result (hack-local-variables-prop-line mode-only))
+ mode-only))
;; Look for "Local variables:" line in last page.
(save-excursion
(goto-char (point-max))
@@ -3192,14 +3267,13 @@ major-mode."
(indirect-variable var))
val) result)
(error nil)))))
- (forward-line 1)))))))))
- ;; Now we've read all the local variables.
- ;; If MODE-ONLY is non-nil, return whether the mode was specified.
- (cond (mode-only result)
- ;; Otherwise, set the variables.
- (enable-local-variables
- (hack-local-variables-filter result nil)
- (hack-local-variables-apply)))))
+ (forward-line 1))))))))
+ ;; Now we've read all the local variables.
+ ;; If MODE-ONLY is non-nil, return whether the mode was specified.
+ (if mode-only result
+ ;; Otherwise, set the variables.
+ (hack-local-variables-filter result nil)
+ (hack-local-variables-apply)))))
(defun hack-local-variables-apply ()
"Apply the elements of `file-local-variables-alist'.
@@ -3611,7 +3685,7 @@ the old visited file has been renamed to the new name FILENAME."
(interactive "FSet visited file name: ")
(if (buffer-base-buffer)
(error "An indirect buffer cannot visit a file"))
- (let (truename)
+ (let (truename old-try-locals)
(if filename
(setq filename
(if (string-equal filename "")
@@ -3636,7 +3710,8 @@ the old visited file has been renamed to the new name FILENAME."
(progn
(and filename (lock-buffer filename))
(unlock-buffer)))
- (setq buffer-file-name filename)
+ (setq old-try-locals (not (inhibit-local-variables-p))
+ buffer-file-name filename)
(if filename ; make buffer name reflect filename.
(let ((new-name (file-name-nondirectory buffer-file-name)))
(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."
(setq buffer-file-number
(if filename
(nthcdr 10 (file-attributes buffer-file-name))
- nil)))
- ;; write-file-functions is normally used for things like ftp-find-file
- ;; that visit things that are not local files as if they were files.
- ;; Changing to visit an ordinary local file instead should flush the hook.
- (kill-local-variable 'write-file-functions)
- (kill-local-variable 'local-write-file-hooks)
- (kill-local-variable 'revert-buffer-function)
- (kill-local-variable 'backup-inhibited)
- ;; If buffer was read-only because of version control,
- ;; that reason is gone now, so make it writable.
- (if vc-mode
- (setq buffer-read-only nil))
- (kill-local-variable 'vc-mode)
- ;; Turn off backup files for certain file names.
- ;; Since this is a permanent local, the major mode won't eliminate it.
- (and buffer-file-name
- backup-enable-predicate
- (not (funcall backup-enable-predicate buffer-file-name))
- (progn
- (make-local-variable 'backup-inhibited)
- (setq backup-inhibited t)))
- (let ((oauto buffer-auto-save-file-name))
- ;; If auto-save was not already on, turn it on if appropriate.
- (if (not buffer-auto-save-file-name)
- (and buffer-file-name auto-save-default
- (auto-save-mode t))
- ;; If auto save is on, start using a new name.
- ;; We deliberately don't rename or delete the old auto save
- ;; for the old visited file name. This is because perhaps
- ;; the user wants to save the new state and then compare with the
- ;; previous state from the auto save file.
- (setq buffer-auto-save-file-name
- (make-auto-save-file-name)))
- ;; Rename the old auto save file if any.
- (and oauto buffer-auto-save-file-name
- (file-exists-p oauto)
- (rename-file oauto buffer-auto-save-file-name t)))
- (and buffer-file-name
- (not along-with-file)
- (set-buffer-modified-p t))
- ;; Update the major mode, if the file name determines it.
- (condition-case nil
- ;; Don't change the mode if it is special.
- (or (not change-major-mode-with-file-name)
- (get major-mode 'mode-class)
- ;; Don't change the mode if the local variable list specifies it.
- (hack-local-variables t)
- ;; TODO consider making normal-mode handle this case.
- (let ((old major-mode))
- (set-auto-mode t)
- (or (eq old major-mode)
- (hack-local-variables))))
- (error nil)))
+ nil))
+ ;; write-file-functions is normally used for things like ftp-find-file
+ ;; that visit things that are not local files as if they were files.
+ ;; Changing to visit an ordinary local file instead should flush the hook.
+ (kill-local-variable 'write-file-functions)
+ (kill-local-variable 'local-write-file-hooks)
+ (kill-local-variable 'revert-buffer-function)
+ (kill-local-variable 'backup-inhibited)
+ ;; If buffer was read-only because of version control,
+ ;; that reason is gone now, so make it writable.
+ (if vc-mode
+ (setq buffer-read-only nil))
+ (kill-local-variable 'vc-mode)
+ ;; Turn off backup files for certain file names.
+ ;; Since this is a permanent local, the major mode won't eliminate it.
+ (and buffer-file-name
+ backup-enable-predicate
+ (not (funcall backup-enable-predicate buffer-file-name))
+ (progn
+ (make-local-variable 'backup-inhibited)
+ (setq backup-inhibited t)))
+ (let ((oauto buffer-auto-save-file-name))
+ ;; If auto-save was not already on, turn it on if appropriate.
+ (if (not buffer-auto-save-file-name)
+ (and buffer-file-name auto-save-default
+ (auto-save-mode t))
+ ;; If auto save is on, start using a new name.
+ ;; We deliberately don't rename or delete the old auto save
+ ;; for the old visited file name. This is because perhaps
+ ;; the user wants to save the new state and then compare with the
+ ;; previous state from the auto save file.
+ (setq buffer-auto-save-file-name
+ (make-auto-save-file-name)))
+ ;; Rename the old auto save file if any.
+ (and oauto buffer-auto-save-file-name
+ (file-exists-p oauto)
+ (rename-file oauto buffer-auto-save-file-name t)))
+ (and buffer-file-name
+ (not along-with-file)
+ (set-buffer-modified-p t))
+ ;; Update the major mode, if the file name determines it.
+ (condition-case nil
+ ;; Don't change the mode if it is special.
+ (or (not change-major-mode-with-file-name)
+ (get major-mode 'mode-class)
+ ;; Don't change the mode if the local variable list specifies it.
+ ;; The file name can influence whether the local variables apply.
+ (and old-try-locals
+ ;; h-l-v also checks it, but might as well be explcit.
+ (not (inhibit-local-variables-p))
+ (hack-local-variables t))
+ ;; TODO consider making normal-mode handle this case.
+ (let ((old major-mode))
+ (set-auto-mode t)
+ (or (eq old major-mode)
+ (hack-local-variables))))
+ (error nil))))
(defun write-file (filename &optional confirm)
"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 @@
+2012-01-21 Lars Magne Ingebrigtsen <larsi@gnus.org>
+
+ * mm-decode.el (mm-interactively-view-part): Fix prompt.
+
2012-01-10 Teodor Zlatanov <tzz@lifelogs.com>
* 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."
(mailcap-mime-info type 'all)))
(method (let ((minibuffer-local-completion-map
mm-viewer-completion-map))
- (completing-read "Viewer" methods))))
+ (completing-read "Viewer: " methods))))
(when (string= method "")
(error "No method given"))
(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."
(when config
(set-window-configuration config)
(setq config nil))
- ;; `defn' must make sure that its frame is
- ;; selected, so we won't iconify it below.
- (call-interactively defn)
+ ;; Temporarily rebind `minor-mode-map-alist'
+ ;; to `new-minor-mode-map-alist' (Bug#10454).
+ (let ((minor-mode-map-alist new-minor-mode-map-alist))
+ ;; `defn' must make sure that its frame is
+ ;; selected, so we won't iconify it below.
+ (call-interactively defn))
(when new-frame
;; Do not iconify the selected frame.
(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:
(if (memq eol-type '(0 1 2))
(setq base
(coding-system-change-eol-conversion base eol-type)))
- (set-default-coding-systems base)))
+ (set-default-coding-systems base)
+ (if (called-interactively-p 'interactive)
+ (or (eq base default-file-name-coding-system)
+ (message "The default value of `file-name-coding-system' was not changed because the specified coding system is not suitable for file names.")))))
(defvar sort-coding-systems-predicate nil
"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."
;;; FILE I/O
+;; TODO many elements of this list are also in inhibit-local-variables-regexps.
(defcustom auto-coding-alist
;; .exe and .EXE are added to support archive-mode looking at DOS
;; self-extracting exe archives.
@@ -1677,7 +1678,7 @@ arc\\|zip\\|lzh\\|lha\\|zoo\\|[jew]ar\\|xpi\\|rar\\|7z\\|\
ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|7Z\\)\\'"
. no-conversion-multibyte)
("\\.\\(exe\\|EXE\\)\\'" . no-conversion)
- ("\\.\\(sx[dmicw]\\|odt\\|tar\\|tgz\\)\\'" . no-conversion)
+ ("\\.\\(sx[dmicw]\\|odt\\|tar\\|t[bg]z\\)\\'" . no-conversion)
("\\.\\(gz\\|Z\\|bz\\|bz2\\|xz\\|gpg\\)\\'" . no-conversion)
("\\.\\(jpe?g\\|png\\|gif\\|tiff?\\|p[bpgn]m\\)\\'" . no-conversion)
("\\.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."
:group 'isearch)
(defcustom search-nonincremental-instead t
- "If non-nil, do a nonincremental search instead if exiting immediately.
+ "If non-nil, do a nonincremental search instead of exiting immediately.
Actually, `isearch-edit-string' is called to let you enter the search
string, and RET terminates editing and does a nonincremental search."
: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'."
(defun jka-compr-install ()
"Install jka-compr.
This adds entries to `file-name-handler-alist' and `auto-mode-alist'
-and `inhibit-first-line-modes-suffixes'."
+and `inhibit-local-variables-suffixes'."
(setq jka-compr-file-name-handler-entry
(cons (jka-compr-build-file-regexp) 'jka-compr-handler))
@@ -145,12 +145,12 @@ and `inhibit-first-line-modes-suffixes'."
;; are chosen right according to the file names
;; sans `.gz'.
(push (list (jka-compr-info-regexp x) nil 'jka-compr) auto-mode-alist)
- ;; Also add these regexps to
- ;; inhibit-first-line-modes-suffixes, so that a
- ;; -*- line in the first file of a compressed tar
- ;; file doesn't override tar-mode.
+ ;; Also add these regexps to inhibit-local-variables-suffixes,
+ ;; so that a -*- line in the first file of a compressed tar file,
+ ;; or a Local Variables section in a member file at the end of
+ ;; the tar file don't override tar-mode.
(push (jka-compr-info-regexp x)
- inhibit-first-line-modes-suffixes)))
+ inhibit-local-variables-suffixes)))
(setq auto-mode-alist
(append auto-mode-alist jka-compr-mode-alist-additions))
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.")
(defun jka-compr-uninstall ()
"Uninstall jka-compr.
This removes the entries in `file-name-handler-alist' and `auto-mode-alist'
-and `inhibit-first-line-modes-suffixes' that were added
+and `inhibit-local-variables-suffixes' that were added
by `jka-compr-installed'."
- ;; Delete from inhibit-first-line-modes-suffixes
- ;; what jka-compr-install added.
+ ;; Delete from inhibit-local-variables-suffixes what jka-compr-install added.
(mapc
(function (lambda (x)
(and (jka-compr-info-strip-extension x)
- (setq inhibit-first-line-modes-suffixes
+ (setq inhibit-local-variables-suffixes
(delete (jka-compr-info-regexp x)
- inhibit-first-line-modes-suffixes)))))
+ inhibit-local-variables-suffixes)))))
jka-compr-compression-info-list--internal)
(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."
(aset key 3 nil))
(let ((hash (or (gethash key tramp-cache-data)
(puthash key (make-hash-table :test 'equal)
- tramp-cache-data))))
+ tramp-cache-data))))
(puthash property value hash)
(setq tramp-cache-data-changed t)
(tramp-message key 7 "%s %s" property value)
@@ -329,10 +329,15 @@ KEY identifies the connection, it is either a process or a vector."
tramp-cache-data-changed
(stringp tramp-persistency-file-name))
(let ((cache (copy-hash-table tramp-cache-data)))
- ;; Remove temporary data.
+ ;; Remove temporary data. If there is the key "login-as", we
+ ;; don't save either, because all other properties might
+ ;; depend on the login name, and we want to give the
+ ;; possibility to use another login name later on.
(maphash
(lambda (key value)
- (if (and (vectorp key) (not (tramp-file-name-localname key)))
+ (if (and (vectorp key)
+ (not (tramp-file-name-localname key))
+ (not (gethash "login-as" value)))
(progn
(remhash "process-name" value)
(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.")
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "pscp")
- (tramp-copy-args (("-P" "%p") ("-scp") ("-p" "%k")
+ (tramp-copy-args (("-l" "%u") ("-P" "%p") ("-scp") ("-p" "%k")
("-q") ("-r")))
(tramp-copy-keep-date t)
(tramp-copy-recursive t)
@@ -394,7 +394,7 @@ detected as prompt when being sent on echoing hosts, therefore.")
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-copy-program "pscp")
- (tramp-copy-args (("-P" "%p") ("-sftp") ("-p" "%k")
+ (tramp-copy-args (("-l" "%u") ("-P" "%p") ("-sftp") ("-p" "%k")
("-q") ("-r")))
(tramp-copy-keep-date t)
(tramp-copy-recursive t)
@@ -419,13 +419,12 @@ detected as prompt when being sent on echoing hosts, therefore.")
`(,(concat "\\`" (regexp-opt '("su" "sudo" "ksu")) "\\'")
nil "root"))
;; Do not add "ssh" based methods, otherwise ~/.ssh/config would be ignored.
+;; Do not add "plink" based methods, they ask interactively for the user.
;;;###tramp-autoload
(add-to-list 'tramp-default-user-alist
`(,(concat
"\\`"
- (regexp-opt
- '("rcp" "remcp" "rsh" "telnet" "krlogin"
- "plink" "plink1" "pscp" "psftp" "fcp"))
+ (regexp-opt '("rcp" "remcp" "rsh" "telnet" "krlogin" "fcp"))
"\\'")
nil ,(user-login-name)))
@@ -2281,8 +2280,10 @@ The method used must be an out-of-band method."
;; Set variables for computing the prompt for reading
;; password.
(setq tramp-current-method (tramp-file-name-method v)
- tramp-current-user (tramp-file-name-user v)
- tramp-current-host (tramp-file-name-real-host v))
+ tramp-current-user (or (tramp-file-name-user v)
+ (tramp-get-connection-property
+ v "login-as" nil))
+ tramp-current-host (tramp-file-name-real-host v))
;; Expand hops. Might be necessary for gateway methods.
(setq v (car (tramp-compute-multi-hops v)))
@@ -2309,8 +2310,15 @@ The method used must be an out-of-band method."
(setq port (string-to-number (match-string 2 host))
host (string-to-number (match-string 1 host))))
+ ;; Check for user. There might be an interactive setting.
+ (setq user (or (tramp-file-name-user v)
+ (tramp-get-connection-property v "login-as" nil)))
+
;; Compose copy command.
- (setq spec (format-spec-make
+ (setq host (or host "")
+ user (or user "")
+ port (or port "")
+ spec (format-spec-make
?h host ?u user ?p port
?t (tramp-get-connection-property
(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.")
"Regexp which matches `tramp-echo-mark' as it gets echoed by
the remote shell.")
+(defcustom tramp-local-end-of-line
+ (if (memq system-type '(windows-nt)) "\r\n" "\n")
+ "*String used for end of line in local processes."
+ :group 'tramp
+ :type 'string)
+
(defcustom tramp-rsh-end-of-line "\n"
"*String used for end of line in rsh connections.
I 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."
;; operations shall return at least a default value
;; in order to give the user a chance to correct the
;; file name in the minibuffer.
- ;; We cannot use 'debug as error handler. In order
+ ;; We cannot use `debug' as error handler. In order
;; to get a full backtrace, one could apply
;; (setq debug-on-error t debug-on-signal t)
(error
@@ -3109,14 +3115,16 @@ beginning of local filename are not substituted."
(defun tramp-action-login (proc vec)
"Send the login name."
(when (not (stringp tramp-current-user))
- (save-window-excursion
- (let ((enable-recursive-minibuffers t))
- (pop-to-buffer (tramp-get-connection-buffer vec))
- (setq tramp-current-user (read-string (match-string 0))))))
- (tramp-message vec 3 "Sending login name `%s'" tramp-current-user)
+ (setq tramp-current-user
+ (with-connection-property vec "login-as"
+ (save-window-excursion
+ (let ((enable-recursive-minibuffers t))
+ (pop-to-buffer (tramp-get-connection-buffer vec))
+ (read-string (match-string 0)))))))
(with-current-buffer (tramp-get-connection-buffer vec)
(tramp-message vec 6 "\n%s" (buffer-string)))
- (tramp-send-string vec tramp-current-user))
+ (tramp-message vec 3 "Sending login name `%s'" tramp-current-user)
+ (tramp-send-string vec (concat tramp-current-user tramp-local-end-of-line)))
(defun tramp-action-password (proc vec)
"Query the user for a password."
@@ -3148,7 +3156,7 @@ See also `tramp-action-yn'."
(throw 'tramp-action 'permission-denied))
(with-current-buffer (tramp-get-connection-buffer vec)
(tramp-message vec 6 "\n%s" (buffer-string)))
- (tramp-send-string vec "yes"))))
+ (tramp-send-string vec (concat "yes" tramp-local-end-of-line)))))
(defun tramp-action-yn (proc vec)
"Ask the user for confirmation using `y-or-n-p'.
@@ -3162,7 +3170,7 @@ See also `tramp-action-yesno'."
(throw 'tramp-action 'permission-denied))
(with-current-buffer (tramp-get-connection-buffer vec)
(tramp-message vec 6 "\n%s" (buffer-string)))
- (tramp-send-string vec "y"))))
+ (tramp-send-string vec (concat "y" tramp-local-end-of-line)))))
(defun tramp-action-terminal (proc vec)
"Tell the remote host which terminal type to use.
@@ -3170,7 +3178,7 @@ The terminal type can be configured with `tramp-terminal-type'."
(tramp-message vec 5 "Setting `%s' as terminal type." tramp-terminal-type)
(with-current-buffer (tramp-get-connection-buffer vec)
(tramp-message vec 6 "\n%s" (buffer-string)))
- (tramp-send-string vec tramp-terminal-type))
+ (tramp-send-string vec (concat tramp-terminal-type tramp-local-end-of-line)))
(defun tramp-action-process-alive (proc vec)
"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."
(let ((fill-paragraph-function
;; Avoid infinite recursion.
(if (not (eq fill-paragraph-function 'c-fill-paragraph))
- fill-paragraph-function))
- (start-point (point-marker)))
- (c-mask-paragraph
- t nil (lambda () (fill-region-as-paragraph (point-min) (point-max) arg)))
- (goto-char start-point))
+ fill-paragraph-function)))
+ (c-mask-paragraph t nil 'fill-paragraph arg))
;; Always return t. This has the effect that if filling isn't done
;; above, it isn't done at all, and it's therefore effectively
;; 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."
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; We maintain a simple cache of positions which aren't in a literal, so as to
;; speed up testing for non-literality.
-(defconst c-state-nonlit-pos-interval 10000)
+(defconst c-state-nonlit-pos-interval 3000)
;; The approximate interval between entries in `c-state-nonlit-pos-cache'.
(defvar c-state-nonlit-pos-cache nil)
@@ -2129,7 +2129,7 @@ comment at the start of cc-engine.el for more info."
(widen)
(save-excursion
(let ((c c-state-nonlit-pos-cache)
- pos npos lit)
+ pos npos lit macro-beg)
;; Trim the cache to take account of buffer changes.
(while (and c (> (car c) c-state-nonlit-pos-cache-limit))
(setq c (cdr c)))
@@ -2139,16 +2139,32 @@ comment at the start of cc-engine.el for more info."
(setq c (cdr c)))
(setq pos (or (car c) (point-min)))
- (while (<= (setq npos (+ pos c-state-nonlit-pos-interval))
- here)
- (setq lit (car (cddr (c-state-pp-to-literal pos npos))))
- (setq pos (or (cdr lit) npos)) ; end of literal containing npos.
+ (while
+ ;; Add an element to `c-state-nonlit-pos-cache' each iteration.
+ (and
+ (<= (setq npos (+ pos c-state-nonlit-pos-interval)) here)
+ (progn
+ (setq lit (car (cddr (c-state-pp-to-literal pos npos))))
+ (cond
+ ((null lit)
+ (setq pos npos)
+ t)
+ ((<= (cdr lit) here)
+ (setq pos (cdr lit))
+ t)
+ (t
+ (setq pos (car lit))
+ nil))))
+
(goto-char pos)
(when (and (c-beginning-of-macro) (/= (point) pos))
- (c-syntactic-end-of-macro)
- (or (eobp) (forward-char))
- (setq pos (point)))
- (setq c-state-nonlit-pos-cache (cons pos c-state-nonlit-pos-cache)))
+ (setq macro-beg (point))
+ (c-syntactic-end-of-macro)
+ (or (eobp) (forward-char))
+ (setq pos (if (<= (point) here)
+ (point)
+ macro-beg)))
+ (setq c-state-nonlit-pos-cache (cons pos c-state-nonlit-pos-cache)))
(if (> pos c-state-nonlit-pos-cache-limit)
(setq c-state-nonlit-pos-cache-limit pos))
@@ -4351,6 +4367,78 @@ comment at the start of cc-engine.el for more info."
(t 'c))) ; Assuming the range is valid.
range))
+(defsubst c-determine-limit-get-base (start try-size)
+ ;; Get a "safe place" approximately TRY-SIZE characters before START.
+ ;; This doesn't preserve point.
+ (let* ((pos (max (- start try-size) (point-min)))
+ (base (c-state-safe-place pos))
+ (s (parse-partial-sexp base pos)))
+ (if (or (nth 4 s) (nth 3 s)) ; comment or string
+ (nth 8 s)
+ (point))))
+
+(defun c-determine-limit (how-far-back &optional start try-size)
+ ;; Return a buffer position HOW-FAR-BACK non-literal characters from START
+ ;; (default point). This is done by going back further in the buffer then
+ ;; searching forward for literals. The position found won't be in a
+ ;; literal. We start searching for the sought position TRY-SIZE (default
+ ;; twice HOW-FAR-BACK) bytes back from START. This function must be fast.
+ ;; :-)
+ (save-excursion
+ (let* ((start (or start (point)))
+ (try-size (or try-size (* 2 how-far-back)))
+ (base (c-determine-limit-get-base start try-size))
+ (pos base)
+
+ (s (parse-partial-sexp pos pos)) ; null state.
+ stack elt size
+ (count 0))
+ (while (< pos start)
+ ;; Move forward one literal each time round this loop.
+ ;; Move forward to the start of a comment or string.
+ (setq s (parse-partial-sexp
+ pos
+ start
+ nil ; target-depth
+ nil ; stop-before
+ s ; state
+ 'syntax-table)) ; stop-comment
+
+ ;; Gather details of the non-literal-bit - starting pos and size.
+ (setq size (- (if (or (nth 4 s) (nth 3 s))
+ (nth 8 s)
+ (point))
+ pos))
+ (if (> size 0)
+ (setq stack (cons (cons pos size) stack)))
+
+ ;; Move forward to the end of the comment/string.
+ (if (or (nth 4 s) (nth 3 s))
+ (setq s (parse-partial-sexp
+ (point)
+ start
+ nil ; target-depth
+ nil ; stop-before
+ s ; state
+ 'syntax-table))) ; stop-comment
+ (setq pos (point)))
+
+ ;; Now try and find enough non-literal characters recorded on the stack.
+ ;; Go back one recorded literal each time round this loop.
+ (while (and (< count how-far-back)
+ stack)
+ (setq elt (car stack)
+ stack (cdr stack))
+ (setq count (+ count (cdr elt))))
+
+ ;; Have we found enough yet?
+ (cond
+ ((>= count how-far-back)
+ (+ (car elt) (- count how-far-back)))
+ ((eq base (point-min))
+ (point-min))
+ (t
+ (c-determine-limit (- how-far-back count) base try-size))))))
;; `c-find-decl-spots' and accompanying stuff.
@@ -4487,13 +4575,14 @@ comment at the start of cc-engine.el for more info."
;; Call CFD-FUN for each possible spot for a declaration, cast or
;; label from the point to CFD-LIMIT.
;;
- ;; CFD-FUN is called with point at the start of the spot. It's
- ;; passed two arguments: The first is the end position of the token
- ;; preceding the spot, or 0 for the implicit match at bob. The
- ;; second is a flag that is t when the match is inside a macro. If
- ;; CFD-FUN adds `c-decl-end' properties somewhere below the current
- ;; spot, it should return non-nil to ensure that the next search
- ;; will find them.
+ ;; CFD-FUN is called with point at the start of the spot. It's passed two
+ ;; arguments: The first is the end position of the token preceding the spot,
+ ;; or 0 for the implicit match at bob. The second is a flag that is t when
+ ;; the match is inside a macro. Point should be moved forward by at least
+ ;; one token.
+ ;;
+ ;; If CFD-FUN adds `c-decl-end' properties somewhere below the current spot,
+ ;; it should return non-nil to ensure that the next search will find them.
;;
;; Such a spot is:
;; o The first token after bob.
@@ -4867,7 +4956,8 @@ comment at the start of cc-engine.el for more info."
(goto-char cfd-continue-pos)
(if (= cfd-continue-pos cfd-limit)
(setq cfd-match-pos cfd-limit)
- (c-find-decl-prefix-search)))))
+ (c-find-decl-prefix-search))))) ; Moves point, sets cfd-continue-pos,
+ ; cfd-match-pos, etc.
;; A cache for found types.
@@ -8047,6 +8137,23 @@ comment at the start of cc-engine.el for more info."
next-open-brace (c-pull-open-brace paren-state)))
open-brace))
+(defun c-cheap-inside-bracelist-p (paren-state)
+ ;; Return the position of the L-brace if point is inside a brace list
+ ;; initialization of an array, etc. This is an approximate function,
+ ;; designed for speed over accuracy. It will not find every bracelist, but
+ ;; a non-nil result is reliable. We simply search for "= {" (naturally with
+ ;; syntactic whitespace allowed). PAREN-STATE is the normal thing that it
+ ;; is everywhere else.
+ (let (b-pos)
+ (save-excursion
+ (while
+ (and (setq b-pos (c-pull-open-brace paren-state))
+ (progn (goto-char b-pos)
+ (c-backward-sws)
+ (c-backward-token-2)
+ (not (looking-at "=")))))
+ b-pos)))
+
(defun c-inside-bracelist-p (containing-sexp paren-state)
;; return the buffer position of the beginning of the brace list
;; 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 @@
;; `parse-sexp-lookup-properties' (when it exists).
(parse-sexp-lookup-properties
(cc-eval-when-compile
- (boundp 'parse-sexp-lookup-properties))))
+ (boundp 'parse-sexp-lookup-properties)))
+ (BOD-limit
+ (c-determine-limit 1000)))
(goto-char
(let ((here (point)))
- (if (eq (car (c-beginning-of-decl-1)) 'same)
+ (if (eq (car (c-beginning-of-decl-1 BOD-limit)) 'same)
(point)
here)))
,(c-make-font-lock-search-form regexp highlights))
@@ -1240,6 +1242,7 @@ casts and declarations are fontified. Used on level 2 and higher."
;; it finds any. That's necessary so that we later will
;; stop inside them to fontify types there.
(c-parse-and-markup-<>-arglists t)
+ lbrace ; position of some {.
;; The font-lock package in Emacs is known to clobber
;; `parse-sexp-lookup-properties' (when it exists).
(parse-sexp-lookup-properties
@@ -1351,7 +1354,6 @@ casts and declarations are fontified. Used on level 2 and higher."
(or (looking-at c-typedef-key)
(goto-char start-pos)))
- ;; Now analyze the construct.
;; In QT, "more" is an irritating keyword that expands to nothing.
;; We skip over it to prevent recognition of "more slots: <symbol>"
;; as a bitfield declaration.
@@ -1360,6 +1362,8 @@ casts and declarations are fontified. Used on level 2 and higher."
(concat "\\(more\\)\\([^" c-symbol-chars "]\\|$\\)")))
(goto-char (match-end 1))
(c-forward-syntactic-ws))
+
+ ;; Now analyze the construct.
(setq decl-or-cast (c-forward-decl-or-cast-1
match-pos context last-cast-end))
@@ -1428,6 +1432,39 @@ casts and declarations are fontified. Used on level 2 and higher."
(c-fontify-recorded-types-and-refs)
nil)
+ ;; Restore point, since at this point in the code it has been
+ ;; left undefined by c-forward-decl-or-cast-1 above.
+ ((progn (goto-char start-pos) nil))
+
+ ;; If point is inside a bracelist, there's no point checking it
+ ;; being at a declarator.
+ ((let ((paren-state (c-parse-state)))
+ (setq lbrace (c-cheap-inside-bracelist-p paren-state)))
+ ;; Move past this bracelist to prevent an endless loop.
+ (goto-char lbrace)
+ (unless (c-safe (progn (forward-list) t))
+ (goto-char start-pos)
+ (c-forward-token-2))
+ nil)
+
+ ;; If point is just after a ")" which is followed by an
+ ;; identifier which isn't a label, or at the matching "(", we're
+ ;; at either a macro invocation, a cast, or a
+ ;; for/while/etc. statement. The cast case is handled above.
+ ;; None of these cases can contain a declarator.
+ ((or (and (eq (char-before match-pos) ?\))
+ (c-on-identifier)
+ (save-excursion (not (c-forward-label))))
+ (and (eq (char-after) ?\()
+ (save-excursion
+ (and
+ (progn (c-backward-token-2) (c-on-identifier))
+ (save-excursion (not (c-forward-label)))
+ (progn (c-backward-token-2)
+ (eq (char-after) ?\())))))
+ (c-forward-token-2) ; Must prevent looping.
+ nil)
+
((and (not c-enums-contain-decls)
;; An optimization quickly to eliminate scans of long enum
;; declarations in the next cond arm.
@@ -1441,13 +1478,14 @@ casts and declarations are fontified. Used on level 2 and higher."
(progn
(c-backward-token-2)
(looking-at c-brace-list-key)))))))
- t)
+ (c-forward-token-2)
+ nil)
(t
;; Are we at a declarator? Try to go back to the declaration
;; to check this. If we get there, check whether a "typedef"
;; is there, then fontify the declarators accordingly.
- (let ((decl-search-lim (max (- (point) 50000) (point-min)))
+ (let ((decl-search-lim (c-determine-limit 1000))
paren-state bod-res encl-pos is-typedef
c-recognize-knr-p) ; Strictly speaking, bogus, but it
; 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."
(make-local-variable 'paragraph-ignore-fill-prefix)
(make-local-variable 'adaptive-fill-mode)
(make-local-variable 'adaptive-fill-regexp)
+ (make-local-variable 'fill-paragraph-handle-comment)
;; now set their values
(set (make-local-variable 'parse-sexp-ignore-comments) t)
@@ -500,6 +501,9 @@ that requires a literal mode spec at compile time."
(set (make-local-variable 'comment-line-break-function)
'c-indent-new-comment-line)
+ ;; For the benefit of adaptive file, which otherwise mis-fills.
+ (setq fill-paragraph-handle-comment nil)
+
;; Install `c-fill-paragraph' on `fill-paragraph-function' so that a
;; direct call to `fill-paragraph' behaves better. This still
;; 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."
(defun display-delayed-warnings ()
"Display delayed warnings from `delayed-warnings-list'.
-This is the default value of `delayed-warnings-hook'."
+Used from `delayed-warnings-hook' (which see)."
(dolist (warning (nreverse delayed-warnings-list))
(apply 'display-warning warning))
(setq delayed-warnings-list nil))
-(defvar delayed-warnings-hook '(display-delayed-warnings)
+(defun collapse-delayed-warnings ()
+ "Remove duplicates from `delayed-warnings-list'.
+Collapse identical adjacent warnings into one (plus count).
+Used from `delayed-warnings-hook' (which see)."
+ (let ((count 1)
+ collapsed warning)
+ (while delayed-warnings-list
+ (setq warning (pop delayed-warnings-list))
+ (if (equal warning (car delayed-warnings-list))
+ (setq count (1+ count))
+ (when (> count 1)
+ (setcdr warning (cons (format "%s [%d times]" (cadr warning) count)
+ (cddr warning)))
+ (setq count 1))
+ (push warning collapsed)))
+ (setq delayed-warnings-list (nreverse collapsed))))
+
+(defvar delayed-warnings-hook '(collapse-delayed-warnings
+ display-delayed-warnings)
"Normal hook run to process delayed warnings.
Functions in this hook should access the `delayed-warnings-list'
variable (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 @@
;;; Commentary:
-;; PCL-CVS is a front-end to the CVS version control system. For people
-;; familiar with VC, it is somewhat like VC-dired: it presents the status of
-;; all the files in your working area and allows you to commit/update several
-;; of them at a time. Compared to VC-dired, it is considerably better and
-;; faster (but only for CVS).
+;; PCL-CVS is a front-end to the CVS version control system.
+;; It presents the status of all the files in your working area and
+;; allows you to commit/update several of them at a time.
+;; Compare with the general Emacs utility vc-dir, which tries
+;; to be VCS-agnostic. You may find PCL-CVS better/faster for CVS.
;; PCL-CVS was originally written by Per Cederqvist many years ago. This
;; version derives from the XEmacs-21 version, itself based on the 2.0b2
;; version (last release from Per). It is a thorough rework.
-;; Contrary to what you'd expect, PCL-CVS is not a replacement for VC but only
-;; for VC-dired. As such, I've tried to make PCL-CVS and VC interoperate
-;; seamlessly (I also use VC).
+;; PCL-CVS is not a replacement for VC, but adds extra functionality.
+;; As such, I've tried to make PCL-CVS and VC interoperate seamlessly
+;; (I also use VC).
;; To use PCL-CVS just use `M-x cvs-examine RET <dir> RET'.
;; 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
;; Return a dav-specific mode line string for URL. Are there any
;; specific states that we want exposed?
;;
-;; vc-dav-dired-state-info(url)
-;; Translate the `vc-state' property of URL into a string that can
-;; be used in a vc-dired buffer. Are there any extra states that
-;; we want exposed?
+;; vc-dir support
;;
;; vc-dav-receive-file(url rev)
;; 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."
(- (nth 3 edges) 1))))
(cond
((> effective-arg 0)
- top-left)
+ top-left)
((< effective-arg 0)
- bottom-right)
+ bottom-right)
((= effective-arg 0)
- (windmove-coord-add
- top-left
- (let ((col-row
- (posn-col-row
- (posn-at-point (window-point window) window))))
- (cons (- (car col-row) (window-hscroll window))
- (cdr col-row)))))))))
+ (windmove-coord-add
+ top-left
+ ;; Don't care whether window is horizontally scrolled -
+ ;; `posn-at-point' handles that already. See also:
+ ;; http://lists.gnu.org/archive/html/emacs-devel/2012-01/msg00638.html
+ (posn-col-row
+ (posn-at-point (window-point window) window))))))))
;; This uses the reference location in the current window (calculated
;; 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."
))
;;; Window states, how to get them and how to put them in a window.
-(defun window--state-get-1 (window &optional ignore)
+(defun window--state-get-1 (window &optional writable)
"Helper function for `window-state-get'."
(let* ((type
(cond
@@ -3585,29 +3585,22 @@ specific buffers."
(normal-height . ,(window-normal-size window))
(normal-width . ,(window-normal-size window t))
(combination-limit . ,(window-combination-limit window))
- ,@(let (list)
- ;; Make copies of persistent window parameters whose cdr
- ;; is either t or, when IGNORE is non-nil, is either nil
- ;; or `state'.
- (dolist (pers window-persistent-parameters)
- (when (and (consp pers)
- (or (eq (cdr pers) t)
- (and (memq (cdr pers) '(state nil))
- (not ignore))))
- (let ((par (assq (car pers) (window-parameters window))))
- (setq list (cons (cons (car pers) (when par (cdr par)))
- list)))))
- ;; Save `clone-of' parameter unless IGNORE or
- ;; `window-persistent-parameters' prevail.
- (when (and (not (assq 'clone-of (window-parameters window)))
- (let ((clone-of
- (assq 'clone-of
- window-persistent-parameters)))
- (when clone-of
- (if ignore
- (eq (cdr clone-of) t)
- (memq (cdr clone-of) '(state nil))))))
- (setq list (cons (cons 'clone-of window) list)))
+ ,@(let ((parameters (window-parameters window))
+ list)
+ ;; Make copies of those window parameters whose
+ ;; persistence property is `writable' if WRITABLE is
+ ;; non-nil and non-nil if WRITABLE is nil.
+ (dolist (par parameters)
+ (let ((pers (cdr (assq (car par)
+ window-persistent-parameters))))
+ (when (and pers (or (not writable) (eq pers 'writable)))
+ (setq list (cons (cons (car par) (cdr par)) list)))))
+ ;; Add `clone-of' parameter if necessary.
+ (let ((pers (cdr (assq 'clone-of
+ window-persistent-parameters))))
+ (when (and pers (or (not writable) (eq pers 'writable))
+ (not (assq 'clone-of list)))
+ (setq list (cons (cons 'clone-of window) list))))
(when list
`((parameters . ,list))))
,@(when buffer
@@ -3628,31 +3621,34 @@ specific buffers."
(scroll-bars . ,(window-scroll-bars window))
(vscroll . ,(window-vscroll window))
(dedicated . ,(window-dedicated-p window))
- (point . ,(if ignore point (copy-marker point)))
- (start . ,(if ignore start (copy-marker start)))
+ (point . ,(if writable point (copy-marker point)))
+ (start . ,(if writable start (copy-marker start)))
,@(when mark
- `((mark . ,(if ignore
+ `((mark . ,(if writable
mark (copy-marker mark))))))))))))
(tail
(when (memq type '(vc hc))
(let (list)
(setq window (window-child window))
(while window
- (setq list (cons (window--state-get-1 window ignore) list))
+ (setq list (cons (window--state-get-1 window writable) list))
(setq window (window-right window)))
(nreverse list)))))
(append head tail)))
-(defun window-state-get (&optional window ignore)
+(defun window-state-get (&optional window writable)
"Return state of WINDOW as a Lisp object.
WINDOW can be any window and defaults to the root window of the
selected frame.
-Optional argument IGNORE non-nil means do not use markers for
-sampling positions like `window-point' or `window-start' and do
-not record parameters unless `window-persistent-parameters'
-requests it. IGNORE should be non-nil when the return value
-shall be written to a file and read back in another session.
+Optional argument WRITABLE non-nil means do not use markers for
+sampling `window-point' and `window-start'. Together, WRITABLE
+and the variable `window-persistent-parameters' specify which
+window parameters are saved by this function. WRITABLE should be
+non-nil when the return value shall be written to a file and read
+back in another session. Otherwise, an application may run into
+an `invalid-read-syntax' error while attempting to read back the
+value from file.
The return value can be used as argument for `window-state-put'
to 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."
;; These are probably not needed.
,@(when (window-size-fixed-p window) `((fixed-height . t)))
,@(when (window-size-fixed-p window t) `((fixed-width . t))))
- (window--state-get-1 window ignore)))
+ (window--state-get-1 window writable)))
(defvar window-state-put-list nil
"Helper variable for `window-state-put'.")
@@ -3757,15 +3753,13 @@ value can be also stored on disk and read back in a new session."
(state (cdr (assq 'buffer item))))
(when combination-limit
(set-window-combination-limit window combination-limit))
- ;; Assign saved window parameters. If a parameter's value is nil,
- ;; don't assign it unless the new window has it set already (which
- ;; shouldn't happen unless some `window-configuration-change-hook'
- ;; function installed it).
+ ;; Reset window's parameters and assign saved ones (we might want
+ ;; a `remove-window-parameters' function here).
+ (dolist (parameter (window-parameters window))
+ (set-window-parameter window (car parameter) nil))
(when parameters
(dolist (parameter parameters)
- (when (or (cdr parameter)
- (window-parameter window (car parameter)))
- (set-window-parameter window (car parameter) (cdr parameter)))))
+ (set-window-parameter window (car parameter) (cdr parameter))))
;; Process buffer related state.
(when state
;; We don't want to raise an error here so we create a buffer if