emacs: add abbrev to update html page

This commit is contained in:
Protesilaos Stavrou 2024-02-08 10:42:49 +02:00
parent 6754532282
commit 390b8509cc
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA
3 changed files with 38 additions and 0 deletions

View file

@ -217,6 +217,9 @@ Development continues on GitHub with GitLab as a mirror."))
";date" #'prot-abbrev-current-date
";jitsi" #'prot-abbrev-jitsi-link)
(prot-emacs-abbrev-function text-mode-abbrev-table
";update" #'prot-abbrev-update-html)
;; message-mode derives from text-mode, so we don't need a separate
;; hook for it.
(dolist (hook '(text-mode-hook prog-mode-hook git-commit-mode-hook))

View file

@ -4155,6 +4155,9 @@ Development continues on GitHub with GitLab as a mirror."))
";date" #'prot-abbrev-current-date
";jitsi" #'prot-abbrev-jitsi-link)
(prot-emacs-abbrev-function text-mode-abbrev-table
";update" #'prot-abbrev-update-html)
;; message-mode derives from text-mode, so we don't need a separate
;; hook for it.
(dolist (hook '(text-mode-hook prog-mode-hook git-commit-mode-hook))
@ -10189,6 +10192,22 @@ not test it as much and do not try to make it perfect.
"Insert a Jitsi link."
(insert (concat "https://meet.jit.si/" (format-time-string "%Y%M%dT%H%M%S"))))
(defvar prot-abbrev-update-html-history nil
"Minibuffer history for `prot-abbrev-update-html-prompt'.")
(defun prot-abbrev-update-html-prompt ()
"Minibuffer prompt for `prot-abbrev-update-html'.
Use completion among previous entries, retrieving their data from
`prot-abbrev-update-html-history'."
(completing-read
"Insert update for manual: "
'prot-abbrev-update-html-history
nil nil nil 'prot-abbrev-update-html-history))
(defun prot-abbrev-update-html ()
"Insert message to update NAME.html page, by prompting for NAME."
(insert (format "Update %s.html" (prot-abbrev-update-html-prompt))))
(provide 'prot-abbrev)
;;; prot-abbrev.el ends here
#+end_src

View file

@ -59,5 +59,21 @@
"Insert a Jitsi link."
(insert (concat "https://meet.jit.si/" (format-time-string "%Y%M%dT%H%M%S"))))
(defvar prot-abbrev-update-html-history nil
"Minibuffer history for `prot-abbrev-update-html-prompt'.")
(defun prot-abbrev-update-html-prompt ()
"Minibuffer prompt for `prot-abbrev-update-html'.
Use completion among previous entries, retrieving their data from
`prot-abbrev-update-html-history'."
(completing-read
"Insert update for manual: "
'prot-abbrev-update-html-history
nil nil nil 'prot-abbrev-update-html-history))
(defun prot-abbrev-update-html ()
"Insert message to update NAME.html page, by prompting for NAME."
(insert (format "Update %s.html" (prot-abbrev-update-html-prompt))))
(provide 'prot-abbrev)
;;; prot-abbrev.el ends here