diff options
| author | Michael Albinus | 2019-11-13 14:53:43 +0100 |
|---|---|---|
| committer | Michael Albinus | 2019-11-13 14:53:43 +0100 |
| commit | 3b88ab1a5035abccedcdb5d271d8a8cb7827b342 (patch) | |
| tree | 7af4d8d8be8995b13fa5d990498112bd4b4b6753 | |
| parent | d3438460ef2e41815b01632781bfc1e4697f70eb (diff) | |
| download | emacs-3b88ab1a5035abccedcdb5d271d8a8cb7827b342.tar.gz emacs-3b88ab1a5035abccedcdb5d271d8a8cb7827b342.zip | |
Some refinement in Tramp debug buffer.
* lisp/net/tramp.el (outline-regexp): Remove declaration.
(tramp-debug-font-lock-keywords): New defconst.
(tramp-get-debug-buffer): Use it.
| -rw-r--r-- | lisp/net/tramp.el | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index ba8b9aa5c4c..ab1b4d354f7 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -64,7 +64,6 @@ | |||
| 64 | (require 'cl-lib) | 64 | (require 'cl-lib) |
| 65 | (declare-function netrc-parse "netrc") | 65 | (declare-function netrc-parse "netrc") |
| 66 | (defvar auto-save-file-name-transforms) | 66 | (defvar auto-save-file-name-transforms) |
| 67 | (defvar outline-regexp) | ||
| 68 | 67 | ||
| 69 | ;;; User Customizable Internal Variables: | 68 | ;;; User Customizable Internal Variables: |
| 70 | 69 | ||
| @@ -1652,6 +1651,13 @@ version, the function does nothing." | |||
| 1652 | "[0-9]+:[0-9]+:[0-9]+\\.[0-9]+ [a-z0-9-]+ (\\([0-9]+\\)) #" | 1651 | "[0-9]+:[0-9]+:[0-9]+\\.[0-9]+ [a-z0-9-]+ (\\([0-9]+\\)) #" |
| 1653 | "Used for highlighting Tramp debug buffers in `outline-mode'.") | 1652 | "Used for highlighting Tramp debug buffers in `outline-mode'.") |
| 1654 | 1653 | ||
| 1654 | (defconst tramp-debug-font-lock-keywords | ||
| 1655 | '(list | ||
| 1656 | (concat "^\\(?:" tramp-debug-outline-regexp "\\).+") | ||
| 1657 | '(1 font-lock-warning-face t t) | ||
| 1658 | '(0 (outline-font-lock-face) keep t)) | ||
| 1659 | "Used for highlighting Tramp debug buffers in `outline-mode'.") | ||
| 1660 | |||
| 1655 | (defun tramp-debug-outline-level () | 1661 | (defun tramp-debug-outline-level () |
| 1656 | "Return the depth to which a statement is nested in the outline. | 1662 | "Return the depth to which a statement is nested in the outline. |
| 1657 | Point must be at the beginning of a header line. | 1663 | Point must be at the beginning of a header line. |
| @@ -1668,14 +1674,16 @@ The outline level is equal to the verbosity of the Tramp message." | |||
| 1668 | ;; Activate `outline-mode'. This runs `text-mode-hook' and | 1674 | ;; Activate `outline-mode'. This runs `text-mode-hook' and |
| 1669 | ;; `outline-mode-hook'. We must prevent that local processes | 1675 | ;; `outline-mode-hook'. We must prevent that local processes |
| 1670 | ;; die. Yes: I've seen `flyspell-mode', which starts "ispell". | 1676 | ;; die. Yes: I've seen `flyspell-mode', which starts "ispell". |
| 1671 | ;; Furthermore, `outline-regexp' must have the correct value | 1677 | ;; `(custom-declare-variable outline-minor-mode-prefix ...)' |
| 1672 | ;; already, because it is used by `font-lock-compile-keywords'. | 1678 | ;; raises on error in `(outline-mode)', we don't want to see it |
| 1679 | ;; in the traces. | ||
| 1673 | (let ((default-directory (tramp-compat-temporary-file-directory)) | 1680 | (let ((default-directory (tramp-compat-temporary-file-directory)) |
| 1674 | (outline-regexp tramp-debug-outline-regexp) | ||
| 1675 | signal-hook-function) | 1681 | signal-hook-function) |
| 1676 | (outline-mode)) | 1682 | (outline-mode)) |
| 1677 | (set (make-local-variable 'outline-regexp) tramp-debug-outline-regexp) | ||
| 1678 | (set (make-local-variable 'outline-level) 'tramp-debug-outline-level) | 1683 | (set (make-local-variable 'outline-level) 'tramp-debug-outline-level) |
| 1684 | (set (make-local-variable 'font-lock-keywords) | ||
| 1685 | `(t (eval ,tramp-debug-font-lock-keywords) | ||
| 1686 | ,(eval tramp-debug-font-lock-keywords))) | ||
| 1679 | ;; Do not edit the debug buffer. | 1687 | ;; Do not edit the debug buffer. |
| 1680 | (use-local-map special-mode-map)) | 1688 | (use-local-map special-mode-map)) |
| 1681 | (current-buffer))) | 1689 | (current-buffer))) |