Improve names, comments, and documentation in recent commits

This commit is contained in:
Gerard Vermeulen 2023-06-03 07:00:47 +02:00
parent 905ba44bf4
commit d3c55eb86d
2 changed files with 13 additions and 9 deletions

View File

@ -333,16 +333,17 @@ recommendation of [[info:emacs#Saving Customizations][saving customizations (inf
#+name: lst:site-lisp-packages
#+begin_src emacs-lisp -n :results silent
(with-eval-after-load 'emacs
;; Handle user-emacs-directory site-lisp directories as packages.
;; https://www.emacswiki.org/emacs/LoadPath
;; Make user-emacs-directory site-lisp directories look like packages.
(mapc (apply-partially 'add-to-list 'load-path)
(cl-remove-duplicates
(mapcar 'directory-file-name
(mapcar 'file-name-directory
(directory-files-recursively
(expand-file-name "site-lisp" user-emacs-directory)
"\\.el$")))
(mapcar (lambda (file)
(directory-file-name (file-name-directory file)))
(directory-files-recursively
(expand-file-name "site-lisp" user-emacs-directory) "\\.el$"))
:test #'string=))
;; See package.el for how to use `loaddefs-generate-dir'.
(defun make-loaddefs-in-buffer-directory ()
"Make or update the autoloads in the directory of the visited file."
(interactive)
@ -3038,7 +3039,7 @@ The following posts provide programming information:
(emms-playlist-mode-play-current-track)))))
(defun org-yt-url-browse-open (path)
"Open an \"YouTube\" link with `url-browse'."
"Open an \"YouTube\" link with `url-browse'."
(let ((url (format "https://www.youtube.com/watch?v=%s" path)))
(browse-url url)))

View File

@ -74,15 +74,18 @@ otherwise link to SVG images from exported my-HTML pages."
;;;; Link
(defun org--my-html-embed-svg-p (link)
"Check whether LINK links to an SVG file to embed."
(and (not (org-element-contents link))
(let ((case-fold-search t))
(string-match-p ".svg\\'" (org-element-property :path link)))))
(defun org--my-html-format-svg (path)
(defun org--my-html-svg-contents (path)
"Return the SVG contents of the file named PATH."
;; https://emacs.stackexchange.com/a/57433
(with-temp-buffer
(insert-file-contents path)
(with-syntax-table nxml-mode-syntax-table
;; Barf if contents contains no valid SVG.
(while (and (search-forward "<svg")
(nth 8 (syntax-ppss)))))
(delete-region (point-min) (match-beginning 0))
@ -170,7 +173,7 @@ contrary to `org-html-link' which can only link such images."
;; Embed SVG.
((and (plist-get info :my-html-embed-svg)
(org--my-html-embed-svg-p link))
(org--my-html-format-svg path))
(org--my-html-svg-contents path))
;; Image file.
((and (plist-get info :html-inline-images)
(org-export-inline-image-p