all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* font-lock with functions
@ 2021-02-11 13:02 wael-zwaiter
  2021-02-11 19:38 ` wael-zwaiter
  0 siblings, 1 reply; 3+ messages in thread
From: wael-zwaiter @ 2021-02-11 13:02 UTC (permalink / raw)
  To: Help Gnu Emacs

I have a function called fkeyword-match and want to call font-lock on it.
Can anyone explain to me how font-lock works and what to do?






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

* Re: font-lock with functions
  2021-02-11 13:02 font-lock with functions wael-zwaiter
@ 2021-02-11 19:38 ` wael-zwaiter
  2021-02-11 20:56   ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 3+ messages in thread
From: wael-zwaiter @ 2021-02-11 19:38 UTC (permalink / raw)
  To: wael-zwaiter; +Cc: Help Gnu Emacs

The following works well, but I am concerned that "my-font-lock"
is a bit of a hack and could do with improvement

(defconst my-font-lock
  (append
      nil
      '( (my-match
	  (1 (my-bigfont (match-beginning 0)) append))) )
  "Description.")

(defun bigfont-enable ()
  "Enables a typeface for displaying tex commands."
  (setq supinf-signal t)
  (font-lock-add-keywords nil my-font-lock t))

(add-hook 'my-mode-hook #'bigfont-enable)


> Sent: Friday, February 12, 2021 at 1:02 AM
> From: wael-zwaiter@gmx.com
> To: "Help Gnu Emacs" <help-gnu-emacs@gnu.org>
> Subject: font-lock with functions
>
> I have a function called fkeyword-match and want to call font-lock on it.
> Can anyone explain to me how font-lock works and what to do?
>
>
>
>
>



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

* Re: font-lock with functions
  2021-02-11 19:38 ` wael-zwaiter
@ 2021-02-11 20:56   ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 0 replies; 3+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2021-02-11 20:56 UTC (permalink / raw)
  To: help-gnu-emacs

wael-zwaiter wrote:

> (defconst my-font-lock
>   (append
>       nil
>       '( (my-match
> 	  (1 (my-bigfont (match-beginning 0)) append))) )
>   "Description.")

Uhm, what is this intended to do?

Appending nil to a list doesn't do anything

  (append nil '(1 2 3)) ; (1 2 3)

because nil is actually the empty list, try `eval' these

  nil
  ()
  '()
  `()
  (list)
  (append nil () '() `() (list))

-- 
underground experts united
http://user.it.uu.se/~embe8573
https://dataswamp.org/~incal




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

end of thread, other threads:[~2021-02-11 20:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-11 13:02 font-lock with functions wael-zwaiter
2021-02-11 19:38 ` wael-zwaiter
2021-02-11 20:56   ` Emanuel Berg 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.