From mboxrd@z Thu Jan 1 00:00:00 1970 From: peter.mielke at gmail.com (Peter Mielke) Date: Tue, 20 Feb 2007 13:32:28 -0700 Subject: [Howm-eng 31] highlighting keywords, but not within a word Message-ID: <447775300702201232l590b6b2eha2276d63f16d56c7@mail.gmail.com> One irritation i had with the highlighing in howm buffers is that the keywords were being highlighted even within a word. So for example i have one keyword "ris" and the "ris" in "highrise" was being highlighted. So i added word breaks to the regular expression for highlighting keywords: (defun howm-action-lock-setup () (setq action-lock-case-fold-search howm-keyword-case-fold-search) (action-lock-mode t) (let* ((date-al (action-lock-date "{_}" howm-dtime-format))) ;; override the rule in action-lock.el (action-lock-add-rules (list date-al) t)) ;; xxx begin changed code (let* ((ks (mapcar (lambda (x) ;; add word break checks (format "\\b%s\\b" x)) (mapcar 'regexp-quote (howm-keyword-for-goto)))) (r (mapconcat 'identity ks "\\|")) ;; xxx end changed code (wiki (howm-action-lock-search howm-wiki-regexp howm-wiki-regexp-pos howm-wiki-regexp-hilit-pos t )) ;; (explicit (howm-action-lock-goto howm-ref-regexp (explicit (howm-action-lock-search howm-ref-regexp howm-ref-regexp-pos howm-ref-regexp-hilit-pos )) (implicit (howm-action-lock-search r 0)) (rev (howm-action-lock-related howm-keyword-regexp howm-keyword-regexp-pos howm-keyword-regexp-hilit-pos)) (date (howm-action-lock-date-rule)) (done (howm-action-lock-reminder-done-rule)) (all `( ,explicit ,rev ,@(if ks (list implicit) nil) ,wiki ,@(if (howm-menu-p) nil (list date done)) )) ) ;; don't override the rule in action-lock.el ;; esp. http://xxx should call browser even if "<<< http" exists (action-lock-add-rules all))) Hope this helps