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

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

[nongnu] elpa/helm dc0c082a45 2/2: Better fix for cl--print-table advice


From: ELPA Syncer
Subject: [nongnu] elpa/helm dc0c082a45 2/2: Better fix for cl--print-table advice compatibility
Date: Sun, 24 Apr 2022 00:58:43 -0400 (EDT)

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

    Better fix for cl--print-table advice compatibility
---
 helm-lib.el    | 16 ++++++----------
 helm-source.el | 23 ++++++++---------------
 2 files changed, 14 insertions(+), 25 deletions(-)

diff --git a/helm-lib.el b/helm-lib.el
index 01b652c4a1..e3e9211d2a 100644
--- a/helm-lib.el
+++ b/helm-lib.el
@@ -42,8 +42,7 @@
 (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-27 "helm-source.el")
-(declare-function helm-source--cl--print-table-28 "helm-source.el")
+(declare-function helm-source--cl--print-table "helm-source.el")
 (declare-function helm-update "helm-core.el")
 (declare-function org-content "org.el")
 (declare-function org-mark-ring-goto "org.el")
@@ -1216,14 +1215,11 @@ Example:
 
 (defun helm-describe-class (class)
   "Display documentation of Eieio CLASS, a symbol or a string."
-  (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))))
+  (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)))
 
 (defun helm-describe-function (func)
   "Display documentation of FUNC, a symbol or string."
diff --git a/helm-source.el b/helm-source.el
index d528cb44d4..0325598c99 100644
--- a/helm-source.el
+++ b/helm-source.el
@@ -44,22 +44,15 @@
 ;;  Make Classes's docstrings more readable by removing al the
 ;;  unnecessary crap.
 
-(defun helm-source--cl--print-table-27 (_header rows)
+(defun helm-source--cl--print-table (&rest args)
   "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)
-      (setcar row (propertize (car row) 'face 'bold))
-      (setcdr row (nthcdr 1 (cdr row)))
-      (insert "\n* " (apply #'format format row) "\n"))))
-
+  (cl-flet ((print-rows (rows)
+              (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")))))
+    (print-rows (cadr args))))
 
 (cl-defgeneric helm--setup-source (source)
   "Prepare slots and handle slot errors before creating a helm source.")



reply via email to

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