unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* keywords highlighting
@ 2006-02-07 19:29 Kirill Kuvaldin
  2006-02-07 20:47 ` albrns
  2006-02-08 17:18 ` Alan Mackenzie
  0 siblings, 2 replies; 5+ messages in thread
From: Kirill Kuvaldin @ 2006-02-07 19:29 UTC (permalink / raw)



Hey, I wanna emacs to highlight keywords (such as FIXME, TODO, ...) like VIM.
How can it be achieved?

-- 
kuvkir

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

* Re: keywords highlighting
  2006-02-07 19:29 keywords highlighting Kirill Kuvaldin
@ 2006-02-07 20:47 ` albrns
  2006-02-07 23:56   ` Tim Johnson
       [not found]   ` <mailman.175.1139356135.3144.help-gnu-emacs@gnu.org>
  2006-02-08 17:18 ` Alan Mackenzie
  1 sibling, 2 replies; 5+ messages in thread
From: albrns @ 2006-02-07 20:47 UTC (permalink / raw)



Kirill Kuvaldin wrote:
> Hey, I wanna emacs to highlight keywords (such as FIXME, TODO, ...) like VIM.
> How can it be achieved?
>
> -- 
> kuvkir hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii

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

* Re: keywords highlighting
  2006-02-07 20:47 ` albrns
@ 2006-02-07 23:56   ` Tim Johnson
       [not found]   ` <mailman.175.1139356135.3144.help-gnu-emacs@gnu.org>
  1 sibling, 0 replies; 5+ messages in thread
From: Tim Johnson @ 2006-02-07 23:56 UTC (permalink / raw)


* albrns <a_alnas@yahoo.com> [060207 11:59]:
> > kuvkir hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
  :-) I think someone is having fun with Kirill
      (I use both vim and emacs)
 
   Kirill, I recommend that you do an appropos search on 
   "font" "font-lock", etc. As in C-h, a, "font-lock".

   More advanced users can tell you what file extensions
   that emacs "knows about automatically", in my case:
   here is an example from my .emacs file:

   ;; python mode ===================================================
   (add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
   (autoload 'python-mode "python-mode" "Turn on Python mode" t)
   (add-hook 'python-mode-hook 'turn-on-font-lock)

   ;; and of course that is for python.
   ;; similarly, for javascript and rebol:

   ;; javascript mode
   (add-to-list 'auto-mode-alist '("\\.js\\'" . javascript-mode))
   (autoload 'javascript-mode "javascript-mode" "Turn on Javascript mode" t)
   (add-hook 'javascript-mode-hook 'turn-on-font-lock)

   ;; rebol mode ====================================================
   (add-to-list 'auto-mode-alist '("\\.r\\'" . rebol-mode))
   (autoload 'rebol-mode "rebol-mode" "Turn on REBOL mode" t)
   (add-hook 'rebol-mode-hook 'turn-on-font-lock)

   the 'add-hook form tells emacs what functions to add to which
   mode. In these cases, you see it used for each mode to add
   'turn-on-font-lock.

   Try C-h, f "turn-on-font-lock"

   I hope this gets you started.
   cheers
   tim


-- 
Tim Johnson <tim@johnsons-web.com>
      http://www.alaska-internet-solutions.com

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

* Re: keywords highlighting
       [not found]   ` <mailman.175.1139356135.3144.help-gnu-emacs@gnu.org>
@ 2006-02-08  7:08     ` Kirill Kuvaldin
  0 siblings, 0 replies; 5+ messages in thread
From: Kirill Kuvaldin @ 2006-02-08  7:08 UTC (permalink / raw)


Tim Johnson <tim@johnsons-web.com> writes:

>    Kirill, I recommend that you do an appropos search on 
>    "font" "font-lock", etc. As in C-h, a, "font-lock".
>
>    More advanced users can tell you what file extensions
>    that emacs "knows about automatically", in my case:
>    here is an example from my .emacs file:

Everythink ok with fontlocking, by keywords highlighting I didn't mean the 
syntax highlighting. It's that emacs does by default.
I meant that keywords (FIXME, TODO) should be highlighted wherever they occur,
I'd like to use them in my code in comments representing the places in code 
that need to be modified in future.

Just found such solution:

(setq keyword-highlight-modes 
      '(php-mode java-mode c-mode c++-mode emacs-lisp-mode scheme-mode))

(make-face 'font-lock-fixme-face)
(make-face 'font-lock-todo-face)

(mapc (lambda (mode)
        (font-lock-add-keywords
         mode
         '(("\\<\\(FIXME\\)" 1 'font-lock-fixme-face t))))
      keyword-highlight-modes)

(mapc (lambda (mode)
        (font-lock-add-keywords
         mode
         '(("\\<\\(TODO\\)" 1 'font-lock-todo-face t))))
      keyword-highlight-modes)

(modify-face 'font-lock-fixme-face "black" "yellow" nil t nil t nil nil) 
(modify-face 'font-lock-todo-face  "black" "yellow" nil t nil nil nil nil)

-- 
kuvkir

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

* Re: keywords highlighting
  2006-02-07 19:29 keywords highlighting Kirill Kuvaldin
  2006-02-07 20:47 ` albrns
@ 2006-02-08 17:18 ` Alan Mackenzie
  1 sibling, 0 replies; 5+ messages in thread
From: Alan Mackenzie @ 2006-02-08 17:18 UTC (permalink / raw)


Kirill Kuvaldin <kuvkir@qwertyru.ru> wrote on 7 Feb 2006 20:29:50 +0100:

> Hey, I wanna emacs to highlight keywords (such as FIXME, TODO, ...)
> like VIM.  How can it be achieved?

With M-x hi-lock-mode.  Having done this in a buffer, do

C-x w h \<FIXME\> <ret> hi-yellow

.  To save these settings in your file, do C-x w b.

> -- 
> kuvkir

-- 
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").

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

end of thread, other threads:[~2006-02-08 17:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-07 19:29 keywords highlighting Kirill Kuvaldin
2006-02-07 20:47 ` albrns
2006-02-07 23:56   ` Tim Johnson
     [not found]   ` <mailman.175.1139356135.3144.help-gnu-emacs@gnu.org>
2006-02-08  7:08     ` Kirill Kuvaldin
2006-02-08 17:18 ` Alan Mackenzie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).