aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2020-10-01 18:49:45 +0200
committerLars Ingebrigtsen2020-10-01 18:49:45 +0200
commit2017bf0dd1ddd9b18cb95c42e3ef4098bff69fa9 (patch)
tree105014d7fcb4a2953ac861e25ff947698a3d1a3c
parentaf72f6d5109ba2b6e92bbc6f1ef12d83dae70e13 (diff)
downloademacs-2017bf0dd1ddd9b18cb95c42e3ef4098bff69fa9.tar.gz
emacs-2017bf0dd1ddd9b18cb95c42e3ef4098bff69fa9.zip
Fix restoring data in visual-line-mode
* lisp/simple.el (visual-line-mode): Only save values once, even if the mode is switched on twice (bug#43730). This makes both previously set local values for variables like truncate-lines, as well as default values for truncate-lines restorable. * lisp/emulation/cua-base.el (cua-mode): Ditto.
-rw-r--r--lisp/emulation/cua-base.el7
-rw-r--r--lisp/simple.el22
2 files changed, 16 insertions, 13 deletions
diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el
index c4dcb76446e..926305e6077 100644
--- a/lisp/emulation/cua-base.el
+++ b/lisp/emulation/cua-base.el
@@ -1379,9 +1379,10 @@ the prefix fallback behavior."
1379 1379
1380 (cond 1380 (cond
1381 (cua-mode 1381 (cua-mode
1382 (setq cua--saved-state 1382 (unless cua--saved-state
1383 (list 1383 (setq cua--saved-state
1384 (and (boundp 'delete-selection-mode) delete-selection-mode))) 1384 (list
1385 (and (boundp 'delete-selection-mode) delete-selection-mode))))
1385 (if cua-delete-selection 1386 (if cua-delete-selection
1386 (delete-selection-mode 1) 1387 (delete-selection-mode 1)
1387 (if (and (boundp 'delete-selection-mode) delete-selection-mode) 1388 (if (and (boundp 'delete-selection-mode) delete-selection-mode)
diff --git a/lisp/simple.el b/lisp/simple.el
index fef22c2fa6f..05a74d90d62 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -7275,15 +7275,16 @@ Mode' for details."
7275 :lighter " Wrap" 7275 :lighter " Wrap"
7276 (if visual-line-mode 7276 (if visual-line-mode
7277 (progn 7277 (progn
7278 (set (make-local-variable 'visual-line--saved-state) nil) 7278 (unless visual-line--saved-state
7279 ;; Save the local values of some variables, to be restored if 7279 (setq-local visual-line--saved-state (list nil))
7280 ;; visual-line-mode is turned off. 7280 ;; Save the local values of some variables, to be restored if
7281 (dolist (var '(line-move-visual truncate-lines 7281 ;; visual-line-mode is turned off.
7282 truncate-partial-width-windows 7282 (dolist (var '(line-move-visual truncate-lines
7283 word-wrap fringe-indicator-alist)) 7283 truncate-partial-width-windows
7284 (if (local-variable-p var) 7284 word-wrap fringe-indicator-alist))
7285 (push (cons var (symbol-value var)) 7285 (if (local-variable-p var)
7286 visual-line--saved-state))) 7286 (push (cons var (symbol-value var))
7287 visual-line--saved-state))))
7287 (set (make-local-variable 'line-move-visual) t) 7288 (set (make-local-variable 'line-move-visual) t)
7288 (set (make-local-variable 'truncate-partial-width-windows) nil) 7289 (set (make-local-variable 'truncate-partial-width-windows) nil)
7289 (setq truncate-lines nil 7290 (setq truncate-lines nil
@@ -7297,7 +7298,8 @@ Mode' for details."
7297 (kill-local-variable 'truncate-partial-width-windows) 7298 (kill-local-variable 'truncate-partial-width-windows)
7298 (kill-local-variable 'fringe-indicator-alist) 7299 (kill-local-variable 'fringe-indicator-alist)
7299 (dolist (saved visual-line--saved-state) 7300 (dolist (saved visual-line--saved-state)
7300 (set (make-local-variable (car saved)) (cdr saved))) 7301 (when (car saved)
7302 (set (make-local-variable (car saved)) (cdr saved))))
7301 (kill-local-variable 'visual-line--saved-state))) 7303 (kill-local-variable 'visual-line--saved-state)))
7302 7304
7303(defun turn-on-visual-line-mode () 7305(defun turn-on-visual-line-mode ()