From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ruijie Yu via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: Re: Removing colourising details from body of minor-mode definition Date: Sun, 04 Jun 2023 19:34:27 +0800 Message-ID: References: Reply-To: Ruijie Yu Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16430"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.9.22; emacs 30.0.50 Cc: help-gnu-emacs@gnu.org To: uzibalqa Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jun 04 13:35:49 2023 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q5m1U-00041s-Dl for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 04 Jun 2023 13:35:48 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5m0t-0006vx-7U; Sun, 04 Jun 2023 07:35:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q5m0r-0006vp-SP for help-gnu-emacs@gnu.org; Sun, 04 Jun 2023 07:35:09 -0400 Original-Received: from netyu.xyz ([152.44.41.246] helo=mail.netyu.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q5m0p-0002kE-UY for help-gnu-emacs@gnu.org; Sun, 04 Jun 2023 07:35:09 -0400 Original-Received: from fw.net.yu.netyu.xyz ( [222.248.4.98]) by netyu.xyz (OpenSMTPD) with ESMTPSA id cc0b9d46 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sun, 4 Jun 2023 11:35:05 +0000 (UTC) In-reply-to: Received-SPF: pass client-ip=152.44.41.246; envelope-from=ruijie@netyu.xyz; helo=mail.netyu.xyz X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:143852 Archived-At: uzibalqa 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