GNU bug report logs - #25823
26.0.50; describe-function: Don't require cl-lib at runtime

Previous Next

Package: emacs;

Reported by: Tino Calancha <tino.calancha <at> gmail.com>

Date: Tue, 21 Feb 2017 03:40:02 UTC

Severity: wishlist

Tags: patch

Found in version 26.0.50

Done: Tino Calancha <tino.calancha <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25823 in the body.
You can then email your comments to 25823 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org:
bug#25823; Package emacs. (Tue, 21 Feb 2017 03:40:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tino Calancha <tino.calancha <at> gmail.com>:
New bug report received and forwarded. Copy sent to monnier <at> iro.umontreal.ca, bug-gnu-emacs <at> gnu.org. (Tue, 21 Feb 2017 03:40:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Cc: tino.calancha <at> gmail.com
Subject: 26.0.50; describe-function: Don't require cl-lib at runtime
Date: Tue, 21 Feb 2017 12:39:29 +0900
X-Debbugs-CC: Stefan Monnier <monnier <at> 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 <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25823; Package emacs. (Tue, 21 Feb 2017 13:19:02 GMT) Full text and rfc822 format available.

Message #8 received at 25823 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: 25823 <at> debbugs.gnu.org
Subject: Re: bug#25823: 26.0.50;
 describe-function: Don't require cl-lib at runtime
Date: Tue, 21 Feb 2017 08:18:45 -0500
> (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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#25823; Package emacs. (Wed, 22 Feb 2017 03:24:01 GMT) Full text and rfc822 format available.

Message #11 received at 25823 <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 25823 <at> debbugs.gnu.org, Tino Calancha <tino.calancha <at> gmail.com>
Subject: Re: bug#25823: 26.0.50; describe-function: Don't require cl-lib at
 runtime
Date: Wed, 22 Feb 2017 12:23:23 +0900 (JST)

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




Reply sent to Tino Calancha <tino.calancha <at> gmail.com>:
You have taken responsibility. (Thu, 25 May 2017 12:17:01 GMT) Full text and rfc822 format available.

Notification sent to Tino Calancha <tino.calancha <at> gmail.com>:
bug acknowledged by developer. (Thu, 25 May 2017 12:17:02 GMT) Full text and rfc822 format available.

Message #16 received at 25823-done <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: 25823-done <at> debbugs.gnu.org
Subject: Re: bug#25823: 26.0.50;
 describe-function: Don't require cl-lib at runtime
Date: Thu, 25 May 2017 21:15:52 +0900
Stefan Monnier <monnier <at> 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.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 23 Jun 2017 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 1 day ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.