From: Alex Schroeder Date: Thu, 2 Jul 2020 09:19:55 +0000 (+0200) Subject: Support for C-u elpher to have multiple buffers X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=04fdcb22a198e93a7185c62f155caf212eba2e80;p=elpher.git Support for C-u elpher to have multiple buffers --- diff --git a/elpher.el b/elpher.el index b5f995b..26f574a 100644 --- a/elpher.el +++ b/elpher.el @@ -454,7 +454,7 @@ unless NO-HISTORY is non-nil." (equal (elpher-page-address elpher-current-page) (elpher-page-address page))) (push elpher-current-page elpher-history)) - (setq elpher-current-page page) + (setq-local elpher-current-page page) (let* ((address (elpher-page-address page)) (type (elpher-address-type address)) (type-record (cdr (assoc type elpher-type-map)))) @@ -521,6 +521,7 @@ unless NO-HISTORY is non-nil." "Evaluate ARGS with a clean *elpher* buffer as current." `(with-current-buffer elpher-buffer-name (unless (eq major-mode 'elpher-mode) + ;; avoid resetting buffer-local variables (elpher-mode)) (let ((inhibit-read-only t)) (setq-local network-security-level @@ -1737,8 +1738,8 @@ When run interactively HOST-OR-URL is read from the minibuffer." (defun elpher-back-to-start () "Go all the way back to the start page." (interactive) - (setq elpher-current-page nil) - (setq elpher-history nil) + (setq-local elpher-current-page nil) + (setq-local elpher-history nil) (let ((start-page (elpher-make-page "Elpher Start Page" (elpher-make-special-address 'start)))) (elpher-visit-page start-page))) @@ -2025,10 +2026,10 @@ buffer selected (or created)." (get-buffer-create name))))) (pop-to-buffer-same-window buf) (unless (buffer-modified-p) - (let ((elpher-buffer-name (buffer-name)); for elpher-with-clean-buffer - (start-page (elpher-make-page "Elpher Start Page" - (elpher-make-special-address 'start)))) + (elpher-mode) + (let ((start-page (elpher-make-page "Elpher Start Page" + (elpher-make-special-address 'start)))) (elpher-visit-page start-page)) - "Started Elpher."))) ; Otherwise (elpher) evaluates to start page string. + "Started Elpher."))); Otherwise (elpher) evaluates to start page string. ;;; elpher.el ends here