X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?p=elpher.git;a=blobdiff_plain;f=elpher.el;h=580184ed8727031475efe5c67abc4b6594f18e0c;hp=3d8e77f680c4e9c875369a232ee6394316d342b8;hb=dc2d321c502ae2598d0d3c05ad92b3d937f9ea44;hpb=7ac8997eb71a5f5b914bdd4a99317588ba076727 diff --git a/elpher.el b/elpher.el index 3d8e77f..580184e 100644 --- a/elpher.el +++ b/elpher.el @@ -6,7 +6,7 @@ ;; Copyright (C) 2021 Omar Polo ;; Copyright (C) 2021 Noodles! ;; Copyright (C) 2021 Abhiseck Paira -;; Copyright (C) 2021 Daniel Semyonov +;; Copyright (C) 2021-2022 Daniel Semyonov ;; Copyright (C) 2020-2021 Alex Schroeder ;; Copyright (C) 2020 Zhiwei Chen ;; Copyright (C) 2020 condy0919 @@ -17,7 +17,7 @@ ;; Copyright (C) 2020 Koushk Roy ;; Copyright (C) 2020 Vee ;; Copyright (C) 2020 Simon South -;; Copyright (C) 2019-2021 Tim Vaughan +;; Copyright (C) 2019-2022 Tim Vaughan ;; Author: Tim Vaughan ;; Created: 11 April 2019 @@ -131,8 +131,7 @@ (defvar bookmark-make-record-function) (defvar mu4e~view-beginning-of-url-regexp) (defvar eww-use-browse-url) - (defvar thing-at-point-uri-schemes) - (defvar xterm-color-preserve-properties)) + (defvar thing-at-point-uri-schemes)) ;;; Customization group @@ -1920,10 +1919,11 @@ then making that buffer the current buffer. It should not switch to the buffer." (let* ((url (cdr (assq 'location bookmark))) (cleaned-url (string-trim url)) - (page (elpher-page-from-url cleaned-url))) + (page (elpher-page-from-url cleaned-url)) + (buffer (get-buffer-create elpher-buffer-name))) (elpher-with-clean-buffer (elpher-visit-page page)) - (set-buffer (get-buffer elpher-buffer-name)) + (set-buffer buffer) nil)) (defun elpher-bookmark-link () @@ -2103,7 +2103,8 @@ supports the old protocol elpher, where the link is self-contained." ;; that variable is `browse-url-default-browser' by default, so ;; that's the function that gets advised. If the value is an alist, ;; however, we don't know what to do. Better not interfere? - (when (fboundp browse-url-browser-function) + (when (and (symbolp browse-url-browser-function) + (fboundp browse-url-browser-function)) (advice-add browse-url-browser-function :before-while (lambda (url &rest _args) "Handle gemini, gopher, and finger schemes using Elpher." @@ -2160,7 +2161,8 @@ When run interactively HOST-OR-URL is read from the minibuffer." (unless (string-empty-p trimmed-host-or-url) (let ((page (elpher-page-from-url trimmed-host-or-url (elpher-get-default-url-scheme)))) - (switch-to-buffer elpher-buffer-name) + (unless (get-buffer-window elpher-buffer-name t) + (switch-to-buffer elpher-buffer-name)) (elpher-with-clean-buffer (elpher-visit-page page)) nil)))) ; non-nil value is displayed by eshell @@ -2415,8 +2417,7 @@ functions which initialize the client, namely (setq-local elpher-history nil) (setq-local elpher-buffer-name (buffer-name)) (setq-local bookmark-make-record-function #'elpher-bookmark-make-record) - (setq-local imenu-create-index-function #'elpher-build-current-imenu-index) - (setq-local xterm-color-preserve-properties t)) + (setq-local imenu-create-index-function #'elpher-build-current-imenu-index)) (when (fboundp 'evil-set-initial-state) (evil-set-initial-state 'elpher-mode 'motion))