[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 251/299: Color TeX Help buffer.
From: |
Stefan Monnier |
Subject: |
[elpa] 251/299: Color TeX Help buffer. |
Date: |
Sun, 02 Nov 2014 03:11:47 +0000 |
monnier pushed a commit to branch externals/auctex
in repository elpa.
commit 87d277dc2b6b3c1e74b0016535270561851fc563
Author: Mosè Giordano <address@hidden>
Date: Mon Jun 2 11:45:30 2014 +0200
Color TeX Help buffer.
---
ChangeLog | 16 +++++++
tex-buf.el | 130 +++++++++++++++++++++++++++++++++++++++++------------------
2 files changed, 106 insertions(+), 40 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 521819d..e8a16bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2014-06-02 Mos� Giordano <address@hidden>
+
+ * tex-buf.el (TeX-error--find-display-help): Use new fourth
+ argument of `TeX-help-error'.
+ (TeX-warning): Rename mandatory argument to `warning'. Do not add
+ leading "** " to warning string.
+ (TeX-warning--find-display-help): Use new fourth argument of
+ `TeX-help-error'.
+ (TeX-error-description-faces): New group.
+ (TeX-error-description-error): New face.
+ (TeX-error-description-warning): Ditto.
+ (TeX-error-description-tex-said): Ditto.
+ (TeX-error-description-help): Ditto.
+ (TeX-help-error): Add new `type' argument. Color help messages
+ using the new faces.
+
2014-05-27 Mos� Giordano <address@hidden>
* tex.el (TeX-mode-specific-command-menu-entries): Add
diff --git a/tex-buf.el b/tex-buf.el
index 7e016da..614f156 100644
--- a/tex-buf.el
+++ b/tex-buf.el
@@ -1778,21 +1778,19 @@ information in `TeX-error-list' instead of displaying
the error."
(goto-char TeX-error-point)
(TeX-pop-to-buffer error-file-buffer nil t))
(TeX-display-help
- (TeX-help-error error context runbuf))
+ (TeX-help-error error context runbuf 'error))
(t
(message (concat "! " error))))))
-(defun TeX-warning (string &optional store)
- "Display a warning for STRING.
+(defun TeX-warning (warning &optional store)
+ "Display a warning for WARNING.
If optional argument STORE is non-nil, store the warning
information in `TeX-error-list' instead of displaying the
warning."
- (let* ((error (concat "** " string))
-
- ;; bad-box is nil if this is a "LaTeX Warning"
- (bad-box (string-match "\\\\[vh]box.*[0-9]*--[0-9]*" string))
+ (let* (;; bad-box is nil if this is a "LaTeX Warning"
+ (bad-box (string-match "\\\\[vh]box.*[0-9]*--[0-9]*" warning))
;; line-string: match 1 is beginning line, match 2 is end line
(line-string (if bad-box " \\([0-9]*\\)--\\([0-9]*\\)"
"on input line \\([0-9]*\\)\\."))
@@ -1837,11 +1835,11 @@ warning."
(if store
;; Store the warning information.
(add-to-list 'TeX-error-list
- (list 'warning file line error offset context
+ (list 'warning file line warning offset context
string line-end bad-box) t)
;; Find the warning point and display the help.
(TeX-warning--find-display-help
- file line error offset context string line-end bad-box))))
+ file line warning offset context string line-end bad-box))))
(defun TeX-warning--find-display-help (file line error offset context
string line-end bad-box)
@@ -1881,14 +1879,58 @@ warning."
(TeX-pop-to-buffer error-file-buffer nil t))
(TeX-display-help
(TeX-help-error error (if bad-box context (concat "\n" context))
- runbuf))
+ runbuf 'warning))
(t
(message (concat "! " error))))))
;;; - Help
-(defun TeX-help-error (error output runbuffer)
- "Print ERROR in context OUTPUT from RUNBUFFER in another window."
+(defgroup TeX-error-description-faces nil
+ "Faces used in error descriptions."
+ :prefix "TeX-error-description-"
+ :group 'AUCTeX)
+
+(defface TeX-error-description-error
+ ;; This is the same as `error' face in latest GNU Emacs versions.
+ '((default :weight bold)
+ (((class color) (min-colors 88) (background light)) :foreground "Red1")
+ (((class color) (min-colors 88) (background dark)) :foreground "Pink")
+ (((class color) (min-colors 16) (background light)) :foreground "Red1")
+ (((class color) (min-colors 16) (background dark)) :foreground "Pink")
+ (((class color) (min-colors 8)) :foreground "red")
+ (t :inverse-video t))
+ "Face for \"Error\" string in error descriptions.")
+
+(defface TeX-error-description-warning
+ ;; This is the same as `warning' face in latest GNU Emacs versions.
+ '((default :weight bold)
+ (((class color) (min-colors 16)) :foreground "DarkOrange")
+ (((class color)) :foreground "yellow"))
+ "Face for \"Warning\" string in error descriptions.")
+
+(defface TeX-error-description-tex-said
+ ;; This is the same as `font-lock-function-name-face' face in latest GNU
Emacs
+ ;; versions.
+ '((((class color) (min-colors 88) (background light))
+ :foreground "Blue1")
+ (((class color) (min-colors 88) (background dark))
+ :foreground "LightSkyBlue")
+ (((class color) (min-colors 16) (background light))
+ :foreground "Blue")
+ (((class color) (min-colors 16) (background dark))
+ :foreground "LightSkyBlue")
+ (((class color) (min-colors 8))
+ :foreground "blue" :weight bold)
+ (t :inverse-video t :weight bold))
+ "Face for \"TeX said\" string in error descriptions.")
+
+(defface TeX-error-description-help
+ '((t :inherit TeX-error-description-tex-said))
+ "Face for \"Help\" string in error descriptions.")
+
+(defun TeX-help-error (error output runbuffer type)
+ "Print ERROR in context OUTPUT from RUNBUFFER in another window.
+TYPE is a symbol specifing if ERROR is a real error or a warning."
(let ((old-buffer (current-buffer))
(log-file (with-current-buffer runbuffer
@@ -1905,34 +1947,42 @@ warning."
(TeX-pop-to-buffer (get-buffer-create "*TeX Help*") nil t)
(let ((inhibit-read-only t))
(erase-buffer)
- (insert "ERROR: " error
- "\n\n--- TeX said ---"
- output
- "\n--- HELP ---\n"
- (let ((help (cdr (nth TeX-error-pointer
- TeX-error-description-list))))
- (save-excursion
- (if (and (string= help "No help available")
- (let* ((log-buffer (find-buffer-visiting log-file)))
- (if log-buffer
- (progn
- (set-buffer log-buffer)
- (revert-buffer t t))
- (setq log-buffer
- (find-file-noselect log-file))
- (set-buffer log-buffer))
- (auto-save-mode nil)
- (setq buffer-read-only t)
- (goto-char (point-min))
- (search-forward error nil t 1))
- (re-search-forward "^l\\." nil t)
- (re-search-forward "^ [^\n]+$" nil t))
- (let ((start (1+ (point))))
- (forward-char 1)
- (re-search-forward "^$")
- (concat "From the .log file...\n\n"
- (buffer-substring start (point))))
- help)))))
+ (insert
+ (cond
+ ((equal type 'error)
+ (propertize "ERROR" 'font-lock-face 'TeX-error-description-error))
+ ((equal type 'warning)
+ (propertize "WARNING" 'font-lock-face 'TeX-error-description-warning)))
+ ": " error
+ (propertize "\n\n--- TeX said ---" 'font-lock-face
+ 'TeX-error-description-tex-said)
+ output
+ (propertize "\n--- HELP ---\n" 'font-lock-face
+ 'TeX-error-description-help)
+ (let ((help (cdr (nth TeX-error-pointer
+ TeX-error-description-list))))
+ (save-excursion
+ (if (and (string= help "No help available")
+ (let* ((log-buffer (find-buffer-visiting log-file)))
+ (if log-buffer
+ (progn
+ (set-buffer log-buffer)
+ (revert-buffer t t))
+ (setq log-buffer
+ (find-file-noselect log-file))
+ (set-buffer log-buffer))
+ (auto-save-mode nil)
+ (setq buffer-read-only t)
+ (goto-char (point-min))
+ (search-forward error nil t 1))
+ (re-search-forward "^l\\." nil t)
+ (re-search-forward "^ [^\n]+$" nil t))
+ (let ((start (1+ (point))))
+ (forward-char 1)
+ (re-search-forward "^$")
+ (concat "From the .log file...\n\n"
+ (buffer-substring start (point))))
+ help)))))
(goto-char (point-min))
(TeX-special-mode)
(TeX-pop-to-buffer old-buffer nil t)))
- [elpa] 234/299: Ask for TeX-master if unknown., (continued)
- [elpa] 234/299: Ask for TeX-master if unknown., Stefan Monnier, 2014/11/01
- [elpa] 244/299: Fix typo in listings.el., Stefan Monnier, 2014/11/01
- [elpa] 237/299: Update biblatex support in style file., Stefan Monnier, 2014/11/01
- [elpa] 250/299: Add TeX-previous-error to Command menu., Stefan Monnier, 2014/11/01
- [elpa] 247/299: Convert font-latex-fontify-sectioning to float when used as a number., Stefan Monnier, 2014/11/01
- [elpa] 252/299: Fix possible infinite loop in TeX-parse-all-errors., Stefan Monnier, 2014/11/01
- [elpa] 249/299: Backport from ELPA repository., Stefan Monnier, 2014/11/01
- [elpa] 245/299: Use TeX-esc as completion separator for units in siunitx.el., Stefan Monnier, 2014/11/01
- [elpa] 253/299: Cater for bad boxes in error descriptions., Stefan Monnier, 2014/11/01
- [elpa] 257/299: Fix TeX-find-display-help., Stefan Monnier, 2014/11/01
- [elpa] 251/299: Color TeX Help buffer.,
Stefan Monnier <=
- [elpa] 255/299: Better check for mgs., Stefan Monnier, 2014/11/01
- [elpa] 258/299: Prettify file names in error overview., Stefan Monnier, 2014/11/01
- [elpa] 259/299: Update Future Development section in manual., Stefan Monnier, 2014/11/01
- [elpa] 254/299: Simplify error finding and help displaying functions., Stefan Monnier, 2014/11/01
- [elpa] 263/299: Fix remaining XEmacs compilation issues., Stefan Monnier, 2014/11/01
- [elpa] 260/299: Improve selection of the forward/inverse search method., Stefan Monnier, 2014/11/01
- [elpa] 262/299: Fix some XEmacs compilation issues., Stefan Monnier, 2014/11/01
- [elpa] 264/299: Fix some runtime issues in XEmacs., Stefan Monnier, 2014/11/01
- [elpa] 248/299: Implement TeX-previous-error., Stefan Monnier, 2014/11/01
- [elpa] 267/299: Remove .cvsignore and tests from the release tarball., Stefan Monnier, 2014/11/01