all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* custom function to highlight keywords
@ 2003-03-20  5:40 trex_eater
  2003-03-20  9:24 ` foomaster1200
  0 siblings, 1 reply; 4+ messages in thread
From: trex_eater @ 2003-03-20  5:40 UTC (permalink / raw)


Time to time I have to look at huge log files for certain key words.
So, I wrote a small lisp function to highlight the keywords. I figured
some of the syntax from looking at few lisp codes.

The function high-on1 works fine. The function high-on2 does not work.
Can some one point out what I am doing wrong. Thanks.


(defun high-on1 ()
	(setq my-keywords '(("\\(setq\\|font-lock\\|keywords\\)" 
        (0 my-new-face))))
	(setq font-lock-keywords (append font-lock-keywords my-keywords))
)

(defun high-on2 ( expname)
	(interactive "Bexpname: ")
	(setq my-temp (concat "\\(" expname "\\)" ))
        ;; Not sure about the line below...
	(setq my-keywords (my-temp (0 my-new-face)))  
	(setq font-lock-keywords (append font-lock-keywords my-keywords))
)

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

* Re: custom function to highlight keywords
  2003-03-20  5:40 custom function to highlight keywords trex_eater
@ 2003-03-20  9:24 ` foomaster1200
  2003-03-20 15:01   ` trex_eater
  0 siblings, 1 reply; 4+ messages in thread
From: foomaster1200 @ 2003-03-20  9:24 UTC (permalink / raw)


ckugmk@yahoo.com (trex_eater) writes:

> 
> (defun high-on2 ( expname)
> 	(interactive "Bexpname: ")
> 	(setq my-temp (concat "\\(" expname "\\)" ))
>         ;; Not sure about the line below...
> 	(setq my-keywords (my-temp (0 my-new-face)))  
> 	(setq font-lock-keywords (append font-lock-keywords my-keywords))

I might be wrong... but:

> 	(setq my-keywords (my-temp (0 my-new-face)))  

is probably not what you want. You're calling a function "my-temp"
and calling a function "0" within that. You probably get a wrong
function error?

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

* Re: custom function to highlight keywords
  2003-03-20  9:24 ` foomaster1200
@ 2003-03-20 15:01   ` trex_eater
  2003-03-21 16:26     ` Kevin Rodgers
  0 siblings, 1 reply; 4+ messages in thread
From: trex_eater @ 2003-03-20 15:01 UTC (permalink / raw)


foomaster1200 <foomaster1200@yahoo.com> wrote in message news:<87znnq4cih.fsf@killr.ath.cx>...
> ckugmk@yahoo.com (trex_eater) writes:
> 
> > 
> > (defun high-on2 ( expname)
> > 	(interactive "Bexpname: ")
> > 	(setq my-temp (concat "\\(" expname "\\)" ))
> >         ;; Not sure about the line below...
> > 	(setq my-keywords (my-temp (0 my-new-face)))  
> > 	(setq font-lock-keywords (append font-lock-keywords my-keywords))
> 
> I might be wrong... but:
> 
> > 	(setq my-keywords (my-temp (0 my-new-face)))  
> 
> is probably not what you want. You're calling a function "my-temp"
> and calling a function "0" within that. You probably get a wrong
> function error?

Agreed. But what is the lisp syntax to specify that use the contents
of the variable my-temp while constructing the my-keywords in the
following line:

setq my-keywords (my-temp (0 my-new-face)))

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

* Re: custom function to highlight keywords
  2003-03-20 15:01   ` trex_eater
@ 2003-03-21 16:26     ` Kevin Rodgers
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Rodgers @ 2003-03-21 16:26 UTC (permalink / raw)


trex_eater wrote:

> foomaster1200 <foomaster1200@yahoo.com> wrote in message news:<87znnq4cih.fsf@killr.ath.cx>...
> 
>>ckugmk@yahoo.com (trex_eater) writes:
>>
>>
>>>(defun high-on2 ( expname)
>>>	(interactive "Bexpname: ")
>>>	(setq my-temp (concat "\\(" expname "\\)" ))
>>>        ;; Not sure about the line below...
>>>	(setq my-keywords (my-temp (0 my-new-face)))  
>>>	(setq font-lock-keywords (append font-lock-keywords my-keywords))
>>>
>>I might be wrong... but:
>>
>>
>>>	(setq my-keywords (my-temp (0 my-new-face)))  
>>>
>>is probably not what you want. You're calling a function "my-temp"
>>and calling a function "0" within that. You probably get a wrong
>>function error?
>>
> 
> Agreed. But what is the lisp syntax to specify that use the contents
> of the variable my-temp while constructing the my-keywords in the
> following line:
> 
> setq my-keywords (my-temp (0 my-new-face)))

(setq my-keywords (list my-temp '(0 my-new-face)))

or

(setq my-keywords `(,my-temp (0 my-new-face)))

-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

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

end of thread, other threads:[~2003-03-21 16:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-20  5:40 custom function to highlight keywords trex_eater
2003-03-20  9:24 ` foomaster1200
2003-03-20 15:01   ` trex_eater
2003-03-21 16:26     ` Kevin Rodgers

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.