From: Tino Calancha <tino.calancha@gmail.com>
To: 25823@debbugs.gnu.org
Cc: stefan monnier <monnier@iro.umontreal.ca>, tino.calancha@gmail.com
Subject: bug#25823: 26.0.50; describe-function: Don't require cl-lib at runtime
Date: Tue, 21 Feb 2017 12:39:29 +0900 [thread overview]
Message-ID: <87mvdgdxfy.fsf@calancha-pc> (raw)
X-Debbugs-CC: Stefan Monnier <monnier@iro.umontreal.ca>
emacs -Q:
I)
(progn
(describe-function 'dolist)
(delete-other-windows)
(featurep 'cl-lib))
=> t
The patch below prevent to load cl-lib in this case.
II) After the patch, we still load extra libs in _interactive_ calls.
;; (Applied patch below)
(progn
(describe-function 'mapc)
(delete-other-windows)
(featurep 'cl-lib))
=> nil
;; Now interactively.
M-x describe-function RET
mapc RET
M-: (featurep 'cl-lib) RET
=> t
;; Becase it loads map.el which depends on seq.el, and
;; this one depends on cl-lib.
;;
;; IMO, an input "mapc" should not load map.el,
;; because "mapc" doesn't match a prefix "map-".
;; Does it have sense for you?
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
From ff83f7b3d8f48eeef037f6e7606ba3c3be3fb3c2 Mon Sep 17 00:00:00 2001
From: Tino Calancha <tino.calancha@gmail.com>
Date: Tue, 21 Feb 2017 12:20:35 +0900
Subject: [PATCH] help-mode: Don't require cl-lib at run-time
* lisp/help-mode.el: Require cl-lib at compile time (Bug#25823).
(help--find-symbol): New defun.
(help-make-xrefs): Use it instead of cl-some.
* lisp/help-fns.el: Require cl-lib at compile time.
(describe-symbol): Use help--find-symbol.
---
lisp/help-fns.el | 8 +++-----
lisp/help-mode.el | 10 +++++++---
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 742c66919a..479d109ce9 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -32,7 +32,7 @@
;;; Code:
-(require 'cl-lib)
+(eval-when-compile (require 'cl-lib))
(require 'help-mode)
(require 'radix-tree)
@@ -1089,8 +1089,7 @@ describe-symbol
current buffer and the selected frame, respectively."
(interactive
(let* ((v-or-f (symbol-at-point))
- (found (cl-some (lambda (x) (funcall (nth 1 x) v-or-f))
- describe-symbol-backends))
+ (found (help--find-symbol v-or-f))
(v-or-f (if found v-or-f (function-called-at-point)))
(found (or found v-or-f))
(enable-recursive-minibuffers t)
@@ -1100,8 +1099,7 @@ describe-symbol
"Describe symbol: ")
obarray
(lambda (vv)
- (cl-some (lambda (x) (funcall (nth 1 x) vv))
- describe-symbol-backends))
+ (help--find-symbol vv))
t nil nil
(if found (symbol-name v-or-f)))))
(list (if (equal val "")
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index 3fb793e7aa..0196577206 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -30,7 +30,7 @@
;;; Code:
(require 'button)
-(require 'cl-lib)
+(eval-when-compile (require 'cl-lib))
(eval-when-compile (require 'easymenu))
(defvar help-mode-map
@@ -400,6 +400,11 @@ describe-symbol-backends
(get symbol 'variable-documentation)))
,#'describe-variable)))
+(defun help--find-symbol (sym)
+ (catch 'found
+ (cl-loop for seq the elements of describe-symbol-backends
+ do (when (funcall (nth 1 seq) sym)
+ (throw 'found t)))))
;;;###autoload
(defun help-make-xrefs (&optional buffer)
"Parse and hyperlink documentation cross-references in the given BUFFER.
@@ -502,8 +507,7 @@ help-make-xrefs
;; (pop-to-buffer (car location))
;; (goto-char (cdr location))))
(help-xref-button 8 'help-function-def sym))
- ((cl-some (lambda (x) (funcall (nth 1 x) sym))
- describe-symbol-backends)
+ ((help--find-symbol sym)
(help-xref-button 8 'help-symbol sym)))))))
;; An obvious case of a key substitution:
(save-excursion
--
2.11.0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
In GNU Emacs 26.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.7)
of 2017-02-21
Repository revision: 96cea19842b577eb4f2e057d702aea54d736233e
next reply other threads:[~2017-02-21 3:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-21 3:39 Tino Calancha [this message]
2017-02-21 13:18 ` bug#25823: 26.0.50; describe-function: Don't require cl-lib at runtime Stefan Monnier
2017-02-22 3:23 ` Tino Calancha
2017-05-25 12:15 ` Tino Calancha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mvdgdxfy.fsf@calancha-pc \
--to=tino.calancha@gmail.com \
--cc=25823@debbugs.gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).