From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 17 00:19:33 2014 Received: (at submit) by debbugs.gnu.org; 17 Mar 2014 04:19:33 +0000 Received: from localhost ([127.0.0.1]:38498 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WPP1P-0007Nu-TT for submit@debbugs.gnu.org; Mon, 17 Mar 2014 00:19:33 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53871) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WPP1K-0007Nf-Sx for submit@debbugs.gnu.org; Mon, 17 Mar 2014 00:19:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WPP1E-0005UY-Ny for submit@debbugs.gnu.org; Mon, 17 Mar 2014 00:19:26 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:37940) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPP1E-0005UU-L6 for submit@debbugs.gnu.org; Mon, 17 Mar 2014 00:19:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55575) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPP19-00085t-Er for bug-gnu-emacs@gnu.org; Mon, 17 Mar 2014 00:19:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WPP14-0005Sm-C4 for bug-gnu-emacs@gnu.org; Mon, 17 Mar 2014 00:19:15 -0400 Received: from client-194-42-186-216.muenet.net ([194.42.186.216]:37190 helo=yun.yagibdah.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WPP13-0005Sg-Pz for bug-gnu-emacs@gnu.org; Mon, 17 Mar 2014 00:19:10 -0400 Received: from lee by yun.yagibdah.de with local (Exim 4.80.1) (envelope-from ) id 1WPP0u-0007CS-5L; Mon, 17 Mar 2014 05:19:00 +0100 From: lee To: bug-gnu-emacs@gnu.org Subject: 24.3.50; extension to hi-lock.el Date: Mon, 17 Mar 2014 05:18:59 +0100 Message-ID: <87mwgp1mq4.fsf@yun.yagibdah.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit Cc: koppel@ece.lsu.edu X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --=-=-= Content-Type: text/plain Dear developers, I`m attaching a patch on hi-lock.el which provides an extension. From the README: ,---- | This is an extension to hi-lock mode (of bzr revno 116727): | | You can use the buffer-local variable `hi-lock-patterns-file' to | specify a file to write the higlighting-patterns to. When this | variable is set, the highlighting-patterns will be kept in a dedicated | buffer instead of being written into the very file you`re editing. | | This is particularly useful --- and intended --- for highlighting | source code: You might have multiple source files of a project that | share a number of highlighting patterns. Rather than putting (a | lengthy list of) all the patterns into every file, you can set | `hi-lock-patterns-file' for these files to point to a single file and | have the patterns applied to them. This is like a '#include | "highlighting.patterns"'. | | Some functions and faces are provided to highlight constants, global | variables and function-like indentifiers. Key bindings are provided: | | | |-----------------+-------------| | | type | key binding | | |-----------------+-------------| | | constant | C-x w c | | | global variable | C-x w g | | | function-like | C-x w f | | |-----------------+-------------| | | You can revert to the highlighting-patterns in the dedicated buffer | with 'C-x w !'. | | | The buffer is transparently maintained and saved when you use these | key bindings. | | Besides using a separate file to store the highlighting-patterns, you | can store the patters in the same file they apply to the same as the | unmodified hi-lock-mode does. In case both patterns from a file and | patterns in the same buffer are used, both types of patterns | apply. This allows you to have a file with patterns used with multiple | files and also per-file patterns ("local patterns") at the same time. | The local patterns useful for instances when you want to highlight | something in one particular file but not in others while all the files | are using a separate file with common patterns. `---- The patch can be applied to hi-lock.el as it is in the git repository from a few hours ago. I`m hoping it can be taken in. --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: inline; filename=extension-hi-lock.el Content-Transfer-Encoding: quoted-printable Content-Description: git diff diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el index 78efd86..99b504e 100644 --- a/lisp/hi-lock.el +++ b/lisp/hi-lock.el @@ -142,6 +142,33 @@ Instead, each hi-lock command will cycle through the f= aces in :type 'boolean :version "24.4") =20 +(defcustom hi-lock-file-name-specifier "\\(-\\*- \\)hi-lock-patterns-file" + "Expression used to find the name of a file to read hi-lock +highlighting-patterns from. + +The default is set such that a line specifying the file variable +`hi-lock-patterns-file' can be found. + +Please see `hi-lock-get-patterns-file-name' for how this +expression is used." + :type '(string) + :group 'hi-lock) +(put 'hi-lock-patterns-file 'safe-local-variable #'stringp) + +(defcustom hi-lock-patterns-end-marker "hi-lock-patterns-end" + "Expression used to mark the end of hi-lock highlighting-patterns in +a buffer dedicated to holding such patterns. This can be a regular +expression. + +The expression that will be searched for is the return value of +`hi-lock-make-reasonable-end-marker'. It is appended to the buffer, +in a new line, by `hi-lock-write-patterns-file'. + +`hi-lock-get-patterns-from-file' uses it to figure out when to stop +reading the buffer." + :type '(string) + :group 'hi-lock) + (defgroup hi-lock-faces nil "Faces for hi-lock." :group 'hi-lock @@ -205,10 +232,32 @@ Instead, each hi-lock command will cycle through the = faces in "Face for hi-lock mode." :group 'hi-lock-faces) =20 +(defface hi-global-variable + '((t (:foreground "Magenta"))) + "Face to highlight global variables." + :group 'hi-lock-faces) + +(defface hi-functionlike + '((t (:foreground "LightGreen"))) + "Face to highlight something that is like a function." + :group 'hi-lock-faces) + +(defface hi-constant + '((t (:foreground "brown4"))) + "Face to highlight something that is a constant." + :group 'hi-faces) + (defvar-local hi-lock-file-patterns nil "Patterns found in file for hi-lock. Should not be changed.") (put 'hi-lock-file-patterns 'permanent-local t) =20 +(defvar-local hi-lock-patterns-file nil + "Remember the name of the file to read hi-lock highlighting-patterns + for this buffer from. + +Use this as buffer or dir local variable.") +(put 'hi-lock-patterns-file 'permanent-local t) + (defvar-local hi-lock-interactive-patterns nil "Patterns provided to hi-lock by user. Should not be changed.") (put 'hi-lock-interactive-patterns 'permanent-local t) @@ -242,33 +291,54 @@ a library is being loaded.") (let ((map (make-sparse-keymap "Hi Lock"))) (define-key-after map [highlight-regexp] '(menu-item "Highlight Regexp..." highlight-regexp - :help "Highlight text matching PATTERN (a regexp).")) + :help "Highlight text matching PATTERN (a regexp).")) =20 (define-key-after map [highlight-phrase] '(menu-item "Highlight Phrase..." highlight-phrase - :help "Highlight text matching PATTERN (a regexp processed to matc= h phrases).")) + :help "Highlight text matching PATTERN (a regexp processed to match ph= rases).")) =20 (define-key-after map [highlight-lines-matching-regexp] '(menu-item "Highlight Lines..." highlight-lines-matching-regexp - :help "Highlight lines containing match of PATTERN (a regexp).")) + :help "Highlight lines containing match of PATTERN (a regexp).")) =20 (define-key-after map [highlight-symbol-at-point] '(menu-item "Highlight Symbol at Point" highlight-symbol-at-point - :help "Highlight symbol found near point without prompting.")) + :help "Highlight symbol found near point without prompting.")) =20 (define-key-after map [unhighlight-regexp] '(menu-item "Remove Highlighting..." unhighlight-regexp - :help "Remove previously entered highlighting pattern." - :enable hi-lock-interactive-patterns)) + :help "Remove previously entered highlighting pattern." + :enable hi-lock-interactive-patterns)) =20 (define-key-after map [hi-lock-write-interactive-patterns] '(menu-item "Patterns to Buffer" hi-lock-write-interactive-patterns - :help "Insert interactively added REGEXPs into buffer at point." - :enable hi-lock-interactive-patterns)) + :help "Insert interactively added REGEXPs into buffer at point." + :enable hi-lock-interactive-patterns)) =20 (define-key-after map [hi-lock-find-patterns] '(menu-item "Patterns from Buffer" hi-lock-find-patterns - :help "Use patterns (if any) near top of buffer.")) + :help "Use patterns (if any) near top of buffer.")) + + (define-key-after map [hi-lock-constant] + '(menu-item "Highlight constant" hi-lock-constant + :help "Highlight something at point that is a constant.")) + + (define-key-after map [hi-lock-functionlike] + '(menu-item "Highlight functionlike" hi-lock-functionlike + :help "Highlight something at point that is like a function.")) + + (define-key-after map [hi-lock-global-variable] + '(menu-item "Highlight global variable" hi-lock-global-variable + :help "Highlight something at point that is a global variable.")) + + (define-key-after map [hi-lock-revert-patterns-from-file] + '(menu-item "Revert patterns from buffer" hi-lock-revert-patterns-fr= om-file + :help "Revert all highlighting patters to the patterns in the dedicate= d buffer." + :enable hi-lock-patterns-file)) + + (define-key-after map [hi-lock-revert-patterns-file-name] + '(menu-item "Revert name of patterns-file" hi-lock-revert-patterns-f= ile-name + :help "Revert the name of the file storing the highlighting patterns."= )) map) "Menu for hi-lock mode.") =20 @@ -281,6 +351,11 @@ a library is being loaded.") (define-key map "\C-xw." 'highlight-symbol-at-point) (define-key map "\C-xwr" 'unhighlight-regexp) (define-key map "\C-xwb" 'hi-lock-write-interactive-patterns) + (define-key map "\C-xwc" 'hi-lock-constant) + (define-key map "\C-xwf" 'hi-lock-functionlike) + (define-key map "\C-xwg" 'hi-lock-global-variable) + (define-key map "\C-xw!" 'hi-lock-revert-patterns-from-file) + (define-key map "\C-xwn" 'hi-lock-revert-patterns-file-name) map) "Key map for hi-lock.") =20 @@ -348,7 +423,56 @@ where FOO is a list of patterns. The patterns must st= art before position \(number of characters into buffer) `hi-lock-file-patterns-range'. Patterns will be read until Hi-lock: end is found. A mode is excluded if it's in the list -`hi-lock-exclude-modes'." +`hi-lock-exclude-modes'. + +\\[hi-lock-revert-patterns-file-name] + Search the current buffer for the variable + `hi-lock-patterns-file' and set it (to a potentially new value) + even when this variable is already set. + +This variable is used to specify a file in which to store +highlighting-patterns. This allows you to keep the patterns in a +separate file which can be shared among multiple files. This is +particularly useful when editing source code because you can use +a single file with highlighting-patterns which is shared by +multiple files of the same project. + +When using a separate file, highlighting-patterns can still be +written to the current buffer with +\\[hi-lock-write-interactive-patterns]. Both the patterns from +the current buffer and from the separate file apply. + +The file with the highlighting-patterns is transparently +maintained in a dedicated buffer. The dedicated buffer is +automatically saved to `hi-lock-patterns-file' when the current +buffer is saved. + +You can specify `hi-lock-patterns-file' as a buffer-local +variable. Please note that the value of this variable (the file +name) must be given in double-quotes. + +Please see also `hi-lock-file-name-specifier'. + +\\[hi-lock-constant] + Highlight the thing at point with the `hi-constant' face. + +\\[hi-lock-functionlike] + Highlight the thing at point with the `hi-functionlike' face. + +\\[hi-lock-global-variable] + Highlight the thing at point with the `hi-global' face. + +\\[hi-lock-revert-patterns-from-file] + Revert the currently used highlighting-patterns to the patterns + in `hi-lock-patterns-file'. + +\\[hi-lock-revert-patterns-file-name] + Once `hi-lock-patterns-file' has been set, the current buffer + is not searched again for a line specifying this variable. You + can revert to the value specified in the current buffer with + \\[hi-lock-revert-patterns-file-name]. This is for instances + when you modified the value of the variable and want the new + value take effect." :group 'hi-lock :lighter (:eval (if (or hi-lock-interactive-patterns hi-lock-file-patterns) @@ -377,7 +501,10 @@ versions before 22 use the following in your init file: (progn (define-key-after menu-bar-edit-menu [hi-lock] (cons "Regexp Highlighting" hi-lock-menu)) + ;; order does matter, see `hi-lock-apply-patterns-from-file' (hi-lock-find-patterns) + (hi-lock-apply-patterns-from-file) + (add-hook 'after-save-hook 'hi-lock-write-patterns-file t t) (add-hook 'font-lock-mode-hook 'hi-lock-font-lock-hook nil t) ;; Remove regexps from font-lock-keywords (bug#13891). (add-hook 'change-major-mode-hook (lambda () (hi-lock-mode -1)) nil t)) @@ -393,7 +520,8 @@ versions before 22 use the following in your init file: (remove-overlays nil nil 'hi-lock-overlay t) (when font-lock-fontified (font-lock-fontify-buffer))) (define-key-after menu-bar-edit-menu [hi-lock] nil) - (remove-hook 'font-lock-mode-hook 'hi-lock-font-lock-hook t))) + (remove-hook 'font-lock-mode-hook 'hi-lock-font-lock-hook t) + (remove-hook 'after-save-hook 'hi-lock-write-patterns-file t))) =20 ;;;###autoload (define-globalized-minor-mode global-hi-lock-mode @@ -624,6 +752,89 @@ be found in variable `hi-lock-interactive-patterns'." (when (> (point) hi-lock-file-patterns-range) (warn "Inserted keywords not close enough to top of file"))) =20 +(defsubst hi-lock-comment-start-protected () + "Since `comment-start' can sometimes be nil, return a default +for such instances, otherwise return `comment-start'." + (or comment-start "# ")) + +;;;###autoload +(defun hi-lock-get-patterns-file-name (&optional force) + "When `hi-lock-patterns-file' is not nil, attempt to set it from +`hi-lock-file-name-specifier' by searching the current buffer, unless +the variable is already set. + +When the optional argument FORCE is not nil, attempt to set the +variable regardless whether it is already set or not. + +The search is limited to between `point-min' and (+ (point-min) 1024)." + (interactive) + (unless (or + (not force) + hi-lock-patterns-file) + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (let ((file-name-specifier + (concat "^" (hi-lock-comment-start-protected) "[:space:]*" hi-lock= -file-name-specifier ": "))) + (when (re-search-forward file-name-specifier (+ (point) 1024) t) + (when (looking-at "\\\"") (forward-char) + (setq hi-lock-patterns-file (thing-at-point 'filename t))))))))) + +;;;###autoload +(defun hi-lock-revert-patterns-file-name () + "Use `hi-lock-get-patterns-file-name' to revert +`hi-lock-patterns-file' even when `hi-lock-patterns-file' is +already set." + (interactive) + (hi-lock-get-patterns-file-name t) + (message "use highlighting-patterns from %s" + hi-lock-patterns-file)) + +(defsubst hi-lock-make-reasonable-end-marker (for-writing) + "Return a regex which is a reasonable end-marker to indicate where + hi-lock highlighting-patterns inserted into a dedicated buffer + end. Reasonable particularly means that the marker shall be usable + even when `comment-start' is nil. + +When the argument 'for-writing' is nil, return a regex which matches +the end-marker used in the patterns=C2=B4 buffer. + +Otherwise, the returned marker is suited to be appended to a buffer." + (if for-writing + (concat (hi-lock-comment-start-protected) hi-lock-patterns-end-marke= r) + (concat "^" (hi-lock-comment-start-protected) "\\_<" hi-lock-patterns-= end-marker "\\_>"))) + +(defun hi-lock-quick-add (whichface) + "Highlight something at point with a face given in whichface." + (let* ((regexp (hi-lock-regexp-okay (find-tag-default-as-symbol-regexp))= )) + (hi-lock-set-pattern regexp whichface)) + ;; set modified to get the dedicated patterns buffer updated + (if hi-lock-patterns-file + (set-buffer-modified-p t) + (message "The variable `hi-lock-patterns-file' needs to be set to spec= ify a dedicated buffer to store patterns." ))) + +;;;###autoload +(defun hi-lock-constant () + "Add a pattern to highlight something at point that is a +constant." + (interactive) + (hi-lock-quick-add 'hi-constant)) + +;;;###autoload +(defun hi-lock-functionlike () + "Add a pattern to highlight something at point that is like a +function." + (interactive) + (hi-lock-quick-add 'hi-functionlike)) + +;;;###autoload +(defun hi-lock-global-variable () + "Add a pattern to highlight something at point that is a +global variable." + (interactive) + (hi-lock-quick-add 'hi-global-variable)) + ;; Implementation Functions =20 (defun hi-lock-process-phrase (phrase) @@ -753,6 +964,94 @@ with completion and history." (if (called-interactively-p 'interactive) (message "Hi-lock added %d patterns." (length all-patterns))))= ))) =20 +(defun hi-lock-get-patterns-from-file (file) + "Read hi-lock-mode highlighting-patterns from a file and return +the patterns read." + (with-current-buffer + (find-file-noselect file) + (goto-char (point-min)) + (let ((marker-pos + (re-search-forward (hi-lock-make-reasonable-end-marker nil) (point-max= ) t))) + (when marker-pos + (goto-char marker-pos) + (forward-line -1) + (end-of-line) + (setq marker-pos (point)) + (goto-char (point-min)) + (message "reading hi-lock highlighting-patterns from %s (characters %d..%= d)" + (buffer-name) + (point-min) marker-pos) + (let ((patterns nil)) + (while (< (point) marker-pos) + (setq patterns (append (read (current-buffer)) patterns))) + patterns))))) + +(defun hi-lock-apply-patterns-from-file () + "Use hi-lock-mode highlighting-patterns from another file with this + file. + +Which file to read the patterns from is specified through +`hi-lock-file-name-specifier'. This variable can be set as a +buffer-local variable. + +The file will be visited in another buffer, and additional patterns +are written to the other buffer and saved to the file when this file +is saved." + (hi-lock-get-patterns-file-name) + (when hi-lock-patterns-file + (let ((patterns (hi-lock-get-patterns-from-file hi-lock-patterns-file)= )) + ;; add the patterns specified within the current buffer because + ;; `hi-lock-set-file-patterns' unsets them + (setq patterns (append hi-lock-file-patterns patterns)) + (if (not patterns) + (message "found no patterns to apply to %s in %s" + (buffer-name) + hi-lock-patterns-file) + (hi-lock-set-file-patterns patterns) + (message "%d patterns applied from file %s to buffer %s" + (length patterns) + hi-lock-patterns-file + (buffer-name)))))) + +(defun hi-lock-write-patterns-file () + "When `hi-lock-patterns-file' is not nil, update the dedicated +buffer holding the hi-lock highlighting-patterns and save the +buffer to `hi-lock-patterns-file'." + (interactive) + (hi-lock-get-patterns-file-name) + (when hi-lock-patterns-file + (let ((all-patterns + (delete-dups (append + ;; put most recently added into first line of buffer + hi-lock-interactive-patterns + (hi-lock-get-patterns-from-file hi-lock-patterns-file))))) + (with-current-buffer + (find-file-noselect hi-lock-patterns-file) + (erase-buffer) + (mapc + (lambda (this) + (insert (format "(%s)\n" (prin1-to-string this)))) + all-patterns) + (insert (hi-lock-make-reasonable-end-marker t) "\n") + (save-buffer))))) + +(defun hi-lock-revert-patterns-from-file () + "Unset all hi-lock highlighting-patterns for the current buffer +and apply patterns from the buffers` patterns file. Do nothing +when no file for storing the patterns is specified for the +current buffer." + (interactive) + (hi-lock-get-patterns-file-name) + (if (not hi-lock-patterns-file) + (error "No buffer with patterns to revert to has been set") + (when hi-lock-interactive-patterns + (mapc + (lambda (this) + (hi-lock-unface-buffer (car this))) + hi-lock-interactive-patterns) + (setq hi-lock-interactive-patterns nil)) + (hi-lock-apply-patterns-from-file))) + (defun hi-lock-font-lock-hook () "Add hi-lock patterns to font-lock's." (when font-lock-fontified --=-=-= Content-Type: text/plain In GNU Emacs 24.3.50.2 (x86_64-unknown-linux-gnu, X toolkit) of 2014-03-17 on yun.yagibdah.de Windowing system distributor `Fedora Project', version 11.0.11404000 Configured using: `configure --without-gpm --without-toolkit-scroll-bars --with-x-toolkit=lucid --enable-link-time-optimization' -- Knowledge is volatile and fluid. Software is power. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 17 04:21:50 2014 Received: (at 17021) by debbugs.gnu.org; 17 Mar 2014 08:21:50 +0000 Received: from localhost ([127.0.0.1]:38589 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WPSnu-0006j9-1I for submit@debbugs.gnu.org; Mon, 17 Mar 2014 04:21:50 -0400 Received: from client-194-42-186-216.muenet.net ([194.42.186.216]:34617 helo=yun.yagibdah.de) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WPSnr-0006iy-Vf for 17021@debbugs.gnu.org; Mon, 17 Mar 2014 04:21:48 -0400 Received: from lee by yun.yagibdah.de with local (Exim 4.80.1) (envelope-from ) id 1WPSnm-0003D3-FM; Mon, 17 Mar 2014 09:21:42 +0100 From: lee To: 17021@debbugs.gnu.org Subject: Re: bug#17021: 24.3.50; extension to hi-lock.el In-Reply-To: <87mwgp1mq4.fsf@yun.yagibdah.de> (lee@yun.yagibdah.de's message of "Mon, 17 Mar 2014 05:18:59 +0100") Date: Mon, 17 Mar 2014 09:21:23 +0100 Organization: my virtual residence Message-ID: <871ty1kzgc.fsf@yun.yagibdah.de> References: <87mwgp1mq4.fsf@yun.yagibdah.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 17021 Cc: koppel@ece.lsu.edu X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.4 (/) lee writes: > Dear developers, > > I`m attaching a patch on hi-lock.el which provides an extension. From > the README: > > > ,---- > | This is an extension to hi-lock mode (of bzr revno 116727): > | > | You can use the buffer-local variable `hi-lock-patterns-file' to > | specify a file to write the higlighting-patterns to. > [...] I just found that there seems to be a problem with adding patterns to font-lock-keywords multiple times. I`m looking into fixing this atm. -- Knowledge is volatile and fluid. Software is power. From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 17 06:53:42 2014 Received: (at 17021) by debbugs.gnu.org; 17 Mar 2014 10:53:42 +0000 Received: from localhost ([127.0.0.1]:38639 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WPVAr-0002wq-N0 for submit@debbugs.gnu.org; Mon, 17 Mar 2014 06:53:41 -0400 Received: from client-194-42-186-216.muenet.net ([194.42.186.216]:34660 helo=yun.yagibdah.de) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WPVAo-0002wf-SV for 17021@debbugs.gnu.org; Mon, 17 Mar 2014 06:53:39 -0400 Received: from lee by yun.yagibdah.de with local (Exim 4.80.1) (envelope-from ) id 1WPVAk-0006rC-1x; Mon, 17 Mar 2014 11:53:34 +0100 From: lee To: 17021@debbugs.gnu.org Subject: Re: bug#17021: 24.3.50; extension to hi-lock.el In-Reply-To: <871ty1kzgc.fsf@yun.yagibdah.de> (lee@yun.yagibdah.de's message of "Mon, 17 Mar 2014 09:21:23 +0100") Date: Mon, 17 Mar 2014 11:53:28 +0100 Organization: my virtual residence Message-ID: <877g7thz9z.fsf@yun.yagibdah.de> References: <87mwgp1mq4.fsf@yun.yagibdah.de> <871ty1kzgc.fsf@yun.yagibdah.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 17021 Cc: koppel@ece.lsu.edu X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.4 (/) lee writes: > lee writes: > >> Dear developers, >> >> I`m attaching a patch on hi-lock.el which provides an extension. From >> the README: >> >> >> ,---- >> | This is an extension to hi-lock mode (of bzr revno 116727): >> | >> | You can use the buffer-local variable `hi-lock-patterns-file' to >> | specify a file to write the higlighting-patterns to. >> [...] > > I just found that there seems to be a problem with adding patterns to > font-lock-keywords multiple times. I`m looking into fixing this atm. Please see bug#17023: (24.3.50; font-lock-add-keywords creates duplicates). -- Knowledge is volatile and fluid. Software is power. From debbugs-submit-bounces@debbugs.gnu.org Mon Mar 24 00:54:18 2014 Received: (at 17021) by debbugs.gnu.org; 24 Mar 2014 04:54:18 +0000 Received: from localhost ([127.0.0.1]:46623 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WRwts-0001VT-R6 for submit@debbugs.gnu.org; Mon, 24 Mar 2014 00:54:18 -0400 Received: from client-194-42-186-216.muenet.net ([194.42.186.216]:44466 helo=yun.yagibdah.de) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WRwtn-0001VD-G5 for 17021@debbugs.gnu.org; Mon, 24 Mar 2014 00:54:13 -0400 Received: from lee by yun.yagibdah.de with local (Exim 4.80.1) (envelope-from ) id 1WRwtl-0000Hi-O9 for 17021@debbugs.gnu.org; Mon, 24 Mar 2014 05:54:09 +0100 From: lee To: 17021@debbugs.gnu.org Subject: updated patch Date: Mon, 24 Mar 2014 05:54:06 +0100 Message-ID: <87mwggb3ip.fsf@yun.yagibdah.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.4 (/) X-Debbugs-Envelope-To: 17021 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.4 (/) --=-=-= Content-Type: text/plain Here`s an updated version of the patch: --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline; filename=hi-lock.diff Content-Transfer-Encoding: quoted-printable diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el index 78efd86..85c3216 100644 --- a/lisp/hi-lock.el +++ b/lisp/hi-lock.el @@ -142,6 +142,33 @@ Instead, each hi-lock command will cycle through the f= aces in :type 'boolean :version "24.4") =20 +(defcustom hi-lock-file-name-specifier "\\(-\\*- \\)hi-lock-patterns-file" + "Expression used to find the name of a file to read hi-lock +highlighting-patterns from. + +The default is set such that a line specifying the file variable +`hi-lock-patterns-file' can be found. + +Please see `hi-lock-get-patterns-file-name' for how this +expression is used." + :type '(string) + :group 'hi-lock) +(put 'hi-lock-patterns-file 'safe-local-variable #'stringp) + +(defcustom hi-lock-patterns-end-marker "hi-lock-patterns-end" + "Expression used to mark the end of hi-lock highlighting-patterns in +a buffer dedicated to holding such patterns. This can be a regular +expression. + +The expression that will be searched for is the return value of +`hi-lock-make-reasonable-end-marker'. It is appended to the buffer, +in a new line, by `hi-lock-write-patterns-file'. + +`hi-lock-get-patterns-from-file' uses it to figure out when to stop +reading the buffer." + :type '(string) + :group 'hi-lock) + (defgroup hi-lock-faces nil "Faces for hi-lock." :group 'hi-lock @@ -205,10 +232,36 @@ Instead, each hi-lock command will cycle through the = faces in "Face for hi-lock mode." :group 'hi-lock-faces) =20 +(defface hi-global-variable + '((t (:foreground "Magenta"))) + "Face to highlight global variables." + :group 'hi-lock-faces) + +(defface hi-functionlike + '((t (:foreground "LightGreen"))) + "Face to highlight something that is like a function." + :group 'hi-lock-faces) + +(defface hi-constant + '((t (:foreground "brown4"))) + "Face to highlight something that is a constant." + :group 'hi-faces) + (defvar-local hi-lock-file-patterns nil "Patterns found in file for hi-lock. Should not be changed.") (put 'hi-lock-file-patterns 'permanent-local t) =20 +(defvar-local hi-lock-other-patterns nil + "Patterns for hi-lock found in a separate file. See +`hi-lock-patterns-file'.") + +(defvar-local hi-lock-patterns-file nil + "Remember the name of the file to read hi-lock highlighting-patterns + for this buffer from. + +Use this as buffer or dir local variable.") +(put 'hi-lock-patterns-file 'permanent-local t) + (defvar-local hi-lock-interactive-patterns nil "Patterns provided to hi-lock by user. Should not be changed.") (put 'hi-lock-interactive-patterns 'permanent-local t) @@ -242,33 +295,54 @@ a library is being loaded.") (let ((map (make-sparse-keymap "Hi Lock"))) (define-key-after map [highlight-regexp] '(menu-item "Highlight Regexp..." highlight-regexp - :help "Highlight text matching PATTERN (a regexp).")) + :help "Highlight text matching PATTERN (a regexp).")) =20 (define-key-after map [highlight-phrase] '(menu-item "Highlight Phrase..." highlight-phrase - :help "Highlight text matching PATTERN (a regexp processed to matc= h phrases).")) + :help "Highlight text matching PATTERN (a regexp processed to match ph= rases).")) =20 (define-key-after map [highlight-lines-matching-regexp] '(menu-item "Highlight Lines..." highlight-lines-matching-regexp - :help "Highlight lines containing match of PATTERN (a regexp).")) + :help "Highlight lines containing match of PATTERN (a regexp).")) =20 (define-key-after map [highlight-symbol-at-point] '(menu-item "Highlight Symbol at Point" highlight-symbol-at-point - :help "Highlight symbol found near point without prompting.")) + :help "Highlight symbol found near point without prompting.")) =20 (define-key-after map [unhighlight-regexp] '(menu-item "Remove Highlighting..." unhighlight-regexp - :help "Remove previously entered highlighting pattern." - :enable hi-lock-interactive-patterns)) + :help "Remove previously entered highlighting pattern." + :enable hi-lock-interactive-patterns)) =20 (define-key-after map [hi-lock-write-interactive-patterns] '(menu-item "Patterns to Buffer" hi-lock-write-interactive-patterns - :help "Insert interactively added REGEXPs into buffer at point." - :enable hi-lock-interactive-patterns)) + :help "Insert interactively added REGEXPs into buffer at point." + :enable hi-lock-interactive-patterns)) =20 (define-key-after map [hi-lock-find-patterns] '(menu-item "Patterns from Buffer" hi-lock-find-patterns - :help "Use patterns (if any) near top of buffer.")) + :help "Use patterns (if any) near top of buffer.")) + + (define-key-after map [hi-lock-constant] + '(menu-item "Highlight constant" hi-lock-constant + :help "Highlight something at point that is a constant.")) + + (define-key-after map [hi-lock-functionlike] + '(menu-item "Highlight functionlike" hi-lock-functionlike + :help "Highlight something at point that is like a function.")) + + (define-key-after map [hi-lock-global-variable] + '(menu-item "Highlight global variable" hi-lock-global-variable + :help "Highlight something at point that is a global variable.")) + + (define-key-after map [hi-lock-revert-patterns-from-file] + '(menu-item "Revert patterns from buffer" hi-lock-revert-patterns-fr= om-file + :help "Revert all highlighting patters to the patterns in the dedicate= d buffer." + :enable hi-lock-patterns-file)) + + (define-key-after map [hi-lock-revert-patterns-file-name] + '(menu-item "Revert name of patterns-file" hi-lock-revert-patterns-f= ile-name + :help "Revert the name of the file storing the highlighting patterns."= )) map) "Menu for hi-lock mode.") =20 @@ -281,6 +355,11 @@ a library is being loaded.") (define-key map "\C-xw." 'highlight-symbol-at-point) (define-key map "\C-xwr" 'unhighlight-regexp) (define-key map "\C-xwb" 'hi-lock-write-interactive-patterns) + (define-key map "\C-xwc" 'hi-lock-constant) + (define-key map "\C-xwf" 'hi-lock-functionlike) + (define-key map "\C-xwg" 'hi-lock-global-variable) + (define-key map "\C-xw!" 'hi-lock-revert-patterns-from-file) + (define-key map "\C-xwn" 'hi-lock-revert-patterns-file-name) map) "Key map for hi-lock.") =20 @@ -348,7 +427,56 @@ where FOO is a list of patterns. The patterns must st= art before position \(number of characters into buffer) `hi-lock-file-patterns-range'. Patterns will be read until Hi-lock: end is found. A mode is excluded if it's in the list -`hi-lock-exclude-modes'." +`hi-lock-exclude-modes'. + +\\[hi-lock-revert-patterns-file-name] + Search the current buffer for the variable + `hi-lock-patterns-file' and set it (to a potentially new value) + even when this variable is already set. + +This variable is used to specify a file in which to store +highlighting-patterns. This allows you to keep the patterns in a +separate file which can be shared among multiple files. This is +particularly useful when editing source code because you can use +a single file with highlighting-patterns which is shared by +multiple files of the same project. + +When using a separate file, highlighting-patterns can still be +written to the current buffer with +\\[hi-lock-write-interactive-patterns]. Both the patterns from +the current buffer and from the separate file apply. + +The file with the highlighting-patterns is transparently +maintained in a dedicated buffer. The dedicated buffer is +automatically saved to `hi-lock-patterns-file' when the current +buffer is saved. + +You can specify `hi-lock-patterns-file' as a buffer-local +variable. Please note that the value of this variable (the file +name) must be given in double-quotes. + +Please see also `hi-lock-file-name-specifier'. + +\\[hi-lock-constant] + Highlight the thing at point with the `hi-constant' face. + +\\[hi-lock-functionlike] + Highlight the thing at point with the `hi-functionlike' face. + +\\[hi-lock-global-variable] + Highlight the thing at point with the `hi-global' face. + +\\[hi-lock-revert-patterns-from-file] + Revert the currently used highlighting-patterns to the patterns + in `hi-lock-patterns-file'. + +\\[hi-lock-revert-patterns-file-name] + Once `hi-lock-patterns-file' has been set, the current buffer + is not searched again for a line specifying this variable. You + can revert to the value specified in the current buffer with + \\[hi-lock-revert-patterns-file-name]. This is for instances + when you modified the value of the variable and want the new + value take effect." :group 'hi-lock :lighter (:eval (if (or hi-lock-interactive-patterns hi-lock-file-patterns) @@ -377,23 +505,29 @@ versions before 22 use the following in your init fil= e: (progn (define-key-after menu-bar-edit-menu [hi-lock] (cons "Regexp Highlighting" hi-lock-menu)) + ;; order does matter, see `hi-lock-apply-patterns-from-file' (hi-lock-find-patterns) + (hi-lock-apply-patterns-from-file) + (add-hook 'after-save-hook 'hi-lock-write-patterns-file t t) (add-hook 'font-lock-mode-hook 'hi-lock-font-lock-hook nil t) ;; Remove regexps from font-lock-keywords (bug#13891). (add-hook 'change-major-mode-hook (lambda () (hi-lock-mode -1)) nil t)) ;; Turned off. (when (or hi-lock-interactive-patterns - hi-lock-file-patterns) + hi-lock-file-patterns + hi-lock-other-patterns) (when hi-lock-interactive-patterns (font-lock-remove-keywords nil hi-lock-interactive-patterns) (setq hi-lock-interactive-patterns nil)) (when hi-lock-file-patterns (font-lock-remove-keywords nil hi-lock-file-patterns) (setq hi-lock-file-patterns nil)) + (hi-lock-unapply-patterns-from-file) (remove-overlays nil nil 'hi-lock-overlay t) (when font-lock-fontified (font-lock-fontify-buffer))) (define-key-after menu-bar-edit-menu [hi-lock] nil) - (remove-hook 'font-lock-mode-hook 'hi-lock-font-lock-hook t))) + (remove-hook 'font-lock-mode-hook 'hi-lock-font-lock-hook t) + (remove-hook 'after-save-hook 'hi-lock-write-patterns-file t))) =20 ;;;###autoload (define-globalized-minor-mode global-hi-lock-mode @@ -624,6 +758,94 @@ be found in variable `hi-lock-interactive-patterns'." (when (> (point) hi-lock-file-patterns-range) (warn "Inserted keywords not close enough to top of file"))) =20 +(defsubst hi-lock-comment-start-protected () + "Since `comment-start' can sometimes be nil, return a default +for such instances, otherwise return `comment-start'." + (or comment-start "# ")) + +;;;###autoload +(defun hi-lock-get-patterns-file-name (&optional force) + "When `hi-lock-patterns-file' is not nil, attempt to set it from +`hi-lock-file-name-specifier' by searching the current buffer, unless +the variable is already set. + +When the optional argument FORCE is not nil, attempt to set the +variable regardless whether it is already set or not. + +In any case, return the value of `hi-lock-patterns-file', which +can be nil when not specified in the current buffer. + +The search is limited to between `point-min' and (+ (point-min) 1024)." + (interactive) + (if (or + force + (not hi-lock-patterns-file)) + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (let ((file-name-specifier + (concat "^" (hi-lock-comment-start-protected) "[:space:]*" hi-lock-file= -name-specifier ": "))) + (when (re-search-forward file-name-specifier (+ (point) 1024) t) + (when (looking-at "\\\"") (forward-char) + (setq hi-lock-patterns-file (thing-at-point 'filename t)))))))) + hi-lock-patterns-file) + +;;;###autoload +(defun hi-lock-revert-patterns-file-name () + "Use `hi-lock-get-patterns-file-name' to revert +`hi-lock-patterns-file' even when `hi-lock-patterns-file' is +already set." + (interactive) + (if (hi-lock-get-patterns-file-name t) + (message "Use highlighting-patterns from %s" + hi-lock-patterns-file) + (error "Nothing found to set `hi-lock-patterns-file' from"))) + +(defsubst hi-lock-make-reasonable-end-marker (for-writing) + "Return a regex which is a reasonable end-marker to indicate where + hi-lock highlighting-patterns inserted into a dedicated buffer + end. Reasonable particularly means that the marker shall be usable + even when `comment-start' is nil. + +When the argument 'for-writing' is nil, return a regex which matches +the end-marker used in the patterns=C2=B4 buffer. + +Otherwise, the returned marker is suited to be appended to a buffer." + (if for-writing + (concat (hi-lock-comment-start-protected) hi-lock-patterns-end-marke= r) + (concat "^" (hi-lock-comment-start-protected) "\\_<" hi-lock-patterns-= end-marker "\\_>"))) + +(defun hi-lock-quick-add (whichface) + "Highlight something at point with a face given in whichface." + (let* ((regexp (hi-lock-regexp-okay (find-tag-default-as-symbol-regexp))= )) + (hi-lock-set-pattern regexp whichface)) + ;; set modified to get the dedicated patterns buffer updated + (if hi-lock-patterns-file + (set-buffer-modified-p t) + (message "The variable `hi-lock-patterns-file' needs to be set to spec= ify a dedicated buffer to store patterns." ))) + +;;;###autoload +(defun hi-lock-constant () + "Add a pattern to highlight something at point that is a +constant." + (interactive) + (hi-lock-quick-add 'hi-constant)) + +;;;###autoload +(defun hi-lock-functionlike () + "Add a pattern to highlight something at point that is like a +function." + (interactive) + (hi-lock-quick-add 'hi-functionlike)) + +;;;###autoload +(defun hi-lock-global-variable () + "Add a pattern to highlight something at point that is a +global variable." + (interactive) + (hi-lock-quick-add 'hi-global-variable)) + ;; Implementation Functions =20 (defun hi-lock-process-phrase (phrase) @@ -753,10 +975,100 @@ with completion and history." (if (called-interactively-p 'interactive) (message "Hi-lock added %d patterns." (length all-patterns))))= ))) =20 +(defun hi-lock-get-patterns-from-file (file) + "Read hi-lock-mode highlighting-patterns from a file and return +the patterns read." + (with-current-buffer + (find-file-noselect file) + (goto-char (point-min)) + (let ((marker-pos + (re-search-forward (hi-lock-make-reasonable-end-marker nil) (point-max= ) t))) + (when marker-pos + (goto-char marker-pos) + (forward-line -1) + (end-of-line) + (setq marker-pos (point)) + (goto-char (point-min)) + (message "reading hi-lock highlighting-patterns from %s (characters %d..%= d)" + (buffer-name) + (point-min) marker-pos) + (let ((patterns nil)) + (while (< (point) marker-pos) + (setq patterns (append (read (current-buffer)) patterns))) + patterns))))) + +(defsubst hi-lock-unapply-patterns-from-file () + "Disable all highlighting-patterns from another file which is +used with this file. The patterns are not deleted or otherwise +modified; only the highlighting they bring about is disabled." + (font-lock-remove-keywords nil hi-lock-other-patterns) + (setq hi-lock-other-patterns nil)) + +(defun hi-lock-apply-patterns-from-file () + "Use hi-lock-mode highlighting-patterns from another file with this + file. + +Which file to read the patterns from is specified through +`hi-lock-file-name-specifier'. This variable can be set as a +buffer-local variable. + +The file will be visited in another buffer, and additional patterns +are written to the other buffer and saved to the file when this file +is saved." + (hi-lock-unapply-patterns-from-file) + (when (hi-lock-get-patterns-file-name) + (setq hi-lock-other-patterns (hi-lock-get-patterns-from-file hi-lock-p= atterns-file))) + (if (not hi-lock-other-patterns) + (message "found no patterns to apply to %s in %s" + (buffer-name) + hi-lock-patterns-file) + (font-lock-add-keywords nil hi-lock-other-patterns) + (message "%d patterns applied from file %s to buffer %s" + (length hi-lock-other-patterns) + hi-lock-patterns-file + (buffer-name))) + (font-lock-fontify-buffer)) + +(defun hi-lock-write-patterns-file () + "When `hi-lock-patterns-file' is not nil, update the dedicated +buffer holding the hi-lock highlighting-patterns and save the +buffer to `hi-lock-patterns-file'." + (interactive) + (when (hi-lock-get-patterns-file-name) + (let ((all-patterns + (delete-dups (append + ;; put most recently added into first line of buffer + hi-lock-interactive-patterns + ;; the patterns buffer may have been edited, + ;; hence do not append `hi-lock-other-patterns' + (hi-lock-get-patterns-from-file hi-lock-patterns-file))))) + (with-current-buffer (find-file-noselect hi-lock-patterns-file) + (erase-buffer) + (mapc + (lambda (this) + (insert (format "(%s)\n" (prin1-to-string this)))) + all-patterns) + (insert (hi-lock-make-reasonable-end-marker t) "\n") + (save-buffer))))) + +(defun hi-lock-revert-patterns-from-file () + "Unset all hi-lock highlighting-patterns for the current buffer +and apply patterns from the buffers` patterns file. Do nothing +when no file for storing the patterns is specified for the +current buffer." + (interactive) + (hi-lock-unface-buffer t) + (hi-lock-unapply-patterns-from-file) + (if (not (hi-lock-get-patterns-file-name)) + (error "No buffer with patterns to revert to has been set") + (hi-lock-find-patterns) + (hi-lock-apply-patterns-from-file))) + (defun hi-lock-font-lock-hook () "Add hi-lock patterns to font-lock's." (when font-lock-fontified (font-lock-add-keywords nil hi-lock-file-patterns t) + (font-lock-add-keywords nil hi-lock-other-patterns t) (font-lock-add-keywords nil hi-lock-interactive-patterns t))) =20 (defvar hi-lock--hashcons-hash --=-=-= Content-Type: text/plain -- Knowledge is volatile and fluid. Software is power. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 29 23:47:43 2019 Received: (at control) by debbugs.gnu.org; 30 Sep 2019 03:47:43 +0000 Received: from localhost ([127.0.0.1]:56439 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iEmf1-0004uw-FJ for submit@debbugs.gnu.org; Sun, 29 Sep 2019 23:47:43 -0400 Received: from mail-pf1-f182.google.com ([209.85.210.182]:41447) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iEmey-0004ua-UL for control@debbugs.gnu.org; Sun, 29 Sep 2019 23:47:42 -0400 Received: by mail-pf1-f182.google.com with SMTP id q7so4781700pfh.8 for ; Sun, 29 Sep 2019 20:47:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=aaRSA4Pw/O1GmSC53TmI1N40gGPzQsbt4X/CyMjtEUM=; b=ZQXl/QeheR3M5+takiYjwlP6eIbDIP/u/fOJmo2J9A7rrG8BBWOPBQ8S5wMfAGZFBL sQLN2psu/26v791jHXsgIUldy2sTay3+DXV03eIitW+JTELbFkcbH9P2pt2nSrvtZaRz SZglIj8yXCp0qbIBSmEI3WcJXK32Le/8XeF70hsvDM+9decUn0Wc4Q+6u4nfRA9ZEgG6 2nFgUBy0cJXq8tOnQ5a/zLRwCiFl0TzewC88YNhubtZ3n9bnrudI7ilqgJiJZ786u2BT RxXHBtfjbDQ6q+BQg37/0ayX9g6HVWWzMZcdWwsomIUGtPaOcQt4xjjBuBO/yFggG8if FxBA== X-Gm-Message-State: APjAAAV+Bi1KcKq/7xru3VULObfNz/6qVi0mn3Ay5alXsFvFvF9fhtzp oGxiXf7xkOtrvONIvHsxXW4pag4HtAu367A8CmHyS6OjBDo= X-Google-Smtp-Source: APXvYqxp7mVEcTRGQ4xZViOtpTFV6ZQWIoePrJ8dxqwcNH3eWNw+qyAW1W6yzPF4ZHe2yI7AyIIa+EJPvk6YHwbSthc= X-Received: by 2002:aa7:8750:: with SMTP id g16mr18585229pfo.190.1569815254951; Sun, 29 Sep 2019 20:47:34 -0700 (PDT) MIME-Version: 1.0 From: Stefan Kangas Date: Mon, 30 Sep 2019 05:47:23 +0200 Message-ID: Subject: To: control@debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: tags 17021 + patch quit Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (stefankangas[at]gmail.com) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.210.182 listed in list.dnswl.org] 0.0 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and EnvelopeFrom freemail headers are different 2.0 BLANK_SUBJECT Subject is present but empty X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) tags 17021 + patch quit From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 13 06:33:09 2020 Received: (at 17021) by debbugs.gnu.org; 13 Aug 2020 10:33:09 +0000 Received: from localhost ([127.0.0.1]:47042 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6AXd-0001GG-UH for submit@debbugs.gnu.org; Thu, 13 Aug 2020 06:33:09 -0400 Received: from quimby.gnus.org ([95.216.78.240]:55894) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6AXb-0001Fi-9v for 17021@debbugs.gnu.org; Thu, 13 Aug 2020 06:32:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=ecXy/7O6G/L9wjGZpvkNPVKyS6jkkddH5cAxLjNHe2c=; b=ajtFHa/BqlX23CKGsFfITbvnt3 +r4Sz9Nt7pWQFhF9doBzOjsSloqmCewXjx2upCTvy10mYves7hJmJFE8xHGtX4Irmxe3Alc46eJ6U fSQO3sAs8LT4fermlhubWOUs9V2nuquvw2+yYN1gQRkRx6i9i/LN7XeryzKkW4vxdwSg=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k6AXR-00053z-JG; Thu, 13 Aug 2020 12:32:52 +0200 From: Lars Ingebrigtsen To: lee Subject: Re: bug#17021: 24.3.50; extension to hi-lock.el References: <87mwgp1mq4.fsf@yun.yagibdah.de> Date: Thu, 13 Aug 2020 12:32:48 +0200 In-Reply-To: <87mwgp1mq4.fsf@yun.yagibdah.de> (lee@yun.yagibdah.de's message of "Mon, 17 Mar 2014 05:18:59 +0100") Message-ID: <877du2g7jj.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: lee writes: > | This is an extension to hi-lock mode (of bzr revno 116727): > | > | You can use the buffer-local variable `hi-lock-patterns-file' to > | specify a file to write the higlighting-patterns to. When t [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 17021 Cc: koppel@ece.lsu.edu, 17021@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) lee writes: > | This is an extension to hi-lock mode (of bzr revno 116727): > | > | You can use the buffer-local variable `hi-lock-patterns-file' to > | specify a file to write the higlighting-patterns to. When this > | variable is set, the highlighting-patterns will be kept in a dedicated > | buffer instead of being written into the very file you`re editing. This patch unfortunately got no attention when it was posted seven years ago, and it no longer applies to Emacs 28. I am not a hi-lock user myself -- are there anybody else on the bugs mailing list here that can comment on whether this is something we'd want to add? It does sound useful to me, but I'm not really familiar with how hi-lock works. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 13 06:33:21 2020 Received: (at control) by debbugs.gnu.org; 13 Aug 2020 10:33:21 +0000 Received: from localhost ([127.0.0.1]:47045 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6AXl-0001GW-Af for submit@debbugs.gnu.org; Thu, 13 Aug 2020 06:33:21 -0400 Received: from quimby.gnus.org ([95.216.78.240]:55908) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6AXg-0001Fr-8q for control@debbugs.gnu.org; Thu, 13 Aug 2020 06:33:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=m3i50HJ9bEzdWNUm5mHaBvGhkln4fEqMbmQQyGOTxcg=; b=VvGRyAwm4ZKN0jnd4sXuPZvReo aphz9BlOm0rXiwtiBNR75sbC3NbIRC9ZGzTEEuHut7eASJ0VTg/B+yo5P5ysCwlEa9MbOYnLMVEZC p33Yzop3hVOvtgcwRFi0EKWD/zqXDOoFF4v9pcH6q12ZFUBymQmQQydul6vamf8HAUmc=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k6AXY-000549-En for control@debbugs.gnu.org; Thu, 13 Aug 2020 12:32:58 +0200 Date: Thu, 13 Aug 2020 12:32:55 +0200 Message-Id: <875z9mg7jc.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #17021 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 17021 + moreinfo quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 17021 + moreinfo quit From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 13 14:43:12 2020 Received: (at 17021) by debbugs.gnu.org; 13 Aug 2020 18:43:12 +0000 Received: from localhost ([127.0.0.1]:51073 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6IC0-0005di-5C for submit@debbugs.gnu.org; Thu, 13 Aug 2020 14:43:12 -0400 Received: from relay001.lsu.edu ([130.39.6.46]:44766 helo=relay.lsu.edu) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6IBy-0005dT-GI for 17021@debbugs.gnu.org; Thu, 13 Aug 2020 14:43:11 -0400 Received: from cyc.ece.lsu.edu (cyc.ece.lsu.edu [96.125.115.182]) by relay.lsu.edu (Postfix) with ESMTPS id 2B5DF2194137; Thu, 13 Aug 2020 13:43:03 -0500 (CDT) From: David Koppelman To: Lars Ingebrigtsen Subject: Re: bug#17021: 24.3.50; extension to hi-lock.el References: <87mwgp1mq4.fsf@yun.yagibdah.de> <877du2g7jj.fsf@gnus.org> Date: Thu, 13 Aug 2020 13:43:03 -0500 In-Reply-To: <877du2g7jj.fsf@gnus.org> (Lars Ingebrigtsen's message of "Thu, 13 Aug 2020 12:32:48 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 17021 Cc: lee , 17021@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) This does sound useful, but I'd need to see the patch. Use of this variable should be guarded by hi-lock-file-patterns-policy too. Lars Ingebrigtsen writes: > lee writes: > >> | This is an extension to hi-lock mode (of bzr revno 116727): >> | >> | You can use the buffer-local variable `hi-lock-patterns-file' to >> | specify a file to write the higlighting-patterns to. When this >> | variable is set, the highlighting-patterns will be kept in a dedicated >> | buffer instead of being written into the very file you`re editing. > > This patch unfortunately got no attention when it was posted seven years > ago, and it no longer applies to Emacs 28. > > I am not a hi-lock user myself -- are there anybody else on the bugs > mailing list here that can comment on whether this is something we'd > want to add? It does sound useful to me, but I'm not really familiar > with how hi-lock works. From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 13 15:50:30 2020 Received: (at 17021) by debbugs.gnu.org; 13 Aug 2020 19:50:30 +0000 Received: from localhost ([127.0.0.1]:51160 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6JF8-0007H6-4G for submit@debbugs.gnu.org; Thu, 13 Aug 2020 15:50:30 -0400 Received: from mail-yb1-f179.google.com ([209.85.219.179]:42775) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6JF5-0007Ge-K6 for 17021@debbugs.gnu.org; Thu, 13 Aug 2020 15:50:28 -0400 Received: by mail-yb1-f179.google.com with SMTP id a34so3932892ybj.9 for <17021@debbugs.gnu.org>; Thu, 13 Aug 2020 12:50:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:in-reply-to:references:mime-version:date:message-id:subject:to :cc; bh=TpyoezG5RSRY3ixTiZW3puJYvbnDG+XRth/HfzI2tTY=; b=IA1UQokfxLyD4inaArco6Vm1SeLApBsSzihPadiCfA6/DEbz2Oki9rL1o8LXvnvEpa /7s2ReAN6cQG8SNTfEHcnL8+//GtuYLK0E+OJhmOWy/QWQsuMiZD0G1uBbtXlSFbOgN4 KOyI3qJHTZ2rPCGayXZnfGyKNVm5ejIAC30KlhJpZWIhYtqgQwHPBuGuUHkGlJqO+v2j TwOA/1ltHBRMzlvQ/EfmMxuN9b1aTw1ajVVR0GrdI4EwD9CneXrklcLpt9hUnvNjGI4u k1+ioau6a3KXRuUel3isFxoje2+HywhWQeYU/WYtaD5Zp8yzKHO468A4rx4BvRt4hVs2 SYjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:in-reply-to:references:mime-version:date :message-id:subject:to:cc; bh=TpyoezG5RSRY3ixTiZW3puJYvbnDG+XRth/HfzI2tTY=; b=dnk8QD/4YMbndzvcD96I4UF+3PNRKpvCYtw5KkopvOuI+smmPN0iuf2rOUk7u9/v/J BVMSimAVesFrTaFLPlc56NuE1+ss58IrKRWJ4rj47XEvJM4YqupDZWCSzZ3O2FivOA2u 5or8TXPgRJ0Q7LeR6gph2gmr489WTPnX20Ao6zgw0VwhpmEBa9uuvBMiw6ZPsOKkdoh8 u+acFYm4j0//x5ts3SO2Fu3pNrXYISfuQMNox+VQ8sxD2pfb0D5G0b6sYiaV9eSFWO1C otc4YwxwKe/o1iNYmgMRDFZ42kjKm4/9SxBpPbXF+0QnyXdZY5bgl3B92qvPIKS43bLU 9USQ== X-Gm-Message-State: AOAM533rh1I4OmFwAIkyWg1OrCYCsQU1bgxoYxTyWWFummD+nBvcRhqF iOzz3akRpyoAF5C9TJRtt/g32zO7cbZpMkWr59K6a5jNG+s= X-Google-Smtp-Source: ABdhPJzG6GGt2zmGkkmKGjwAqx2AA9+ABGCfoa3aHXQT7KvqKTWChdyGi62lZICJs/NPoqTyiQDk/MpS2QWkcMpFvF4= X-Received: by 2002:a25:b290:: with SMTP id k16mr8913362ybj.389.1597348222144; Thu, 13 Aug 2020 12:50:22 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Thu, 13 Aug 2020 12:50:20 -0700 From: Stefan Kangas In-Reply-To: References: <87mwgp1mq4.fsf@yun.yagibdah.de> <877du2g7jj.fsf@gnus.org> MIME-Version: 1.0 Date: Thu, 13 Aug 2020 12:50:20 -0700 Message-ID: Subject: Re: bug#17021: 24.3.50; extension to hi-lock.el To: David Koppelman , Lars Ingebrigtsen Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 17021 Cc: lee , 17021@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) David Koppelman writes: > This does sound useful, but I'd need to see the patch. Use of this > variable should be guarded by hi-lock-file-patterns-policy too. The patch is available at: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=17021#14 Best regards, Stefan Kangas From debbugs-submit-bounces@debbugs.gnu.org Thu Aug 13 17:46:23 2020 Received: (at 17021) by debbugs.gnu.org; 13 Aug 2020 21:46:23 +0000 Received: from localhost ([127.0.0.1]:51311 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6L3H-00025I-HU for submit@debbugs.gnu.org; Thu, 13 Aug 2020 17:46:23 -0400 Received: from relay.lsu.edu ([130.39.6.46]:50276) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k6L3F-000252-4s for 17021@debbugs.gnu.org; Thu, 13 Aug 2020 17:46:22 -0400 Received: from cyc.ece.lsu.edu (cyc.ece.lsu.edu [96.125.115.182]) by relay.lsu.edu (Postfix) with ESMTPS id 74A472183A02; Thu, 13 Aug 2020 16:46:14 -0500 (CDT) From: David Koppelman To: Stefan Kangas Subject: Re: bug#17021: 24.3.50; extension to hi-lock.el References: <87mwgp1mq4.fsf@yun.yagibdah.de> <877du2g7jj.fsf@gnus.org> Date: Thu, 13 Aug 2020 16:46:14 -0500 In-Reply-To: (Stefan Kangas's message of "Thu, 13 Aug 2020 12:50:20 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: 17021 Cc: lee , Lars Ingebrigtsen , 17021@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) I've looked at the patch, but haven't tried to apply it to the current hi-lock. There are two things that need to be addressed before I would be happy with it landing. First, this patch should not include the code for highlighting global variables, function-like text, and constants. (Perhaps this code was included by accident.) Those situations are best handled by the font-lock modes for specific languages. Second, I don't feel comfortable reading a pattern file path from within the file being visited. Instead, some kind of identifier could be read from the file, such as xyz-report-patterns. That identifier would then be used to locate patterns from a file in some default location, such as ~/.emacs.d/hi-lock-patterns, or it could be used to construct a file name (but not a path) that would be expected in some directory, such as ~/.emacs.d/hi-lock-patterns/. David Koppelman From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 16 13:49:53 2020 Received: (at 17021) by debbugs.gnu.org; 16 Aug 2020 17:49:53 +0000 Received: from localhost ([127.0.0.1]:58417 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k7Mn3-0007O8-GX for submit@debbugs.gnu.org; Sun, 16 Aug 2020 13:49:53 -0400 Received: from mo4-p00-ob.smtp.rzone.de ([85.215.255.22]:27368) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k7Mn1-0007Ny-91 for 17021@debbugs.gnu.org; Sun, 16 Aug 2020 13:49:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1597600189; s=strato-dkim-0002; d=adminart.net; h=References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=i0uCVTP/HbV80cLxy101mSfR0q9WUqZljVmbaTYbPBU=; b=SBWeGRIpgmLFeYSa388r+aaPVWaEciP9B4I05GId+dy45RcuF0vV51dv1JvYb3bYeb H5tBEU05EofnPlnIragTENrK2uuUMyk2wlbFjIJ3xRGf4qgHrCpmoEqSghm69HvU/8/b L+tuCFIIzOOCtXYvgGap9gMfn/gqVzYgY7EK9XrqocRajBCnCDDcMKKZ1UTFSMnh79c+ EnzIaC4KM0l9IBljF6SIC7Qw/lGBOc2BxjdHUR/oRcfmMeOZKKjxW1H2ACYXgcICPBR2 9MbxC57g6V3RW5ueABKm2+kgR0rX07lNTx0RqU1HEPFnMiOMobFBawZo8pSD0lQ1qGNF icvg== X-RZG-AUTH: ":JHskdESlcvGJlcww5P8kEdDfB60eDdbwg2z1BLI60U5wCzf/pgzSaLAuAikn9dDl" X-RZG-CLASS-ID: mo00 Received: from toy.adminart.net by smtp.strato.de (RZmta 46.10.5 DYNA|AUTH) with ESMTPSA id e08936w7GHncaF2 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sun, 16 Aug 2020 19:49:38 +0200 (CEST) Message-ID: Subject: Re: bug#17021: 24.3.50; extension to hi-lock.el From: hw To: 17021@debbugs.gnu.org Date: Sun, 16 Aug 2020 19:49:38 +0200 In-Reply-To: References: <87mwgp1mq4.fsf@yun.yagibdah.de> <877du2g7jj.fsf@gnus.org> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.4 (3.36.4-1.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 17021 Cc: Lars Ingebrigtsen , koppel@ece.lsu.edu, stefankangas@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On Thu, 2020-08-13 at 16:46 -0500, David Koppelman wrote: > I've looked at the patch, but haven't tried to apply it to the current > hi-lock. There are two things that need to be addressed before I would > be happy with it landing. > > First, this patch should not include the code for highlighting global > variables, function-like text, and constants. (Perhaps this code was > included by accident.) Those situations are best handled by the > font-lock modes for specific languages. > > Second, I don't feel comfortable reading a pattern file path from > within the file being visited. Instead, some kind of identifier could > be read from the file, such as xyz-report-patterns. That identifier > would then be used to locate patterns from a file in some default > location, such as ~/.emacs.d/hi-lock-patterns, or it could be used to > construct a file name (but not a path) that would be expected in some > directory, such as ~/.emacs.d/hi-lock-patterns/. > > David Koppelman It's been a long time that I've been using this extension. Using a default location may be a nice option, and I definitely wouldn't want to enforce it and wouldn't suggest it, either: When you have a (source) file or a number of (source) files in a directory (structure) highlighting patterns should be applied to, you probably want to keep the pattern file(s) together with the source file(s) --- or at least within the same directory structure. If you somehow distribute the source files and/or have them under version control, you are facing the problem of how to distribute the pattern files along with the source files when you have a bunch of unrelated pattern files together with relevant pattern files all in the same default location (i. e. some directory somewhere else). And if you use the same pattern files for multiple projects, you don't want the pattern files used by project A altered when you revert to a previous commit of project B or when you merge changes to project C just because all the pattern are at the same default location. Recipients of the files may not even have a default location required for this to work, especially when the recipients are using operating systems that would use entirely different paths for the pattern files. Files at a default location might be overwritten. All this could make it difficult to use a default location for pattern files and to maintain the necessary assignments between source files and pattern files. After all this time, the first thing that comes to mind for storing the patterns is now an SQL database ... From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 16 21:10:14 2020 Received: (at 17021) by debbugs.gnu.org; 17 Aug 2020 01:10:14 +0000 Received: from localhost ([127.0.0.1]:58725 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k7TfC-00083k-LH for submit@debbugs.gnu.org; Sun, 16 Aug 2020 21:10:14 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:50869) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1k7TfA-00083U-Sq for 17021@debbugs.gnu.org; Sun, 16 Aug 2020 21:10:13 -0400 X-Originating-IP: 91.129.102.47 Received: from mail.gandi.net (m91-129-102-47.cust.tele2.ee [91.129.102.47]) (Authenticated sender: juri@linkov.net) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 273BB20005; Mon, 17 Aug 2020 01:10:02 +0000 (UTC) From: Juri Linkov To: hw Subject: Re: bug#17021: 24.3.50; extension to hi-lock.el Organization: LINKOV.NET References: <87mwgp1mq4.fsf@yun.yagibdah.de> <877du2g7jj.fsf@gnus.org> Date: Mon, 17 Aug 2020 03:32:08 +0300 In-Reply-To: (hw@adminart.net's message of "Sun, 16 Aug 2020 19:49:38 +0200") Message-ID: <87d03q2juf.fsf@mail.linkov.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 17021 Cc: Lars Ingebrigtsen , 17021@debbugs.gnu.org, koppel@ece.lsu.edu, stefankangas@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) > When you have a (source) file or a number of (source) files in a directory > (structure) highlighting patterns should be applied to, you probably want > to keep the pattern file(s) together with the source file(s) --- or at > least within the same directory structure. If you somehow distribute the > source files and/or have them under version control, you are facing the > problem of how to distribute the pattern files along with the source files > when you have a bunch of unrelated pattern files together with relevant > pattern files all in the same default location (i. e. some directory > somewhere else). And if you use the same pattern files for multiple > projects, you don't want the pattern files used by project A altered when > you revert to a previous commit of project B or when you merge changes to > project C just because all the pattern are at the same default location. All these problems were already solved long ago with the help of Directory Local Variables. Just put such lines to .dir-locals.el in the root of your project: ((emacs-lisp-mode . ((hi-lock-file-patterns . ((("^;;; .*" (0 (quote hi-black-hb) t))) (("make-variable-buffer-\\(local\\)" (0 font-lock-keyword-face)(1 'italic append)))))))) From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 14 11:06:22 2020 Received: (at control) by debbugs.gnu.org; 14 Sep 2020 15:06:23 +0000 Received: from localhost ([127.0.0.1]:55844 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kHq3i-0002Sd-Lr for submit@debbugs.gnu.org; Mon, 14 Sep 2020 11:06:22 -0400 Received: from quimby.gnus.org ([95.216.78.240]:60520) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kHq3h-0002SO-2q for control@debbugs.gnu.org; Mon, 14 Sep 2020 11:06:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=T9bKILaKGjkHWV9sfYXwEx49ZAEjr6DZu7ApPBTxzSM=; b=tA5r2GaK8Xqk+yBFl//DdqUwdz pBwtalM9xR6HRWASvTiS38rICMmzvpj0swV9lxdzJK/nGYmZIp1E12/VC3jUPmDWhTLxsgmntn06R fGprMK12oQHyuvEk1VHdJeE4vyo8uNqrSUG5wNQAmTD0/WNIEpPlHnzIz2IoDhcX26J0=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kHq3Z-0002r2-As for control@debbugs.gnu.org; Mon, 14 Sep 2020 17:06:15 +0200 Date: Mon, 14 Sep 2020 17:06:12 +0200 Message-Id: <878sdc75zv.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #17021 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 17021 - moreinfo quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 17021 - moreinfo quit From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 14 11:08:06 2020 Received: (at 17021) by debbugs.gnu.org; 14 Sep 2020 15:08:06 +0000 Received: from localhost ([127.0.0.1]:55856 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kHq5O-0002WG-Be for submit@debbugs.gnu.org; Mon, 14 Sep 2020 11:08:06 -0400 Received: from quimby.gnus.org ([95.216.78.240]:60558) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kHq5M-0002VM-V7 for 17021@debbugs.gnu.org; Mon, 14 Sep 2020 11:08:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Fd4DrIjAOnzICnCt5uCkHrN8Cg5C1acAJiTzMTQCC/A=; b=c+6/0JfRrmC+bByF+6d+rSqZmo agVkRf6940iCccJlAaFBFQAMpry+3x7GOtOwUIZyPayqXbdsY9u1LyFjcG7f+KN15EPT2lMt+ldwa kCRTHLFTgcVe4U7cnCZ++GcsKPjXdzRBAnw/TsLfixHwE9CRunYHhKtIOV9VZtb1oIJw=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kHq5D-0002rb-HF; Mon, 14 Sep 2020 17:07:58 +0200 From: Lars Ingebrigtsen To: Juri Linkov Subject: Re: bug#17021: 24.3.50; extension to hi-lock.el References: <87mwgp1mq4.fsf@yun.yagibdah.de> <877du2g7jj.fsf@gnus.org> <87d03q2juf.fsf@mail.linkov.net> X-Now-Playing: Drew Daniel, John Wiese's _Continuous Hole_: "Cosmic Joke" Date: Mon, 14 Sep 2020 17:07:53 +0200 In-Reply-To: <87d03q2juf.fsf@mail.linkov.net> (Juri Linkov's message of "Mon, 17 Aug 2020 03:32:08 +0300") Message-ID: <874ko075x2.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Juri Linkov writes: > All these problems were already solved long ago with the help of > Directory Local Variables. Just put such lines to .dir-locals.el > in the root of your project: Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 17021 Cc: hw , koppel@ece.lsu.edu, 17021@debbugs.gnu.org, stefankangas@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Juri Linkov writes: > All these problems were already solved long ago with the help of > Directory Local Variables. Just put such lines to .dir-locals.el > in the root of your project: It sounded like there was limited enthusiasm for this extension to hi-lock.el, so I'm closing this bug report. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From debbugs-submit-bounces@debbugs.gnu.org Mon Sep 14 11:08:12 2020 Received: (at control) by debbugs.gnu.org; 14 Sep 2020 15:08:12 +0000 Received: from localhost ([127.0.0.1]:55859 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kHq5T-0002Wb-Ny for submit@debbugs.gnu.org; Mon, 14 Sep 2020 11:08:12 -0400 Received: from quimby.gnus.org ([95.216.78.240]:60576) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kHq5S-0002W8-22 for control@debbugs.gnu.org; Mon, 14 Sep 2020 11:08:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=fSqEJeO2Plx8cflieF3Zhxn/UqVVi56JNl6wOFgTGS0=; b=Q07ipYzIG+aTL5sLgXUdxpc3YE 6BeQRiRFrePk/SJcqL9VvoSDfFqJGNbokGz7IDhwSvEDAAjVYP7LIG4J+WMm9zVStN8oA5QNRrS8Z h5+OoxtH9t18oSaFsmf6HDwsgQDwE2tOQP/H4QygQjP2gZhIAP4RGIVMm2uXu6QSe/lU=; Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo) by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kHq5K-0002rn-9F for control@debbugs.gnu.org; Mon, 14 Sep 2020 17:08:04 +0200 Date: Mon, 14 Sep 2020 17:08:00 +0200 Message-Id: <87363k75wv.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #17021 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: close 17021 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) close 17021 quit From unknown Mon Aug 18 20:14:50 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 13 Oct 2020 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator