aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog58
-rw-r--r--lisp/doc-view.el20
-rw-r--r--lisp/epg.el13
-rw-r--r--lisp/erc/ChangeLog4
-rw-r--r--lisp/erc/erc-backend.el4
-rw-r--r--lisp/files.el3
-rw-r--r--lisp/icomplete.el10
-rw-r--r--lisp/net/tramp-sh.el28
-rw-r--r--lisp/progmodes/etags.el11
-rw-r--r--lisp/subr.el4
-rw-r--r--lisp/term.el18
-rw-r--r--lisp/view.el34
12 files changed, 147 insertions, 60 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3aae01b9f1e..5b54d34743c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,59 @@
12013-01-04 Daiki Ueno <ueno@gnu.org>
2
3 * epg.el: Silence byte-compiler warnings.
4 (epg--start): Use delete-char instead of delete-backward-char.
5 (epg-wait-for-completion): Pass FRAME arg to redraw-frame.
6
72013-01-04 Daiki Ueno <ueno@gnu.org>
8
9 * epg.el (epg--start): Don't call "tty" program on W32 platforms.
10 Suggested by Eli Zaretskii <eliz@gnu.org>.
11
122013-01-04 Michael Albinus <michael.albinus@gmx.de>
13
14 * net/tramp-sh.el (tramp-set-file-uid-gid): UID and GID must be
15 non-negative integers. Otherwise, the default values are used.
16 (tramp-convert-file-attributes): Convert uid and gid to integers.
17
182013-01-04 Glenn Morris <rgm@gnu.org>
19
20 * term.el (term-handle-colors-array): Ensure face attributes
21 are fully specified, not nil. (Bug#13337)
22
23 * term.el (term-default-fg-color, term-default-bg-color):
24 Fix custom type.
25
26 * progmodes/etags.el (tags-compression-info-list): Doc fix.
27 (tag-find-file-of-tag-noselect): Check auto-compression-mode
28 rather than 'jka-compr being loaded. (Bug#13338)
29
302013-01-04 Wesley Dawson <whd@lavabit.com> (tiny change)
31
32 * icomplete.el (icomplete-completions):
33 Honor icomplete-prospects-height once more following
34 2012-11-29 changes. (Bug#13224)
35
362013-01-04 Stefan Monnier <monnier@iro.umontreal.ca>
37
38 * subr.el (internal--called-interactively-p--get-frame): Find aliases
39 of called-interactively-p as well (bug#13237).
40
41 * view.el (view--enable, view--disable): Rename from view-mode-enable
42 and view-mode-disable and assume it's called from view-mode.
43 (view-mode-enable, view-mode-disable): Redefine as obsolete
44 compatibility layer above view-mode.
45 (view-mode-enter): Call `view-mode'.
46
47 * files.el (after-find-file): Call `view-mode'.
48
49 * doc-view.el (doc-view-scale-internally): New var.
50 (doc-view-enlarge, doc-view-insert-image): Obey it.
51
522013-01-03 Daiki Ueno <ueno@gnu.org>
53
54 * epg.el (epg--start): Ignore errors when /dev/fd/0 does not
55 exist. (Bug#13344)
56
12013-01-03 Glenn Morris <rgm@gnu.org> 572013-01-03 Glenn Morris <rgm@gnu.org>
2 58
3 * mail/rmail.el (rmail-set-header-1): Ignore case. 59 * mail/rmail.el (rmail-set-header-1): Ignore case.
@@ -338,6 +394,8 @@
338 (lm-homepage): New function. 394 (lm-homepage): New function.
339 (lm-with-file): Don't be confused if narrowing is in effect. 395 (lm-with-file): Don't be confused if narrowing is in effect.
340 396
3972012-12-19 Stefan Monnier <monnier@iro.umontreal.ca>
398
341 * vc/diff-mode.el (diff-post-command-hook): Don't ignore changes at the 399 * vc/diff-mode.el (diff-post-command-hook): Don't ignore changes at the
342 very beginning of a hunk (e.g. killing the first line). 400 very beginning of a hunk (e.g. killing the first line).
343 401
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index ad1ff848112..24434d294c6 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -173,9 +173,17 @@ Higher values result in larger images."
173 :type 'number 173 :type 'number
174 :group 'doc-view) 174 :group 'doc-view)
175 175
176(defcustom doc-view-scale-internally t
177 "Whether we should try to rescale images ourselves.
178If nil, the document is re-rendered every time the scaling factor is modified.
179This only has an effect if the image libraries linked with Emacs support
180scaling."
181 :type 'boolean)
182
176(defcustom doc-view-image-width 850 183(defcustom doc-view-image-width 850
177 "Default image width. 184 "Default image width.
178Has only an effect if imagemagick support is compiled into emacs." 185Has only an effect if `doc-view-scale-internally' is non-nil and support for
186scaling is compiled into emacs."
179 :version "24.1" 187 :version "24.1"
180 :type 'number 188 :type 'number
181 :group 'doc-view) 189 :group 'doc-view)
@@ -669,8 +677,9 @@ OpenDocument format)."
669(defun doc-view-enlarge (factor) 677(defun doc-view-enlarge (factor)
670 "Enlarge the document by FACTOR." 678 "Enlarge the document by FACTOR."
671 (interactive (list doc-view-shrink-factor)) 679 (interactive (list doc-view-shrink-factor))
672 (if (eq (plist-get (cdr (doc-view-current-image)) :type) 680 (if (and doc-view-scale-internally
673 'imagemagick) 681 (eq (plist-get (cdr (doc-view-current-image)) :type)
682 'imagemagick))
674 ;; ImageMagick supports on-the-fly-rescaling. 683 ;; ImageMagick supports on-the-fly-rescaling.
675 (let ((new (ceiling (* factor doc-view-image-width)))) 684 (let ((new (ceiling (* factor doc-view-image-width))))
676 (unless (equal new doc-view-image-width) 685 (unless (equal new doc-view-image-width)
@@ -1133,10 +1142,11 @@ ARGS is a list of image descriptors."
1133 (setq doc-view-pending-cache-flush nil)) 1142 (setq doc-view-pending-cache-flush nil))
1134 (let ((ol (doc-view-current-overlay)) 1143 (let ((ol (doc-view-current-overlay))
1135 (image (if (and file (file-readable-p file)) 1144 (image (if (and file (file-readable-p file))
1136 (if (not (fboundp 'imagemagick-types)) 1145 (if (not (and doc-view-scale-internally
1146 (fboundp 'imagemagick-types)))
1137 (apply 'create-image file 'png nil args) 1147 (apply 'create-image file 'png nil args)
1138 (unless (member :width args) 1148 (unless (member :width args)
1139 (setq args (append args (list :width doc-view-image-width)))) 1149 (setq args `(,@args :width ,doc-view-image-width)))
1140 (apply 'create-image file 'imagemagick nil args)))) 1150 (apply 'create-image file 'imagemagick nil args))))
1141 (slice (doc-view-current-slice))) 1151 (slice (doc-view-current-slice)))
1142 (setf (doc-view-current-image) image) 1152 (setf (doc-view-current-image) image)
diff --git a/lisp/epg.el b/lisp/epg.el
index 6be3ba15a97..3f04aa2e07a 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -1166,10 +1166,13 @@ This function is for internal use only."
1166 ;; Set GPG_TTY and TERM for pinentry-curses. Note that we can't 1166 ;; Set GPG_TTY and TERM for pinentry-curses. Note that we can't
1167 ;; use `terminal-name' here to get the real pty name for the child 1167 ;; use `terminal-name' here to get the real pty name for the child
1168 ;; process, though /dev/fd/0" is not portable. 1168 ;; process, though /dev/fd/0" is not portable.
1169 (with-temp-buffer 1169 (unless (memq system-type '(ms-dos windows-nt))
1170 (when (= (call-process "tty" "/dev/fd/0" t) 0) 1170 (with-temp-buffer
1171 (delete-backward-char 1) 1171 (condition-case nil
1172 (setq terminal-name (buffer-string)))) 1172 (when (= (call-process "tty" "/dev/fd/0" t) 0)
1173 (delete-char -1)
1174 (setq terminal-name (buffer-string)))
1175 (file-error))))
1173 (when terminal-name 1176 (when terminal-name
1174 (setq process-environment 1177 (setq process-environment
1175 (cons (concat "GPG_TTY=" terminal-name) 1178 (cons (concat "GPG_TTY=" terminal-name)
@@ -1297,7 +1300,7 @@ This function is for internal use only."
1297 (> (float-time (or (nth 5 (file-attributes epg-agent-file)) 1300 (> (float-time (or (nth 5 (file-attributes epg-agent-file))
1298 '(0 0 0 0))) 1301 '(0 0 0 0)))
1299 (float-time epg-agent-mtime)))) 1302 (float-time epg-agent-mtime))))
1300 (redraw-frame)) 1303 (redraw-frame (selected-frame)))
1301 (epg-context-set-result-for 1304 (epg-context-set-result-for
1302 context 'error 1305 context 'error
1303 (nreverse (epg-context-result-for context 'error)))) 1306 (nreverse (epg-context-result-for context 'error))))
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog
index 0366addacfc..3a625eb215e 100644
--- a/lisp/erc/ChangeLog
+++ b/lisp/erc/ChangeLog
@@ -1,3 +1,7 @@
12013-01-04 Glenn Morris <rgm@gnu.org>
2
3 * erc-backend.el (312): Fix typo. (Bug#13235)
4
12012-11-30 Glenn Morris <rgm@gnu.org> 52012-11-30 Glenn Morris <rgm@gnu.org>
2 6
3 * erc.el (erc-accidental-paste-threshold-seconds): Add :version. 7 * erc.el (erc-accidental-paste-threshold-seconds): Add :version.
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index c8b7286c7dd..3d3ac791f08 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -1633,8 +1633,8 @@ See `erc-display-server-message'." nil
1633 1633
1634(define-erc-response-handler (312) 1634(define-erc-response-handler (312)
1635 "Server name response in WHOIS." nil 1635 "Server name response in WHOIS." nil
1636 (pcase-let ((`(,nick ,server-host)) 1636 (pcase-let ((`(,nick ,server-host)
1637 (cdr (erc-response.command-args parsed))) 1637 (cdr (erc-response.command-args parsed))))
1638 (erc-display-message 1638 (erc-display-message
1639 parsed 'notice 'active 's312 1639 parsed 'notice 'active 's312
1640 ?n nick ?s server-host ?c (erc-response.contents parsed)))) 1640 ?n nick ?s server-host ?c (erc-response.contents parsed))))
diff --git a/lisp/files.el b/lisp/files.el
index 6a2945cbc79..ca5a415fb8e 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -209,7 +209,6 @@ have fast storage with limited space, such as a RAM disk."
209(declare-function dired-unmark "dired" (arg)) 209(declare-function dired-unmark "dired" (arg))
210(declare-function dired-do-flagged-delete "dired" (&optional nomessage)) 210(declare-function dired-do-flagged-delete "dired" (&optional nomessage))
211(declare-function dos-8+3-filename "dos-fns" (filename)) 211(declare-function dos-8+3-filename "dos-fns" (filename))
212(declare-function view-mode-disable "view" ())
213(declare-function dosified-file-name "dos-fns" (file-name)) 212(declare-function dosified-file-name "dos-fns" (file-name))
214 213
215(defvar file-name-invalid-regexp 214(defvar file-name-invalid-regexp
@@ -2125,7 +2124,7 @@ unless NOMODES is non-nil."
2125 (setq buffer-read-only t)) 2124 (setq buffer-read-only t))
2126 (unless nomodes 2125 (unless nomodes
2127 (when (and view-read-only view-mode) 2126 (when (and view-read-only view-mode)
2128 (view-mode-disable)) 2127 (view-mode -1))
2129 (normal-mode t) 2128 (normal-mode t)
2130 ;; If requested, add a newline at the end of the file. 2129 ;; If requested, add a newline at the end of the file.
2131 (and (memq require-final-newline '(visit visit-save)) 2130 (and (memq require-final-newline '(visit visit-save))
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index 0493a5b49e8..9407de4f6d9 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -343,8 +343,10 @@ are exhibited within the square braces.)"
343 (t (concat "…" (substring most compare)))) 343 (t (concat "…" (substring most compare))))
344 close-bracket))) 344 close-bracket)))
345 ;;"-prospects" - more than one candidate 345 ;;"-prospects" - more than one candidate
346 (prospects-len (+ (length determ) 6 ;; take {,...} into account 346 (prospects-len (+ (length determ)
347 (string-width (buffer-string)))) 347 (string-width icomplete-separator)
348 3 ;; take {…} into account
349 (string-width (buffer-string))))
348 (prospects-max 350 (prospects-max
349 ;; Max total length to use, including the minibuffer content. 351 ;; Max total length to use, including the minibuffer content.
350 (* (+ icomplete-prospects-height 352 (* (+ icomplete-prospects-height
@@ -375,7 +377,9 @@ are exhibited within the square braces.)"
375 (cond ((string-equal comp "") (setq most-is-exact t)) 377 (cond ((string-equal comp "") (setq most-is-exact t))
376 ((member comp prospects)) 378 ((member comp prospects))
377 (t (setq prospects-len 379 (t (setq prospects-len
378 (+ (string-width comp) 1 prospects-len)) 380 (+ (string-width comp)
381 (string-width icomplete-separator)
382 prospects-len))
379 (if (< prospects-len prospects-max) 383 (if (< prospects-len prospects-max)
380 (push comp prospects) 384 (push comp prospects)
381 (setq limit t)))))) 385 (setq limit t))))))
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 5bbf1708654..79f8d82b02b 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1452,23 +1452,22 @@ of."
1452(defun tramp-set-file-uid-gid (filename &optional uid gid) 1452(defun tramp-set-file-uid-gid (filename &optional uid gid)
1453 "Set the ownership for FILENAME. 1453 "Set the ownership for FILENAME.
1454If UID and GID are provided, these values are used; otherwise uid 1454If UID and GID are provided, these values are used; otherwise uid
1455and gid of the corresponding user is taken. Both parameters must be integers." 1455and gid of the corresponding user is taken. Both parameters must
1456be non-negative integers."
1456 ;; Modern Unices allow chown only for root. So we might need 1457 ;; Modern Unices allow chown only for root. So we might need
1457 ;; another implementation, see `dired-do-chown'. OTOH, it is mostly 1458 ;; another implementation, see `dired-do-chown'. OTOH, it is mostly
1458 ;; working with su(do)? when it is needed, so it shall succeed in 1459 ;; working with su(do)? when it is needed, so it shall succeed in
1459 ;; the majority of cases. 1460 ;; the majority of cases.
1460 ;; Don't modify `last-coding-system-used' by accident. 1461 ;; Don't modify `last-coding-system-used' by accident.
1461 (let ((last-coding-system-used last-coding-system-used) 1462 (let ((last-coding-system-used last-coding-system-used))
1462 (uid (and (numberp uid) (round uid)))
1463 (gid (and (numberp gid) (round gid))))
1464 (if (file-remote-p filename) 1463 (if (file-remote-p filename)
1465 (with-parsed-tramp-file-name filename nil 1464 (with-parsed-tramp-file-name filename nil
1466 (if (and (zerop (user-uid)) (tramp-local-host-p v)) 1465 (if (and (zerop (user-uid)) (tramp-local-host-p v))
1467 ;; If we are root on the local host, we can do it directly. 1466 ;; If we are root on the local host, we can do it directly.
1468 (tramp-set-file-uid-gid localname uid gid) 1467 (tramp-set-file-uid-gid localname uid gid)
1469 (let ((uid (or (and (integerp uid) uid) 1468 (let ((uid (or (and (natnump uid) uid)
1470 (tramp-get-remote-uid v 'integer))) 1469 (tramp-get-remote-uid v 'integer)))
1471 (gid (or (and (integerp gid) gid) 1470 (gid (or (and (natnump gid) gid)
1472 (tramp-get-remote-gid v 'integer)))) 1471 (tramp-get-remote-gid v 'integer))))
1473 (tramp-send-command 1472 (tramp-send-command
1474 v (format 1473 v (format
@@ -1477,8 +1476,8 @@ and gid of the corresponding user is taken. Both parameters must be integers."
1477 1476
1478 ;; We handle also the local part, because there doesn't exist 1477 ;; We handle also the local part, because there doesn't exist
1479 ;; `set-file-uid-gid'. On W32 "chown" might not work. 1478 ;; `set-file-uid-gid'. On W32 "chown" might not work.
1480 (let ((uid (or (and (integerp uid) uid) (tramp-get-local-uid 'integer))) 1479 (let ((uid (or (and (natnump uid) uid) (tramp-get-local-uid 'integer)))
1481 (gid (or (and (integerp gid) gid) (tramp-get-local-gid 'integer)))) 1480 (gid (or (and (natnump gid) gid) (tramp-get-local-gid 'integer))))
1482 (tramp-compat-call-process 1481 (tramp-compat-call-process
1483 "chown" nil nil nil 1482 "chown" nil nil nil
1484 (format "%d:%d" uid gid) (tramp-shell-quote-argument filename)))))) 1483 (format "%d:%d" uid gid) (tramp-shell-quote-argument filename))))))
@@ -4665,7 +4664,7 @@ raises an error."
4665 command (buffer-string)))))))) 4664 command (buffer-string))))))))
4666 4665
4667(defun tramp-convert-file-attributes (vec attr) 4666(defun tramp-convert-file-attributes (vec attr)
4668 "Convert file-attributes ATTR generated by perl script, stat or ls. 4667 "Convert `file-attributes' ATTR generated by perl script, stat or ls.
4669Convert file mode bits to string and set virtual device number. 4668Convert file mode bits to string and set virtual device number.
4670Return ATTR." 4669Return ATTR."
4671 (when attr 4670 (when attr
@@ -4673,6 +4672,17 @@ Return ATTR."
4673 (when (stringp (car attr)) 4672 (when (stringp (car attr))
4674 (while (string-match tramp-color-escape-sequence-regexp (car attr)) 4673 (while (string-match tramp-color-escape-sequence-regexp (car attr))
4675 (setcar attr (replace-match "" nil nil (car attr))))) 4674 (setcar attr (replace-match "" nil nil (car attr)))))
4675 ;; Convert uid and gid. Use -1 as indication of unusable value.
4676 (when (and (numberp (nth 2 attr)) (< (nth 2 attr) 0))
4677 (setcar (nthcdr 2 attr) -1))
4678 (when (and (floatp (nth 2 attr))
4679 (<= (nth 2 attr) (tramp-compat-most-positive-fixnum)))
4680 (setcar (nthcdr 2 attr) (round (nth 2 attr))))
4681 (when (and (numberp (nth 3 attr)) (< (nth 3 attr) 0))
4682 (setcar (nthcdr 3 attr) -1))
4683 (when (and (floatp (nth 3 attr))
4684 (<= (nth 3 attr) (tramp-compat-most-positive-fixnum)))
4685 (setcar (nthcdr 3 attr) (round (nth 3 attr))))
4676 ;; Convert last access time. 4686 ;; Convert last access time.
4677 (unless (listp (nth 4 attr)) 4687 (unless (listp (nth 4 attr))
4678 (setcar (nthcdr 4 attr) 4688 (setcar (nthcdr 4 attr)
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 0dfc7f27a9c..81dc31792c3 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -67,11 +67,8 @@ Use the `etags' program to make a tags table file."
67;;;###autoload 67;;;###autoload
68(defcustom tags-compression-info-list 68(defcustom tags-compression-info-list
69 (purecopy '("" ".Z" ".bz2" ".gz" ".xz" ".tgz")) 69 (purecopy '("" ".Z" ".bz2" ".gz" ".xz" ".tgz"))
70 "List of extensions tried by etags when jka-compr is used. 70 "List of extensions tried by etags when `auto-compression-mode' is on.
71An empty string means search the non-compressed file. 71An empty string means search the non-compressed file."
72These extensions will be tried only if jka-compr was activated
73\(i.e. via customize of `auto-compression-mode' or by calling the function
74`auto-compression-mode')."
75 :version "24.1" ; added xz 72 :version "24.1" ; added xz
76 :type '(repeat string) 73 :type '(repeat string)
77 :group 'etags) 74 :group 'etags)
@@ -1182,7 +1179,7 @@ error message."
1182 "Find the right line in the specified FILE." 1179 "Find the right line in the specified FILE."
1183 ;; If interested in compressed-files, search files with extensions. 1180 ;; If interested in compressed-files, search files with extensions.
1184 ;; Otherwise, search only the real file. 1181 ;; Otherwise, search only the real file.
1185 (let* ((buffer-search-extensions (if (featurep 'jka-compr) 1182 (let* ((buffer-search-extensions (if auto-compression-mode
1186 tags-compression-info-list 1183 tags-compression-info-list
1187 '(""))) 1184 '("")))
1188 the-buffer 1185 the-buffer
@@ -1206,7 +1203,7 @@ error message."
1206 (setq file-search-extensions (cdr file-search-extensions)) 1203 (setq file-search-extensions (cdr file-search-extensions))
1207 (setq the-buffer (find-file-noselect (concat file (car file-search-extensions)))))) 1204 (setq the-buffer (find-file-noselect (concat file (car file-search-extensions))))))
1208 (if (not the-buffer) 1205 (if (not the-buffer)
1209 (if (featurep 'jka-compr) 1206 (if auto-compression-mode
1210 (error "File %s (with or without extensions %s) not found" file tags-compression-info-list) 1207 (error "File %s (with or without extensions %s) not found" file tags-compression-info-list)
1211 (error "File %s not found" file)) 1208 (error "File %s not found" file))
1212 (set-buffer the-buffer)))) 1209 (set-buffer the-buffer))))
diff --git a/lisp/subr.el b/lisp/subr.el
index 7ca0169abdb..11e882d9158 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3977,8 +3977,8 @@ the number of frames to skip (minus 1).")
3977 `(progn 3977 `(progn
3978 (defvar ,sym 3978 (defvar ,sym
3979 (let ((i 1)) 3979 (let ((i 1))
3980 (while (not (eq (nth 1 (backtrace-frame i)) 3980 (while (not (eq (indirect-function (nth 1 (backtrace-frame i)) t)
3981 'called-interactively-p)) 3981 (indirect-function 'called-interactively-p)))
3982 (setq i (1+ i))) 3982 (setq i (1+ i)))
3983 i)) 3983 i))
3984 ;; (unless (eq (nth 1 (backtrace-frame ,sym)) 'called-interactively-p) 3984 ;; (unless (eq (nth 1 (backtrace-frame ,sym)) 'called-interactively-p)
diff --git a/lisp/term.el b/lisp/term.el
index fc7ec3ad0f9..b37e71280da 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -778,14 +778,14 @@ Buffer local variable.")
778(defcustom term-default-fg-color nil 778(defcustom term-default-fg-color nil
779 "If non-nil, default color for foreground in Term mode." 779 "If non-nil, default color for foreground in Term mode."
780 :group 'term 780 :group 'term
781 :type 'string) 781 :type '(choice (const nil) (string :tag "color")))
782(make-obsolete-variable 'term-default-fg-color "use the face `term' instead." 782(make-obsolete-variable 'term-default-fg-color "use the face `term' instead."
783 "24.3") 783 "24.3")
784 784
785(defcustom term-default-bg-color nil 785(defcustom term-default-bg-color nil
786 "If non-nil, default color for foreground in Term mode." 786 "If non-nil, default color for foreground in Term mode."
787 :group 'term 787 :group 'term
788 :type 'string) 788 :type '(choice (const nil) (string :tag "color")))
789(make-obsolete-variable 'term-default-bg-color "use the face `term' instead." 789(make-obsolete-variable 'term-default-bg-color "use the face `term' instead."
790 "24.3") 790 "24.3")
791 791
@@ -3222,18 +3222,24 @@ See `term-prompt-regexp'."
3222 (let ((color 3222 (let ((color
3223 (if term-ansi-current-reverse 3223 (if term-ansi-current-reverse
3224 (face-foreground 3224 (face-foreground
3225 (elt ansi-term-color-vector term-ansi-current-color)) 3225 (elt ansi-term-color-vector term-ansi-current-color)
3226 nil 'default)
3226 (face-background 3227 (face-background
3227 (elt ansi-term-color-vector term-ansi-current-bg-color))))) 3228 (elt ansi-term-color-vector term-ansi-current-bg-color)
3229 nil 'default))))
3228 (setq term-current-face 3230 (setq term-current-face
3229 (list :background color 3231 (list :background color
3230 :foreground color)) 3232 :foreground color))
3231 ) ;; No need to bother with anything else if it's invisible. 3233 ) ;; No need to bother with anything else if it's invisible.
3232 (setq term-current-face 3234 (setq term-current-face
3233 (list :foreground 3235 (list :foreground
3234 (face-foreground (elt ansi-term-color-vector term-ansi-current-color)) 3236 (face-foreground
3237 (elt ansi-term-color-vector term-ansi-current-color)
3238 nil 'default)
3235 :background 3239 :background
3236 (face-background (elt ansi-term-color-vector term-ansi-current-bg-color)) 3240 (face-background
3241 (elt ansi-term-color-vector term-ansi-current-bg-color)
3242 nil 'default)
3237 :inverse-video term-ansi-current-reverse)) 3243 :inverse-video term-ansi-current-reverse))
3238 3244
3239 (when term-ansi-current-bold 3245 (when term-ansi-current-bold
diff --git a/lisp/view.el b/lisp/view.el
index 5a28415ec7a..2717c915c71 100644
--- a/lisp/view.el
+++ b/lisp/view.el
@@ -461,16 +461,13 @@ then \\[View-leave], \\[View-quit] and \\[View-kill-and-leave] will return to th
461 461
462Entry to view-mode runs the normal hook `view-mode-hook'." 462Entry to view-mode runs the normal hook `view-mode-hook'."
463 :lighter " View" :keymap view-mode-map 463 :lighter " View" :keymap view-mode-map
464 (if view-mode (view-mode-enable) (view-mode-disable))) 464 (if view-mode (view--enable) (view--disable)))
465 465
466(defun view-mode-enable (&optional run-view-mode-hook) 466(defun view--enable ()
467 "Turn on View mode.
468Run `view-mode-hook' when RUN-VIEW-MODE-HOOK is non-nil."
469 ;; Always leave view mode before changing major mode. 467 ;; Always leave view mode before changing major mode.
470 ;; This is to guarantee that the buffer-read-only variable is restored. 468 ;; This is to guarantee that the buffer-read-only variable is restored.
471 (add-hook 'change-major-mode-hook 'view-mode-disable nil t) 469 (add-hook 'change-major-mode-hook 'view--disable nil t)
472 (setq view-mode t 470 (setq view-page-size nil
473 view-page-size nil
474 view-half-page-size nil 471 view-half-page-size nil
475 view-old-buffer-read-only buffer-read-only 472 view-old-buffer-read-only buffer-read-only
476 buffer-read-only t) 473 buffer-read-only t)
@@ -481,16 +478,18 @@ Run `view-mode-hook' when RUN-VIEW-MODE-HOOK is non-nil."
481 (format "continue viewing %s" 478 (format "continue viewing %s"
482 (if (buffer-file-name) 479 (if (buffer-file-name)
483 (file-name-nondirectory (buffer-file-name)) 480 (file-name-nondirectory (buffer-file-name))
484 (buffer-name))))) 481 (buffer-name))))))
485 (force-mode-line-update)
486 (when run-view-mode-hook
487 (run-hooks 'view-mode-hook)))
488 482
483
484(define-obsolete-function-alias 'view-mode-enable 'view-mode "24.4")
489(defun view-mode-disable () 485(defun view-mode-disable ()
490 "Turn off View mode." 486 "Turn off View mode."
491 (remove-hook 'change-major-mode-hook 'view-mode-disable t) 487 (declare (obsolete view-mode "24.4"))
488 (view-mode -1))
489
490(defun view--disable ()
491 (remove-hook 'change-major-mode-hook 'view--disable t)
492 (and view-overlay (delete-overlay view-overlay)) 492 (and view-overlay (delete-overlay view-overlay))
493 (force-mode-line-update)
494 ;; Calling toggle-read-only while View mode is enabled 493 ;; Calling toggle-read-only while View mode is enabled
495 ;; sets view-read-only to t as a buffer-local variable 494 ;; sets view-read-only to t as a buffer-local variable
496 ;; after exiting View mode. That arranges that the next toggle-read-only 495 ;; after exiting View mode. That arranges that the next toggle-read-only
@@ -499,7 +498,6 @@ Run `view-mode-hook' when RUN-VIEW-MODE-HOOK is non-nil."
499 ;; so that View mode stays off if toggle-read-only is called. 498 ;; so that View mode stays off if toggle-read-only is called.
500 (if (local-variable-p 'view-read-only) 499 (if (local-variable-p 'view-read-only)
501 (kill-local-variable 'view-read-only)) 500 (kill-local-variable 'view-read-only))
502 (setq view-mode nil)
503 (if (boundp 'Helper-return-blurb) 501 (if (boundp 'Helper-return-blurb)
504 (setq Helper-return-blurb view-old-Helper-return-blurb)) 502 (setq Helper-return-blurb view-old-Helper-return-blurb))
505 (if buffer-read-only 503 (if buffer-read-only
@@ -562,8 +560,7 @@ This function runs the normal hook `view-mode-hook'."
562 (setq view-exit-action exit-action)) 560 (setq view-exit-action exit-action))
563 561
564 (unless view-mode 562 (unless view-mode
565 (view-mode-enable t) 563 (view-mode 1)
566 (force-mode-line-update)
567 (unless view-inhibit-help-message 564 (unless view-inhibit-help-message
568 (message "%s" 565 (message "%s"
569 (substitute-command-keys "\ 566 (substitute-command-keys "\
@@ -590,7 +587,7 @@ current buffer. "
590 (when view-mode 587 (when view-mode
591 (let ((buffer (window-buffer))) 588 (let ((buffer (window-buffer)))
592 (unless view-no-disable-on-exit 589 (unless view-no-disable-on-exit
593 (view-mode-disable)) 590 (view-mode -1))
594 591
595 (unless exit-only 592 (unless exit-only
596 (cond 593 (cond
@@ -601,8 +598,7 @@ current buffer. "
601 (quit-window))) 598 (quit-window)))
602 599
603 (when exit-action 600 (when exit-action
604 (funcall exit-action buffer)) 601 (funcall exit-action buffer))))))
605 (force-mode-line-update)))))
606 602
607(defun View-exit () 603(defun View-exit ()
608 "Exit View mode but stay in current buffer." 604 "Exit View mode but stay in current buffer."