[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/inspector b10f60c20d 89/93: Fontification for each type
From: |
ELPA Syncer |
Subject: |
[elpa] externals/inspector b10f60c20d 89/93: Fontification for each type of object |
Date: |
Tue, 24 May 2022 18:58:02 -0400 (EDT) |
branch: externals/inspector
commit b10f60c20ddfa7ace6fd2747128c60779aeb0c3f
Author: Mariano Montone <marianomontone@gmail.com>
Commit: Mariano Montone <marianomontone@gmail.com>
Fontification for each type of object
---
inspector.el | 35 +++++++++++++++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)
diff --git a/inspector.el b/inspector.el
index 8eebd71177..5dbb51d11f 100644
--- a/inspector.el
+++ b/inspector.el
@@ -124,6 +124,11 @@
:type 'boolean
:group 'inspector)
+(defcustom inspector-use-font-lock-faces t
+ "Use font-lock faces in inspector, instead of button faces."
+ :type 'boolean
+ :group 'inspector)
+
(defcustom inspector-slice-size 100
"Size of sequence slices in inspector."
:type 'integer
@@ -169,6 +174,29 @@ END-COLUMN controls the truncation."
(or end-column inspector-end-column)
nil nil t))
+(cl-defgeneric inspector--face-for-object (object)
+ "Return face to use for OBJECT.")
+
+(cl-defmethod inspector--face-for-object (object)
+ "Use builtin face by default for non matching OBJECTs."
+ (ignore object)
+ 'inspector-button-face)
+
+(cl-defmethod inspector--face-for-object ((string string))
+ "Inspector face for STRING."
+ (ignore string)
+ font-lock-string-face)
+
+(cl-defmethod inspector--face-for-object ((symbol symbol))
+ "Inspector face for SYMBOLs."
+ (ignore symbol)
+ font-lock-constant-face)
+
+(cl-defmethod inspector--face-for-object ((integer integer))
+ "Inspector face for INTEGERs."
+ (ignore integer)
+ font-lock-constant-face))
+
(defun inspector--insert-inspect-button (object &optional label)
"Insert button for inspecting OBJECT.
If LABEL has a value, then it is used as button label.
@@ -176,6 +204,9 @@ Otherwise, button label is the printed representation of
OBJECT."
(insert-button (or (and label (inspector--princ-to-string label))
(inspector--print-truncated object))
:type 'inspector-button
+ 'face (if inspector-use-font-lock-faces
+ (inspector--face-for-object object)
+ inspector-button-face)
'action (lambda (_btn)
(inspector-inspect object t))
'follow-link t))
@@ -210,11 +241,11 @@ slice in buffer."
(setq buffer-read-only nil)))
'follow-link t))))))
+;;--------- Object inspectors ----------------------------------
+
(cl-defgeneric inspect-object (object)
"Render inspector buffer for OBJECT.")
-;;--------- Object inspectors ----------------------------------
-
(cl-defmethod inspect-object ((class (subclass eieio-default-superclass)))
"Render inspector buffer for EIEIO CLASS."
(inspector--insert-title (format "%s class" (eieio-class-name class)))
- [elpa] externals/inspector fdd7420b8d 43/93: More hash-table details, (continued)
- [elpa] externals/inspector fdd7420b8d 43/93: More hash-table details, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 2e23aeae84 48/93: Inspect finalizer type, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector cbb1d1cd2b 49/93: Some basic tests for elisp data types, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 51257fb9b5 55/93: tests: overlays, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 060da36d6f 58/93: Better quit behaviour, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 6c071c67b3 60/93: Housekeeping, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector e7f2f13ff4 75/93: Start writing ert tests, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector b1d60310da 73/93: Patch by Stefan Monnier, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 739890b5d6 70/93: Autoloads?, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 477e363962 82/93: tests: no more side-effects, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector b10f60c20d 89/93: Fontification for each type of object,
ELPA Syncer <=
- [elpa] externals/inspector 6fadd6df9f 93/93: Create LICENSE, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector d5d286c5de 10/93: inspect-last-sexp command, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 30d739e108 53/93: Slice arrays, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector a9e41424fa 66/93: Update README.md, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 4b193ba6d0 69/93: Don't add [more] button when not needed, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 2af90a4c82 83/93: tests: fixes, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 57105aef34 72/93: Update README.md, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 023ae9ca51 92/93: Use value face instead of button face, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector d88d248eef 19/93: Presentation improvements, ELPA Syncer, 2022/05/24
- [elpa] externals/inspector 57b46a3079 38/93: Bug fix, ELPA Syncer, 2022/05/24