* bug#25823: 26.0.50; describe-function: Don't require cl-lib at runtime
@ 2017-02-21 3:39 Tino Calancha
2017-02-21 13:18 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: Tino Calancha @ 2017-02-21 3:39 UTC (permalink / raw)
To: 25823; +Cc: stefan monnier, tino.calancha
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
* bug#25823: 26.0.50; describe-function: Don't require cl-lib at runtime
2017-02-21 3:39 bug#25823: 26.0.50; describe-function: Don't require cl-lib at runtime Tino Calancha
@ 2017-02-21 13:18 ` Stefan Monnier
2017-02-22 3:23 ` Tino Calancha
2017-05-25 12:15 ` Tino Calancha
0 siblings, 2 replies; 4+ messages in thread
From: Stefan Monnier @ 2017-02-21 13:18 UTC (permalink / raw)
To: Tino Calancha; +Cc: 25823
> (progn
> (describe-function 'dolist)
> (delete-other-windows)
> (featurep 'cl-lib))
> => t
FWIW, cl-lib is a library that can be loaded at runtime just fine.
Moreover, it's likely that cl-lib will end up pre-loaded from loadup.el
at some point in the (somewhat distant) future.
So I don't think we should worry too much about the above result.
But don't take that to mean I don't like your patch.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#25823: 26.0.50; describe-function: Don't require cl-lib at runtime
2017-02-21 13:18 ` Stefan Monnier
@ 2017-02-22 3:23 ` Tino Calancha
2017-05-25 12:15 ` Tino Calancha
1 sibling, 0 replies; 4+ messages in thread
From: Tino Calancha @ 2017-02-22 3:23 UTC (permalink / raw)
To: Stefan Monnier; +Cc: Tino Calancha, 25823
On Tue, 21 Feb 2017, Stefan Monnier wrote:
>> (progn
>> (describe-function 'dolist)
>> (delete-other-windows)
>> (featurep 'cl-lib))
>> => t
>
> FWIW, cl-lib is a library that can be loaded at runtime just fine.
> Moreover, it's likely that cl-lib will end up pre-loaded from loadup.el
> at some point in the (somewhat distant) future.
I see, i guess prince Hamlet would ask this somehow differently:
"To load, or not to load cl-lib- that is the question".
But i lack of his talent for the lyrics... so i just sent a patch :-(
> So I don't think we should worry too much about the above result.
I often worry about things that most of the people even ignore they do
exist :-S
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#25823: 26.0.50; describe-function: Don't require cl-lib at runtime
2017-02-21 13:18 ` Stefan Monnier
2017-02-22 3:23 ` Tino Calancha
@ 2017-05-25 12:15 ` Tino Calancha
1 sibling, 0 replies; 4+ messages in thread
From: Tino Calancha @ 2017-05-25 12:15 UTC (permalink / raw)
To: 25823-done
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> (progn
>> (describe-function 'dolist)
>> (delete-other-windows)
>> (featurep 'cl-lib))
>> => t
>
> FWIW, cl-lib is a library that can be loaded at runtime just fine.
> Moreover, it's likely that cl-lib will end up pre-loaded from loadup.el
> at some point in the (somewhat distant) future.
>
> So I don't think we should worry too much about the above result.
OK, i will not worry about it.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-05-25 12:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-21 3:39 bug#25823: 26.0.50; describe-function: Don't require cl-lib at runtime Tino Calancha
2017-02-21 13:18 ` Stefan Monnier
2017-02-22 3:23 ` Tino Calancha
2017-05-25 12:15 ` Tino Calancha
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).