mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-02 08:22:22 +00:00
Introduce 'compilation-annotation' text property
It is meant to mark parts of compilation buffers which do not correspond to process output (bug#59888). * lisp/progmodes/compile.el (compilation-insert-annotation): New function. (compilation-start, compilation-handle-exit): Use it. (compilation--ensure-parse) Rely on 'compilation-annotation' property instead of 'compilation-header-end'.
This commit is contained in:
parent
b5c1303253
commit
b699c38028
@ -1706,7 +1706,7 @@ to `compilation-error-regexp-alist' if RULES is nil."
|
||||
(set-marker (make-marker)
|
||||
(save-excursion
|
||||
(goto-char (point-min))
|
||||
(text-property-search-forward 'compilation-header-end)
|
||||
(text-property-search-forward 'compilation-annotation)
|
||||
;; If we have no end marker, this will be
|
||||
;; `point-min' still.
|
||||
(point)))))
|
||||
@ -1854,6 +1854,14 @@ If nil, don't hide anything."
|
||||
;; buffers when it changes from nil to non-nil or vice-versa.
|
||||
(unless compilation-in-progress (force-mode-line-update t)))
|
||||
|
||||
(defun compilation-insert-annotation (&rest args)
|
||||
"Insert ARGS at point, adding the `compilation-annotation' text property.
|
||||
This property is used to distinguish output of the compilation
|
||||
process from additional information inserted by Emacs."
|
||||
(let ((start (point)))
|
||||
(apply #'insert args)
|
||||
(put-text-property start (point) 'compilation-annotation t)))
|
||||
|
||||
;;;###autoload
|
||||
(defun compilation-start (command &optional mode name-function highlight-regexp
|
||||
continue)
|
||||
@ -1975,17 +1983,16 @@ Returns the compilation buffer created."
|
||||
(setq-local compilation-auto-jump-to-next t))
|
||||
(when (zerop (buffer-size))
|
||||
;; Output a mode setter, for saving and later reloading this buffer.
|
||||
(insert "-*- mode: " name-of-mode
|
||||
"; default-directory: "
|
||||
(prin1-to-string (abbreviate-file-name default-directory))
|
||||
" -*-\n"))
|
||||
(insert (format "%s started at %s\n\n"
|
||||
mode-name
|
||||
(substring (current-time-string) 0 19))
|
||||
command "\n")
|
||||
;; Mark the end of the header so that we don't interpret
|
||||
;; anything in it as an error.
|
||||
(put-text-property (1- (point)) (point) 'compilation-header-end t)
|
||||
(compilation-insert-annotation
|
||||
"-*- mode: " name-of-mode
|
||||
"; default-directory: "
|
||||
(prin1-to-string (abbreviate-file-name default-directory))
|
||||
" -*-\n"))
|
||||
(compilation-insert-annotation
|
||||
(format "%s started at %s\n\n"
|
||||
mode-name
|
||||
(substring (current-time-string) 0 19))
|
||||
command "\n")
|
||||
(setq thisdir default-directory))
|
||||
(set-buffer-modified-p nil))
|
||||
;; Pop up the compilation buffer.
|
||||
@ -2467,13 +2474,13 @@ commands of Compilation major mode are available. See
|
||||
(cur-buffer (current-buffer)))
|
||||
;; Record where we put the message, so we can ignore it later on.
|
||||
(goto-char omax)
|
||||
(insert ?\n mode-name " " (car status))
|
||||
(compilation-insert-annotation ?\n mode-name " " (car status))
|
||||
(if (and (numberp compilation-window-height)
|
||||
(zerop compilation-window-height))
|
||||
(message "%s" (cdr status)))
|
||||
(if (bolp)
|
||||
(forward-char -1))
|
||||
(insert " at " (substring (current-time-string) 0 19))
|
||||
(compilation-insert-annotation " at " (substring (current-time-string) 0 19))
|
||||
(goto-char (point-max))
|
||||
;; Prevent that message from being recognized as a compilation error.
|
||||
(add-text-properties omax (point)
|
||||
|
Loading…
Reference in New Issue
Block a user