help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

add-hook and remove-hook for outlines


From: Christopher Dimech
Subject: add-hook and remove-hook for outlines
Date: Tue, 11 May 2021 16:18:59 +0200

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))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]