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

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

Re: Removing colourising details from body of minor-mode definition


From: Ruijie Yu
Subject: Re: Removing colourising details from body of minor-mode definition
Date: Sun, 04 Jun 2023 19:34:27 +0800
User-agent: mu4e 1.9.22; emacs 30.0.50

uzibalqa <uzibalqa@proton.me> writes:

> I have the following definition for a minor mode.  Where the variable $keyword
> is a list used to colourise org headings.  Would it be possible to define
> $keyword as a global variable so that I can remove the details of the 
> colourising
> procedure from the minor-mode declaration ?
>
> ;;;###autoload
> (define-minor-mode komis-minor-mode
>   "Enhances visibility of heading levels and text emphasis."
>   :init-value nil
>   :lighter " Komis"
>
>   (let*
>       (($keyword
>         `(("^\\*+ "
>            (0 (let* ( ($kondor
>                          (- (match-end 0) (match-beginning 0) 1))
>                       ($inline-task
>                          (and (boundp 'org-inlinetask-min-level)
>                               (>= $kondor org-inlinetask-min-level))) )
>                 ;;--------------------------------------
>                 (compose-region (- (match-end 0) 2)
>                                 (- (match-end 0) 1)
>                                 (komis-luna-hgshape-select $kondor))
>                 ;;---------------------------------------
>                 (when $inline-task
>                   (compose-region (- (match-end 0) 3)
>                                   (- (match-end 0) 2)
>                                   (komis-luna-hgshape-select $kondor)))
>                 ;;---------------------------------------
>                 (when (facep komis-luna-hgshape-typefc)
>                   (put-text-property
>                      (- (match-end 0) (if $inline-task 3 2))
>                      (- (match-end 0) 1)
>                      'face komis-luna-hgshape-typefc))
>                 ;;---------------------------------------
>                 (put-text-property
>                   (match-beginning 0)
>                   (- (match-end 0) 2)
>                   'face (list :foreground
>                               (face-attribute 'default :background)))
>                 ;;---------------------------------------
>                 (put-text-property (match-beginning 0)
>                                    (match-end 0)
>                                    'keymap komis-luna-hgcycle-wmouse)
>                 ;;---------------------------------------
>                 nil)) ))))

IIUC, you can do `defvar' or `defconst' on the top-level.

-- 
Best,


RY



reply via email to

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