[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/devhelp 682dcb637f 08/13: Some cleanup and fix wrong-type-
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/devhelp 682dcb637f 08/13: Some cleanup and fix wrong-type-argument error |
Date: |
Sun, 27 Nov 2022 15:59:11 -0500 (EST) |
branch: elpa/devhelp
commit 682dcb637fdc564751b808205cdfa21b7f9ec99d
Author: Akib Azmain Turja <akib@disroot.org>
Commit: Akib Azmain Turja <akib@disroot.org>
Some cleanup and fix wrong-type-argument error
---
devhelp.el | 99 +++++++++++++++++++++++++++++++-------------------------------
1 file changed, 49 insertions(+), 50 deletions(-)
diff --git a/devhelp.el b/devhelp.el
index 6b3d9a1ce9..e398878c09 100644
--- a/devhelp.el
+++ b/devhelp.el
@@ -83,15 +83,16 @@ Integer means use that many columns. Nil means use full
window width."
:type 'boolean)
(defcustom devhelp-search-directories
- '("/usr/share/doc/" "/usr/share/gtk-doc/html/" "/usr/local/share/doc/"
- "/usr/local/share/gtk-doc/html/")
+ '("/usr/share/doc/" "/usr/share/gtk-doc/html/"
+ "/usr/local/share/doc/" "/usr/local/share/gtk-doc/html/")
"List of directories to search for Devhelp books.
-Note that on GNU Guix, Nix or other FHS (Filesystem Hierarchy Standard)
-non-compliant distributions, the default value won't work. For GNU Guix,
-set it to '(\"/run/current-system/profile/share/doc/\"
+Note that on GNU Guix, Nix or other FHS (Filesystem Hierarchy
+Standard) non-compliant distributions, the default value won't work.
+For GNU Guix, set it to \='(\"/run/current-system/profile/share/doc/\"
\"/run/current-system/profile/share/gtk-doc/html/\"
-\"~/.guix-profile/share/doc/\" \"~/.guix-profile/share/gtk-doc/html/\")."
+\"~/.guix-profile/share/doc/\"
+\"~/.guix-profile/share/gtk-doc/html/\")."
:type '(repeat directory))
(defvar devhelp--books nil
@@ -135,34 +136,33 @@ absolute path to it."
(_ (error "Invalid Devhelp file"))))
(base (expand-file-name (or (dom-attr dom 'base) "")
(file-name-directory file))))
- (cl-labels ((children-by-tag
- (tree tag)
- (mapcan (lambda (node)
- (when (and (listp node) (eq (dom-tag node) tag))
- (list node)))
- (dom-children tree)))
- (process-section
- (sec)
- `(,(dom-attr sec 'name)
- ,(expand-file-name (dom-attr sec 'link) base)
- ,(mapcar #'process-section (children-by-tag
- sec 'sub)))))
- `(,(or (dom-attr dom 'title) "Untitled")
- ,(or (dom-attr dom 'name) (file-name-base file))
- ,(or (dom-attr dom 'language) "any")
- ,(expand-file-name (dom-attr dom 'link) base)
- ,(mapcar #'process-section
- (mapcan (lambda (tree) (children-by-tag tree 'sub))
- (children-by-tag dom 'chapters)))
- ,(mapcar
- (lambda (kw)
- `(,(dom-attr kw 'name)
- ,(or (dom-attr kw 'type) "function")
- ,(expand-file-name (dom-attr kw 'link) base)))
- (mapcan (lambda (tree)
- (children-by-tag
- tree (if (eq version 1) 'function 'keyword)))
- (children-by-tag dom 'functions)))))))
+ (cl-labels ((children-by-tag (tree tag)
+ (mapcan (lambda (node)
+ (when (and (listp node) (eq (dom-tag node) tag))
+ (list node)))
+ (dom-children tree)))
+ (process-section (sec)
+ (list (dom-attr sec 'name)
+ (expand-file-name (dom-attr sec 'link) base)
+ (mapcar #'process-section (children-by-tag
+ sec 'sub)))))
+ (list (or (dom-attr dom 'title) "Untitled")
+ (or (dom-attr dom 'name) (file-name-base file))
+ (or (dom-attr dom 'language) "any")
+ (expand-file-name (dom-attr dom 'link) base)
+ (mapcar #'process-section
+ (mapcan (lambda (tree)
+ (children-by-tag tree 'sub))
+ (children-by-tag dom 'chapters)))
+ (mapcar
+ (lambda (kw)
+ (list (dom-attr kw 'name)
+ (or (dom-attr kw 'type) "function")
+ (expand-file-name (dom-attr kw 'link) base)))
+ (mapcan (lambda (tree)
+ (children-by-tag
+ tree (if (eq version 1) 'function 'keyword)))
+ (children-by-tag dom 'functions)))))))
(defun devhelp--search-for-books ()
"Search for Devhelp books in `devhelp-search-directories'.
@@ -224,20 +224,19 @@ See `devhelp-toc' for more details."
(let ((book-tocs
(mapcar
(lambda (book)
- (cl-labels ((section-to-html
- (section)
- (concat
- "<li>"
- (format
- "<a href=%S>%s</a>"
- (devhelp--file-to-url (nth 1 section))
- (nth 0 section))
- (when (nth 2 section)
- (format
- "<ul>%s</ul>"
- (mapconcat #'section-to-html
- (nth 2 section) "")))
- "</li>")))
+ (cl-labels ((section-to-html (section)
+ (concat
+ "<li>"
+ (format
+ "<a href=%S>%s</a>"
+ (devhelp--file-to-url (nth 1 section))
+ (nth 0 section))
+ (when (nth 2 section)
+ (format
+ "<ul>%s</ul>"
+ (mapconcat #'section-to-html
+ (nth 2 section) "")))
+ "</li>")))
(cons
(nth 2 book)
(concat
@@ -451,14 +450,14 @@ When BASE is given, use it to make relative URLs
absolute."
When prefix argument N is given, go to Nth previous page."
(interactive "p")
- (devhelp--history-goto (+ (car devhelp--history) n)))
+ (devhelp--history-goto (+ (car devhelp--history) (or n 1))))
(defun devhelp-history-forward (&optional n)
"Go to the next page.
When prefix argument N is given, go to Nth next page."
(interactive "p")
- (devhelp--history-goto (- (car devhelp--history) n)))
+ (devhelp--history-goto (- (car devhelp--history) (or n 1))))
(defun devhelp-history-goto (&optional event)
"Go to history link under point.
- [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 <=
- [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, 2022/11/27
- [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