emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/helm abc3c89d25 2/3: Fix cl--print-table advice for emacs-


From: ELPA Syncer
Subject: [nongnu] elpa/helm abc3c89d25 2/3: Fix cl--print-table advice for emacs-28
Date: Sat, 23 Apr 2022 12:58:33 -0400 (EDT)

branch: elpa/helm
commit abc3c89d256119902fd1583eefda5ab1a92a9a01
Author: Thierry Volpiatto <thievol@posteo.net>
Commit: Thierry Volpiatto <thievol@posteo.net>

    Fix cl--print-table advice for emacs-28
---
 helm-lib.el    | 16 ++++++++++------
 helm-source.el | 10 +++++++++-
 2 files changed, 19 insertions(+), 7 deletions(-)

diff --git a/helm-lib.el b/helm-lib.el
index e3e9211d2a..01b652c4a1 100644
--- a/helm-lib.el
+++ b/helm-lib.el
@@ -42,7 +42,8 @@
 (declare-function helm-log-run-hook "helm-core.el")
 (declare-function helm-marked-candidates "helm-core.el")
 (declare-function helm-set-case-fold-search "helm-core.el")
-(declare-function helm-source--cl--print-table "helm-source.el")
+(declare-function helm-source--cl--print-table-27 "helm-source.el")
+(declare-function helm-source--cl--print-table-28 "helm-source.el")
 (declare-function helm-update "helm-core.el")
 (declare-function org-content "org.el")
 (declare-function org-mark-ring-goto "org.el")
@@ -1215,11 +1216,14 @@ Example:
 
 (defun helm-describe-class (class)
   "Display documentation of Eieio CLASS, a symbol or a string."
-  (advice-add 'cl--print-table :override #'helm-source--cl--print-table 
'((depth . 100)))
-  (unwind-protect
-       (let ((helm-describe-function-function 'describe-function))
-         (helm-describe-function class))
-    (advice-remove 'cl--print-table #'helm-source--cl--print-table)))
+  (let ((fun (if (eq emacs-major-version 28)
+                 #'helm-source--cl--print-table-28
+               #'helm-source--cl--print-table-27)))
+    (advice-add 'cl--print-table :override fun '((depth . 100)))
+    (unwind-protect
+         (let ((helm-describe-function-function 'describe-function))
+           (helm-describe-function class))
+      (advice-remove 'cl--print-table fun))))
 
 (defun helm-describe-function (func)
   "Display documentation of FUNC, a symbol or string."
diff --git a/helm-source.el b/helm-source.el
index d916f256e8..d528cb44d4 100644
--- a/helm-source.el
+++ b/helm-source.el
@@ -44,7 +44,15 @@
 ;;  Make Classes's docstrings more readable by removing al the
 ;;  unnecessary crap.
 
-(defun helm-source--cl--print-table (_header rows)
+(defun helm-source--cl--print-table-27 (_header rows)
+  "Advice for `cl--print-table' to make readable class slots docstrings."
+  (let ((format "%s\n\n  Initform=%s\n\n%s"))
+    (dolist (row rows)
+      (setcar row (propertize (car row) 'face 'bold))
+      (setcdr row (nthcdr 1 (cdr row)))
+      (insert "\n* " (apply #'format format row) "\n"))))
+
+(defun helm-source--cl--print-table-28 (_header rows &optional _unused)
   "Advice for `cl--print-table' to make readable class slots docstrings."
   (let ((format "%s\n\n  Initform=%s\n\n%s"))
     (dolist (row rows)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]