]> gitweb.michael.orlitzky.com - nagios-mode.git/blobdiff - nagios-mode.el
Fixed regexp-word so that it treats newlines as word boundaries.
[nagios-mode.git] / nagios-mode.el
index 92aff0e4d6341b7c82d6967ea816c7a741279fda..e1573345a61670b5fb8a9989d3abf622c367ecf4 100644 (file)
 ;; 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 "\\)\\>[^_-]\\)")
+         "\\)")
   )
 
 
      '("active_checks_enabled" "address" "alias" "check_command"
        "check_freshness" "check_interval" "check_period" "checks_enabled"
        "command_line" "command_name" "contact_groups" "contact_name"
-       "contactgroup_name" "dependent_host_name"
+       "contactgroup_name" "contacts" "dependent_host_name"
        "dependent_service_description" "email" "event_handler"
        "event_handler_enabled" "execution_failure_criteria"
        "failure_prediction_enabled" "first_notification"
        "flap_detection_enabled" "freshness_threshold" "friday"
        "high_flap_threshold" "host_name" "host_notification_commands"
        "host_notification_options" "host_notification_period"
-       "hostgroup_name" "hostgroups" "is_volatile" "last_notification"
-       "low_flap_threshold" "max_check_attempts"
-       "members" "monday" "normal_check_interval"
-       "notification_failure_criteria"
+       "host_notifications_enabled" "hostgroup_name" "hostgroups"
+       "is_volatile" "last_notification" "low_flap_threshold"
+       "max_check_attempts" "members" "monday" "normal_check_interval"
+       "notes" "notification_failure_criteria"
        "notification_interval" "notification_options"
        "notification_period" "notifications_enabled"
        "obsess_over_service" "pager" "parallelize_check"
        "process_perf_data" "retain_nonstatus_information"
        "retain_status_information" "retry_check_interval"
        "retry_interval" "saturday" "service_description"
-       "service_notification_commands"
-       "service_notification_options" "service_notification_period"
+       "service_notification_commands" "service_notification_options"
+       "service_notification_period" "service_notifications_enabled"
        "servicegroup_name" "stalking_options"
        "sunday" "thursday" "timeperiod_name" "tuesday" "wednesday") t))
   )