public inbox for howm-eng@lists.osdn.me
 help / color / mirror / Atom feed
From: peter.mielke at gmail.com (Peter Mielke)
Subject: [Howm-eng 31] highlighting keywords, but not within a word
Date: Tue, 20 Feb 2007 13:32:28 -0700	[thread overview]
Message-ID: <447775300702201232l590b6b2eha2276d63f16d56c7@mail.gmail.com> (raw)

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


             reply	other threads:[~2007-02-20 20:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-20 20:32 peter.mielke [this message]
2007-02-21 12:33 ` [Howm-eng 32] " khi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=447775300702201232l590b6b2eha2276d63f16d56c7@mail.gmail.com \
    --to=howm-eng@lists.osdn.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).