785 |
"Set VAR to NEWVAL; save the old value. |
"Set VAR to NEWVAL; save the old value. |
786 |
The old value is saved on the `pc-select-saved-settings-alist'." |
The old value is saved on the `pc-select-saved-settings-alist'." |
787 |
`(when (boundp ',var) |
`(when (boundp ',var) |
788 |
(pc-select-add-to-alist pc-select-saved-settings-alist ,var ,var) |
(pc-select-add-to-alist pc-select-saved-settings-alist ,var ,var) |
789 |
(setq ,var ,newval))) |
(setq ,var ,newval))) |
790 |
|
|
791 |
(defmacro pc-select-save-and-set-mode (mode &optional arg mode-var) |
(defmacro pc-select-save-and-set-mode (mode &optional arg mode-var) |
792 |
"Call the function MODE; save the old value of the variable MODE. |
"Call the function MODE; save the old value of the variable MODE. |
796 |
nil as an argument. If MODE-VAR is specified, save the value of the |
nil as an argument. If MODE-VAR is specified, save the value of the |
797 |
variable MODE-VAR (instead of the value of the variable MODE) on |
variable MODE-VAR (instead of the value of the variable MODE) on |
798 |
`pc-select-saved-settings-alist'." |
`pc-select-saved-settings-alist'." |
799 |
`(when (fboundp ',mode) |
(unless mode-var (setq mode-var mode)) |
800 |
(pc-select-add-to-alist pc-select-saved-settings-alist |
`(when (fboundp ',mode) |
801 |
,mode |
(pc-select-add-to-alist pc-select-saved-settings-alist |
802 |
(or (and (boundp ',mode) ,mode) |
,mode-var ,mode-var) |
803 |
,mode-var)) |
(,mode ,arg))) |
|
(,mode ,arg))) |
|
804 |
|
|
805 |
(defmacro pc-select-restore-var (var) |
(defmacro pc-select-restore-var (var) |
806 |
"Restore the previous value of the variable VAR. |
"Restore the previous value of the variable VAR. |
820 |
`(when (fboundp ',mode) |
`(when (fboundp ',mode) |
821 |
(let ((,elt (assq ',mode pc-select-saved-settings-alist))) |
(let ((,elt (assq ',mode pc-select-saved-settings-alist))) |
822 |
(unless (null ,elt) |
(unless (null ,elt) |
823 |
(,mode (if (cdr ,elt) 1 -1))))))) |
(,mode (if (cdr ,elt) 1 -1))))))) |
824 |
|
|
825 |
|
|
826 |
;;;###autoload |
;;;###autoload |