[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/devhelp 139715e6b1 04/13: Reuse existing buffers for bookm
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/devhelp 139715e6b1 04/13: Reuse existing buffers for bookmark jump |
Date: |
Sun, 27 Nov 2022 15:59:11 -0500 (EST) |
branch: elpa/devhelp
commit 139715e6b15416652cfe2b376389da4670be8059
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>
Reuse existing buffers for bookmark jump
---
devhelp.el | 62 +++++++++++++++++++++++++++++++++++---------------------------
1 file changed, 35 insertions(+), 27 deletions(-)
diff --git a/devhelp.el b/devhelp.el
index c624849d50..ff90a6e386 100644
--- a/devhelp.el
+++ b/devhelp.el
@@ -549,38 +549,46 @@ the conbined table of contents of all available Devhelp
books."
(filename . ,(when (stringp (nth 1 entry)) (nth 1 entry)))
(file . ,(nth 1 entry))
(position . ,(nth 2 entry))
- (handler . devhelp-bookmake-jump))))
+ (handler . devhelp-bookmark-jump))))
;;;###autoload
-(defun devhelp-bookmake-jump (bookmark)
+(defun devhelp-bookmark-jump (bookmark)
"Jump to BOOKMARK."
(unless (fboundp 'libxml-parse-html-region)
(error "This function requires Emacs to be compiled with libxml2"))
- (with-current-buffer (generate-new-buffer "*devhelp*")
- (devhelp-mode)
- (display-buffer (current-buffer))
- (setq devhelp--books (devhelp--search-for-books))
- (setq devhelp--history
- `(0 . ((nil ,(bookmark-prop-get bookmark 'file)
- ,(bookmark-prop-get bookmark 'position)))))
- (if (symbolp (bookmark-prop-get bookmark 'file))
- (pcase (bookmark-prop-get bookmark 'file)
- ('toc (devhelp--toc-1))
- ('index (devhelp--index-1)))
- (let ((file (url-filename
- (url-generic-parse-url
- (devhelp--file-to-url
- (bookmark-prop-get bookmark 'file))))))
- (devhelp--set-title "Untitled")
- (devhelp--render-html-file
- (if (memq system-type '(windows-nt ms-dos))
- (substring file 1)
- file))
- (goto-char (min (max (bookmark-prop-get bookmark 'position)
- (point-min))
- (point-max)))
- (recenter 0)
- (setf (nth 2 (nth 0 (cdr devhelp--history))) (point))))))
+ (let ((buffer-existed-p (get-buffer "*devhelp*")))
+ (with-current-buffer (get-buffer-create "*devhelp*")
+ (unless buffer-existed-p
+ (devhelp-mode))
+ (display-buffer (current-buffer))
+ (setq devhelp--books (devhelp--search-for-books))
+ (if buffer-existed-p
+ (setq devhelp--history
+ `(0 . ((nil ,(bookmark-prop-get bookmark 'file)
+ ,(bookmark-prop-get bookmark 'position))
+ . ,(nthcdr (car devhelp--history)
+ (cdr devhelp--history)))))
+ (setq devhelp--history
+ `(0 . ((nil ,(bookmark-prop-get bookmark 'file)
+ ,(bookmark-prop-get bookmark 'position))))))
+ (if (symbolp (bookmark-prop-get bookmark 'file))
+ (pcase (bookmark-prop-get bookmark 'file)
+ ('toc (devhelp--toc-1))
+ ('index (devhelp--index-1)))
+ (let ((file (url-filename
+ (url-generic-parse-url
+ (devhelp--file-to-url
+ (bookmark-prop-get bookmark 'file))))))
+ (devhelp--set-title "Untitled")
+ (devhelp--render-html-file
+ (if (memq system-type '(windows-nt ms-dos))
+ (substring file 1)
+ file))
+ (goto-char (min (max (bookmark-prop-get bookmark 'position)
+ (point-min))
+ (point-max)))
+ (recenter 0)
+ (setf (nth 2 (nth 0 (cdr devhelp--history))) (point)))))))
(defvar devhelp-mode-map
(let ((map (make-sparse-keymap)))
- [nongnu] branch elpa/devhelp created (now 3a31a672f4), ELPA Syncer, 2022/11/27
- [nongnu] elpa/devhelp ac3c9e9563 03/13: Change the behavior of devhelp function to be a bit more like info, ELPA Syncer, 2022/11/27
- [nongnu] elpa/devhelp cb97d3d05d 05/13: Fix parent customization group, ELPA Syncer, 2022/11/27
- [nongnu] elpa/devhelp a694a5f1db 06/13: Show off with a GIF, ELPA Syncer, 2022/11/27
- [nongnu] elpa/devhelp 682dcb637f 08/13: Some cleanup and fix wrong-type-argument error, ELPA Syncer, 2022/11/27
- [nongnu] elpa/devhelp d0c781c865 09/13: Make lines less long than 75 characters, ELPA Syncer, 2022/11/27
- [nongnu] elpa/devhelp 01dc4222bf 10/13: Generate SXML instead of HTML while render special pages, ELPA Syncer, 2022/11/27
- [nongnu] elpa/devhelp 54538cd01c 11/13: Add .dir-locals.el, ELPA Syncer, 2022/11/27
- [nongnu] elpa/devhelp 3a31a672f4 13/13: Add Guix-specific search directories by default, ELPA Syncer, 2022/11/27
- [nongnu] elpa/devhelp 66e23a6339 02/13: Don't allow to bookmark history page, ELPA Syncer, 2022/11/27
- [nongnu] elpa/devhelp 139715e6b1 04/13: Reuse existing buffers for bookmark jump,
ELPA Syncer <=
- [nongnu] elpa/devhelp e8dfb03110 07/13: Fix file name extension of demo, ELPA Syncer, 2022/11/27
- [nongnu] elpa/devhelp f8d6422007 12/13: Add .elpaignore to ignore devhelp-demo.gif, ELPA Syncer, 2022/11/27
- [nongnu] elpa/devhelp 2e257e2d12 01/13: Add devhelp.el, README.org and COPYING, ELPA Syncer, 2022/11/27