X-Git-Url: http://gitweb.michael.orlitzky.com/?p=nagios-mode.git;a=blobdiff_plain;f=nagios-mode.el;h=e1573345a61670b5fb8a9989d3abf622c367ecf4;hp=98636881ccbee9b137f96caec2f9e51a832d0990;hb=eb979cc1755ca7cf5b42f0ec401777fd6a1c50ee;hpb=ee764222b321da901187770a867221d38dea774c diff --git a/nagios-mode.el b/nagios-mode.el index 9863688..e157334 100644 --- a/nagios-mode.el +++ b/nagios-mode.el @@ -156,11 +156,23 @@ ;; Regular Expression Transformations (defun regexp-word(regexp) - "Takes a regular expression as an argument, and adds the word boundary condition to the beginning and end of it." + "Takes a regular expression as an argument, and adds the word boundary condition to the beginning and end of it. Newlines are treated as word boundaries." + ;; This basically joins two expressions in an alternation. + ;; The first allows for a newline followed by our regexp (on + ;; a word boundary), and the second checks for any-non-word + ;; character followed by our regexp. + ;; ;; I consider neither a hyphen nor an underscore to be a word - ;; boundary for the purpose of syntax highlighting. - (concat "[^_-]\\<\\(" regexp "\\)\\>[^_-]") + ;; boundary for the purpose of syntax highlighting, so I stick + ;; the no-hyphens-or-underscores class on each end of the + ;; expressions. + + (concat "\\(" + (concat "\\(^\\<\\(" regexp "\\)\\>[^_-]\\)") + "\\|" + (concat "\\([^_-]\\<\\(" regexp "\\)\\>[^_-]\\)") + "\\)") )