all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Removing colourising details from body of minor-mode definition
@ 2023-06-04  9:33 uzibalqa
  2023-06-04 11:34 ` Ruijie Yu via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 2+ messages in thread
From: uzibalqa @ 2023-06-04  9:33 UTC (permalink / raw)
  To: uzibalqa via Users list for the GNU Emacs text editor


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





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Removing colourising details from body of minor-mode definition
  2023-06-04  9:33 Removing colourising details from body of minor-mode definition uzibalqa
@ 2023-06-04 11:34 ` Ruijie Yu via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 2+ messages in thread
From: Ruijie Yu via Users list for the GNU Emacs text editor @ 2023-06-04 11:34 UTC (permalink / raw)
  To: uzibalqa; +Cc: help-gnu-emacs


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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-04 11:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-04  9:33 Removing colourising details from body of minor-mode definition uzibalqa
2023-06-04 11:34 ` Ruijie Yu via Users list for the GNU Emacs text editor

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.