unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* add-hook and remove-hook for outlines
@ 2021-05-11 14:18 Christopher Dimech
  0 siblings, 0 replies; only message in thread
From: Christopher Dimech @ 2021-05-11 14:18 UTC (permalink / raw)
  To: Help Gnu Emacs

I would like to have a toggle function that can change the deadline type.
This would necessarily mean that I would need to remove the hook before
setting the new one (e.g. from org-like to roman-like headings).

But I am struggling on the implementation.

;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

(defvar rgc-elisp " ")
(defun gilgamesh-make-outline-regexp  ()
  "todo"
  (set (make-local-variable 'outline-regexp) rgc-elisp) )

;; ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

(defvar rgc-elisp-kondor 2)

(defun gilgamesh-headline-elisp ()
   "todo"
   (interactive)

   (message "gilgamesh-headline-elisp")

   (pcase rgc-elisp-kondor  ; sets regularity condition rgc
     (1
        ;; org-like headings
        (setq rgc-elisp ";;; \\*+ ")
	(setq rgc-elisp-kondor 2)
	(message "org-like headings"))
     (_
	;; roman-like headings
        (setq rgc-elisp ";;; \\([A-Za-z]\\|[IVXLCDMivxlcdm0-9]+\\) | ")
	(setq rgc-elisp-kondor 1)
	(message "roman-like headings")) )

   (add-hook 'emacs-lisp-mode-hook #'gilgamesh-make-outline-regexp))




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-05-11 14:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-11 14:18 add-hook and remove-hook for outlines Christopher Dimech

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).