From unknown Sat Sep 06 11:13:02 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#26712 <26712@debbugs.gnu.org> To: bug#26712 <26712@debbugs.gnu.org> Subject: Status: other-window/frame versions of find-library Reply-To: bug#26712 <26712@debbugs.gnu.org> Date: Sat, 06 Sep 2025 18:13:02 +0000 retitle 26712 other-window/frame versions of find-library reassign 26712 emacs submitter 26712 "Charles A. Roelli" severity 26712 wishlist thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 29 15:46:51 2017 Received: (at submit) by debbugs.gnu.org; 29 Apr 2017 19:46:51 +0000 Received: from localhost ([127.0.0.1]:46660 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d4YKR-0002ek-BR for submit@debbugs.gnu.org; Sat, 29 Apr 2017 15:46:51 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48115) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d4YKQ-0002eV-05 for submit@debbugs.gnu.org; Sat, 29 Apr 2017 15:46:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d4YKJ-0001yQ-Bp for submit@debbugs.gnu.org; Sat, 29 Apr 2017 15:46:44 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:40308) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d4YKJ-0001yM-99 for submit@debbugs.gnu.org; Sat, 29 Apr 2017 15:46:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39078) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d4YKH-0002cS-NW for bug-gnu-emacs@gnu.org; Sat, 29 Apr 2017 15:46:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d4YKE-0001wR-Jv for bug-gnu-emacs@gnu.org; Sat, 29 Apr 2017 15:46:41 -0400 Received: from [195.159.176.226] (port=39998 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d4YKE-0001ve-Bs for bug-gnu-emacs@gnu.org; Sat, 29 Apr 2017 15:46:38 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1d4YK2-0003gU-DH for bug-gnu-emacs@gnu.org; Sat, 29 Apr 2017 21:46:26 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: "Charles A. Roelli" Subject: other-window/frame versions of find-library Date: Sat, 29 Apr 2017 21:46:22 +0200 Lines: 179 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------EF0BE04BCDFCD31021E97DF3" X-Complaints-To: usenet@blaine.gmane.org User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 X-Mozilla-News-Host: news://news.gmane.org:119 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) This is a multi-part message in MIME format. --------------EF0BE04BCDFCD31021E97DF3 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Attached is a patch to add other-window/frames version of the `find-library' command. BTW, after I added the two new commands and rebuilt Emacs (with just `make'), I could not complete to them with `M-x find-library- TAB'. I could only do this after loading the `find-func' library that contains them. So I ran `make bootstrap' instead and then I could complete to them as expected. I guess this means the autoloads had not been updated with just `make'... which command should I have run? Bootstrapping takes awhile. --------------EF0BE04BCDFCD31021E97DF3 Content-Type: text/x-patch; name="0001-find-library-other-window-find-library-other-frame-N.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-find-library-other-window-find-library-other-frame-N.pa"; filename*1="tch" >From 9e4f4ba788635240b84ccdaa336760aacaa93417 Mon Sep 17 00:00:00 2001 From: Charles A. Roelli Date: Sat, 29 Apr 2017 19:40:11 +0200 Subject: [PATCH] find-library-other-window, find-library-other-frame: New commands * lisp/emacs-lisp/find-func.el (find-library-other-window) (find-library-other-frame): New commands to complement the existing `find-library' command. (find-library-read): New function to read a library name. (find-function-do-it): Fix indentation. ; * etc/NEWS (Changes in Emacs 26.1): Mention the new commands. --- etc/NEWS | 3 + lisp/emacs-lisp/find-func.el | 100 +++++++++++++++++++++++++----------------- 2 files changed, 63 insertions(+), 40 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 9d4c72d..0425996 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -340,6 +340,9 @@ want to reverse the direction of the scroll, customize ** Emacsclient has a new option -u/--suppress-output. The option suppresses display of return values from the server process. +** Two new commands 'find-library-other-window' and +'find-library-other-frame'. + * Editing Changes in Emacs 26.1 diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index d0acc14..1aea30c 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -271,42 +271,62 @@ find-function-C-source (cons (current-buffer) (match-beginning 0)))) ;;;###autoload -(defun find-library (library &optional other-window) - "Find the Emacs Lisp source of LIBRARY. -LIBRARY should be a string (the name of the library). If the -optional OTHER-WINDOW argument (i.e., the command argument) is -specified, pop to a different window before displaying the -buffer." - (interactive - (let* ((dirs (or find-function-source-path load-path)) - (suffixes (find-library-suffixes)) - (table (apply-partially 'locate-file-completion-table - dirs suffixes)) - (def (if (eq (function-called-at-point) 'require) - ;; `function-called-at-point' may return 'require - ;; with `point' anywhere on this line. So wrap the - ;; `save-excursion' below in a `condition-case' to - ;; avoid reporting a scan-error here. - (condition-case nil - (save-excursion - (backward-up-list) - (forward-char) - (forward-sexp 2) - (thing-at-point 'symbol)) - (error nil)) - (thing-at-point 'symbol)))) - (when (and def (not (test-completion def table))) - (setq def nil)) - (list - (completing-read (if def - (format "Library name (default %s): " def) - "Library name: ") - table nil nil nil nil def) - current-prefix-arg))) +(defun find-library (library) + "Find the Emacs Lisp source of the LIBRARY near point. + +LIBRARY should be a string (the name of the library)." + (interactive (find-library-read)) + (prog1 + (funcall 'switch-to-buffer + (find-file-noselect (find-library-name library))) + (run-hooks 'find-function-after-hook))) + +(defun find-library-read () + "Read and return a library name, defaulting to the one near point." + (let* ((dirs (or find-function-source-path load-path)) + (suffixes (find-library-suffixes)) + (table (apply-partially 'locate-file-completion-table + dirs suffixes)) + (def (if (eq (function-called-at-point) 'require) + ;; `function-called-at-point' may return 'require + ;; with `point' anywhere on this line. So wrap the + ;; `save-excursion' below in a `condition-case' to + ;; avoid reporting a scan-error here. + (condition-case nil + (save-excursion + (backward-up-list) + (forward-char) + (forward-sexp 2) + (thing-at-point 'symbol)) + (error nil)) + (thing-at-point 'symbol)))) + (when (and def (not (test-completion def table))) + (setq def nil)) + (list + (completing-read (if def + (format "Library name (default %s): " def) + "Library name: ") + table nil nil nil nil def)))) + +;;;###autoload +(defun find-library-other-window (library) + "Find, in another window, the file defining LIBRARY at or near point. + +See `find-library' for more details." + (interactive (find-library-read)) + (prog1 + (funcall 'switch-to-buffer-other-window + (find-file-noselect (find-library-name library))) + (run-hooks 'find-function-after-hook))) + +;;;###autoload +(defun find-library-other-frame (library) + "Find, in another frame, the file defining LIBRARY at or near point. + +See `find-library' for more details." + (interactive (find-library-read)) (prog1 - (funcall (if other-window - 'pop-to-buffer - 'pop-to-buffer-same-window) + (funcall 'switch-to-buffer-other-frame (find-file-noselect (find-library-name library))) (run-hooks 'find-function-after-hook))) @@ -470,11 +490,11 @@ find-function-do-it Set mark before moving, if the buffer already existed." (let* ((orig-point (point)) - (orig-buffers (buffer-list)) - (buffer-point (save-excursion - (find-definition-noselect symbol type))) - (new-buf (car buffer-point)) - (new-point (cdr buffer-point))) + (orig-buffers (buffer-list)) + (buffer-point (save-excursion + (find-definition-noselect symbol type))) + (new-buf (car buffer-point)) + (new-point (cdr buffer-point))) (when buffer-point (when (memq new-buf orig-buffers) (push-mark orig-point)) -- 1.7.4.4 --------------EF0BE04BCDFCD31021E97DF3-- From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 29 16:33:42 2017 Received: (at 26712) by debbugs.gnu.org; 29 Apr 2017 20:33:42 +0000 Received: from localhost ([127.0.0.1]:46700 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d4Z3l-0003mj-Qg for submit@debbugs.gnu.org; Sat, 29 Apr 2017 16:33:42 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:50422) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d4Z3j-0003mQ-PT for 26712@debbugs.gnu.org; Sat, 29 Apr 2017 16:33:40 -0400 Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v3TKXNxt029054 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 29 Apr 2017 20:33:23 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id v3TKXMIR024234 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 29 Apr 2017 20:33:23 GMT Received: from abhmp0001.oracle.com (abhmp0001.oracle.com [141.146.116.7]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id v3TKXK5Z028468; Sat, 29 Apr 2017 20:33:21 GMT MIME-Version: 1.0 Message-ID: <81105fc0-7710-4825-a6a1-ce769b980ef7@default> Date: Sat, 29 Apr 2017 13:33:19 -0700 (PDT) From: Drew Adams To: "Charles A. Roelli" , 26712@debbugs.gnu.org Subject: RE: bug#26712: other-window/frame versions of find-library References: In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6767.5000 (x86)] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Source-IP: aserv0022.oracle.com [141.146.126.234] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 26712 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > Attached is a patch to add other-window/frames version of the > `find-library' command. >=20 > BTW, after I added the two new commands and rebuilt Emacs (with just > `make'), I could not complete to them with `M-x find-library- TAB'. I > could only do this after loading the `find-func' library that contains > them. So I ran `make bootstrap' instead and then I could complete to > them as expected. I guess this means the autoloads had not been updated > with just `make'... which command should I have run? Bootstrapping > takes awhile. FWIW, I proposed this in March 2007 ("Please add `find-library-other-window'") http://lists.gnu.org/archive/html/emacs-devel/2007-03/msg01073.html I was told not to propose new features at that time. I proposed it again in June 2007 ("how about a find-library-other-window command?", http://lists.gnu.org/archive/html/emacs-devel/2007-06/msg01306.html). That thread was hijacked to a discussion about simulating all `-other-*' commands automatically (still one of Stefan's quests, I believe). I more than once tried to bring the discussion back on topic. http://lists.gnu.org/archive/html/emacs-devel/2007-06/msg01319.html ["This is all beginning to sound a bit complex. Perhaps worth exploring, but, in the meantime, could we at least add `find-library-other-window'? ;-)"] RMS, at least, responded favorably, asking for a patch. Juri complained that "polluting the namespace is not a good thing. There are too many commands that display a new buffer, and don't have the duplicate name with the `-other-window' suffix, and adding more redundant commands will increase the mess." I sent the patch anyway. http://lists.gnu.org/archive/html/emacs-devel/2007-06/msg01428.html RMS agreed to it and asked that someone install it. Juri complained that the code was repetitive for the 3 commands. It was never installed. Glad to see it finally added to Emacs. I've been using it for 10 years. I bind it to `C-x 4 l'. (I never use plain `find-library'.) From debbugs-submit-bounces@debbugs.gnu.org Sun Apr 30 14:16:45 2017 Received: (at 26712) by debbugs.gnu.org; 30 Apr 2017 18:16:45 +0000 Received: from localhost ([127.0.0.1]:48013 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d4tOm-0005q4-O7 for submit@debbugs.gnu.org; Sun, 30 Apr 2017 14:16:44 -0400 Received: from sinyavsky.aurox.ch ([37.35.109.145]:37602) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d4tOi-0005po-TS for 26712@debbugs.gnu.org; Sun, 30 Apr 2017 14:16:41 -0400 Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id DE8812240F for <26712@debbugs.gnu.org>; Sun, 30 Apr 2017 18:12:30 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= content-transfer-encoding:content-type:content-type:in-reply-to :mime-version:user-agent:date:date:message-id:from:from :references:to:subject:subject; s=dkim; t=1493575949; x= 1494439950; bh=qineNPPazNh3n27ikNEJvID9yc/nSQU9Yj5K4d3hSEs=; b=k Xsp6dyaKW5sSZr9fSaHKnJ6BLV9dyRdGDAY5119mD7MVhXufWUknnbv6CEThMvyS 11efaKleVUNskTBHZzjAXv9gJvrqKg1aXss1b/QPb5xDS+JhD6BeXKaSrNuohMlu o+CsonhlPSAqiTwxXVGCFQQ0sVxv+yQQhCojBsaBug= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id pQ7_FvECim9W for <26712@debbugs.gnu.org>; Sun, 30 Apr 2017 18:12:29 +0000 (UTC) Received: from [192.168.1.106] (179.133.105.92.dynamic.wline.res.cust.swisscom.ch [92.105.133.179]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id C11BE22151; Sun, 30 Apr 2017 18:12:28 +0000 (UTC) Subject: Re: bug#26712: other-window/frame versions of find-library To: Drew Adams , 26712@debbugs.gnu.org References: <81105fc0-7710-4825-a6a1-ce769b980ef7@default> From: "Charles A. Roelli" Message-ID: <03614ba6-c14b-953a-fcab-0b0094f922c3@aurox.ch> Date: Sun, 30 Apr 2017 20:16:31 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <81105fc0-7710-4825-a6a1-ce769b980ef7@default> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 26712 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Not sure why this mundane feature generates so much contention... From debbugs-submit-bounces@debbugs.gnu.org Mon May 01 07:11:46 2017 Received: (at 26712) by debbugs.gnu.org; 1 May 2017 11:11:46 +0000 Received: from localhost ([127.0.0.1]:48569 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d59F4-0007kY-9F for submit@debbugs.gnu.org; Mon, 01 May 2017 07:11:46 -0400 Received: from mail-wm0-f52.google.com ([74.125.82.52]:36361) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d59F2-0007kM-K4 for 26712@debbugs.gnu.org; Mon, 01 May 2017 07:11:45 -0400 Received: by mail-wm0-f52.google.com with SMTP id u65so85821618wmu.1 for <26712@debbugs.gnu.org>; Mon, 01 May 2017 04:11:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=D1fijrztdFmsGPMIWCOXJcOPkcsASF/kGfukttnnnpU=; b=pCdTgxdZ531PwTzzeg7a49mdyxVetfjHl+Tz97rSKJ8DHANu6AAURcemGwmkkjXlDt CphChiFbIyQGUeMK89R5xhHXGXs9XxCzkCJmLUlaVL3qrcA8YZaxEhFYGbzk3dzOv+7e nj+LlF3MtP1fopXfp1TIDqUPmE+2SPd2TdArLkvCckNgn8nLuxCryOL4bUZI/+MRpgap R9+VW5tWl1FRhGTGY1TU4LOpu9u/U2bBJKUw/FIRWnOBxzUhdM4F9UG24FUXjzm9oy5O DO2A7hCc9Tqo4+nsR1X8tFZEq16pVwCleIwINZuXlFliNiKwQJZPIrlTz72MAtZ/eLbl 7eAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=D1fijrztdFmsGPMIWCOXJcOPkcsASF/kGfukttnnnpU=; b=LS5r+90wj/uQEnfL1dUbdVfqhl1+OhmAe0lpyPYwedsyUP5LeYJGRaseF5s6yyAP+Q KebEwgZyT/8yA9V0f7bGe7y4CGe7f8fM3QwHS9KVWQGGdVVhl7gVrd5A01txe+/HL5R4 TqEOi+xhKv+od2yzKM/j0xMMo4vueCQ2/JYTiNAawJAloQUX/PrRQpPLJXiKDsEbTLxF jCY8U3a20KTGHdmVpvn5jvbMJaAdRQXk4gj2EvxoBS7g77vv+wOE7B00ySlwQ4CnZc0s 6k+mMRyZFGnFU3XNOtVDx1MAU2G8vEj884WC0X5p4JCsQTDSqJ9wOVoPfFx5M74a5gkI CCAg== X-Gm-Message-State: AN3rC/6T6r/eDQ4HdLffE/nPMmstZBlDb4zCc5iff31Cb6gStA4jUb7I sDgrK4OPy29bpfEp//UI2wWY61Emjw== X-Received: by 10.28.150.86 with SMTP id y83mr6312819wmd.46.1493637098989; Mon, 01 May 2017 04:11:38 -0700 (PDT) MIME-Version: 1.0 References: <81105fc0-7710-4825-a6a1-ce769b980ef7@default> <03614ba6-c14b-953a-fcab-0b0094f922c3@aurox.ch> In-Reply-To: <03614ba6-c14b-953a-fcab-0b0094f922c3@aurox.ch> From: Philipp Stephani Date: Mon, 01 May 2017 11:11:28 +0000 Message-ID: Subject: Re: bug#26712: other-window/frame versions of find-library To: "Charles A. Roelli" , Drew Adams , 26712@debbugs.gnu.org Content-Type: multipart/alternative; boundary=001a114b33e4b56c50054e747c1c X-Spam-Score: 0.2 (/) X-Debbugs-Envelope-To: 26712 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) --001a114b33e4b56c50054e747c1c Content-Type: text/plain; charset=UTF-8 Charles A. Roelli schrieb am So., 30. Apr. 2017 um 20:17 Uhr: > Not sure why this mundane feature generates so much contention... > Parkinson's law of triviality. --001a114b33e4b56c50054e747c1c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


Charle= s A. Roelli <charles@aurox.ch>= ; schrieb am So., 30. Apr. 2017 um 20:17=C2=A0Uhr:
Not sure why this mundane feature generates so much content= ion...

Parkinson's law of trivialit= y.=C2=A0
--001a114b33e4b56c50054e747c1c-- From debbugs-submit-bounces@debbugs.gnu.org Sat May 06 05:57:00 2017 Received: (at 26712) by debbugs.gnu.org; 6 May 2017 09:57:00 +0000 Received: from localhost ([127.0.0.1]:57181 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d6wSS-0000cX-7x for submit@debbugs.gnu.org; Sat, 06 May 2017 05:57:00 -0400 Received: from sinyavsky.aurox.ch ([37.35.109.145]:41086) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d6wSQ-0000cK-Uo for 26712@debbugs.gnu.org; Sat, 06 May 2017 05:56:59 -0400 Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id 75C3522414 for <26712@debbugs.gnu.org>; Sat, 6 May 2017 09:52:43 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= content-transfer-encoding:content-type:content-type:in-reply-to :mime-version:user-agent:date:date:message-id:from:from :references:to:subject:subject; s=dkim; t=1494064362; x= 1494928363; bh=C/Yim1Q4tS03sE51QJhIiPGA8IDQvEeqY62ukqq2TSw=; b=w EzE5u0M1R7IOgH7zi2BBAU4Fc8SR5MEXNYOx2vjRTA8A6GZEtkgpLJ9VzKgbnGgd svk3ji1tUeA47nXXF37VWKAO9sBjQi3d6CMUreiUrRzVbqxZZET5t7ZPzZ/Imjzj SXov6YlOaMbPnrpVvfKqLcJnkEW2a8xIuX63b2vwrM= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id mXdkY5xbN9el for <26712@debbugs.gnu.org>; Sat, 6 May 2017 09:52:42 +0000 (UTC) Received: from [192.168.1.106] (179.133.105.92.dynamic.wline.res.cust.swisscom.ch [92.105.133.179]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id EA4F622410 for <26712@debbugs.gnu.org>; Sat, 6 May 2017 09:52:41 +0000 (UTC) Subject: Re: bug#26712: other-window/frame versions of find-library To: 26712@debbugs.gnu.org References: From: "Charles A. Roelli" Message-ID: <8897133a-0836-23a6-6bbe-aecc6ec8b7c8@aurox.ch> Date: Sat, 6 May 2017 11:56:50 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 26712 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Ping! Comments? On 29/04/2017 21:46, Charles A. Roelli wrote: > Attached is a patch to add other-window/frames version of the > `find-library' command. > > BTW, after I added the two new commands and rebuilt Emacs (with just > `make'), I could not complete to them with `M-x find-library- TAB'. I > could only do this after loading the `find-func' library that contains > them. So I ran `make bootstrap' instead and then I could complete to > them as expected. I guess this means the autoloads had not been updated > with just `make'... which command should I have run? Bootstrapping > takes awhile. From debbugs-submit-bounces@debbugs.gnu.org Sun May 07 08:08:35 2017 Received: (at 26712) by debbugs.gnu.org; 7 May 2017 12:08:35 +0000 Received: from localhost ([127.0.0.1]:59134 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7KzL-0001l0-7C for submit@debbugs.gnu.org; Sun, 07 May 2017 08:08:35 -0400 Received: from mail-wr0-f170.google.com ([209.85.128.170]:33081) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7KzK-0001km-2h for 26712@debbugs.gnu.org; Sun, 07 May 2017 08:08:34 -0400 Received: by mail-wr0-f170.google.com with SMTP id w50so24758695wrc.0 for <26712@debbugs.gnu.org>; Sun, 07 May 2017 05:08:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=S/9/wO2n2gEmKiP/x5+zGG5lO0zD4wDDPbSSQAxtQwA=; b=A1ey9Bw0Y+eDxARfrcsqe2zEqprYXGvhcs0gG+mG2MRn+oMHQigN/kfBH2J0npPVdq tX/w06cHPoPLGdMP8d0gJ4hWgJMi7sUg4MXBU9iHia7SsDezdpPt1ZS/wFeIhn2IJNWw jI/+BOLIXen49YEDQp3yQy2AmW6qpos1kPgr6/FE4Mjp11Zt5u0R7cwHIe3BNycCQG0s 7JdB7LtjyYDS6EG57yxtdNoJ0uLjxg4rAGcWUb1S9as8yM21lpet9F1cfYYfqVOd+hcS qdUDivqFCKSrkCjhKjfCmUA/MlfABjurH1RanzdgR5ZFcR3l/tOet6tpxWA1DA0AecOG XxnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=S/9/wO2n2gEmKiP/x5+zGG5lO0zD4wDDPbSSQAxtQwA=; b=AZbUhGjNcHWimJbhOXlbByHOQw39yAo3FpVKBRrtmMGZ20+pCCnDqhMYuIg3tbFII8 XeVySVvsDQ/1gPCt2/EPUpjRbGCLsChIvTQkC1Uol8nbtk+Ge/qaX6JcjuYvDAlb1nxm wMYks6N9fnUVfxJw9gymAbJtC8AF9gmoV5inNvUExDJpWPb/jS1pR5VvYEf/Psf7oOZa TT5T+FnwCVdItu31HpG+mqj9lePaEVCxeKbywkcZhGPqjeLCz5sbzJr96eWs4DC5FnaJ LN/TyqQClR1mPFK7MH1RYJ0pp+MYxpiLt4Qu0FUCxZqMarT92LPrmDYxNesZH8sPIzmg gwNg== X-Gm-Message-State: AN3rC/5aYb60W33p6e4TzxmnNUX6/QfYdyKyIqORlGAGNQF7Ln2VsmGY i1uSqMqw721uTBgpK5tYydXZ6GjHBn49 X-Received: by 10.223.154.40 with SMTP id z37mr39988251wrb.136.1494158908444; Sun, 07 May 2017 05:08:28 -0700 (PDT) MIME-Version: 1.0 References: <8897133a-0836-23a6-6bbe-aecc6ec8b7c8@aurox.ch> In-Reply-To: <8897133a-0836-23a6-6bbe-aecc6ec8b7c8@aurox.ch> From: Philipp Stephani Date: Sun, 07 May 2017 12:08:17 +0000 Message-ID: Subject: Re: bug#26712: other-window/frame versions of find-library To: "Charles A. Roelli" , 26712@debbugs.gnu.org Content-Type: multipart/alternative; boundary=f403045f572ef9dcb6054eedfa8b X-Spam-Score: -2.5 (--) X-Debbugs-Envelope-To: 26712 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.5 (--) --f403045f572ef9dcb6054eedfa8b Content-Type: text/plain; charset=UTF-8 My approach has been lately: if nobody has commented on a patch for a week, then just install it. Charles A. Roelli schrieb am Sa., 6. Mai 2017 um 11:57 Uhr: > Ping! Comments? > > On 29/04/2017 21:46, Charles A. Roelli wrote: > > Attached is a patch to add other-window/frames version of the > > `find-library' command. > > > > BTW, after I added the two new commands and rebuilt Emacs (with just > > `make'), I could not complete to them with `M-x find-library- TAB'. I > > could only do this after loading the `find-func' library that contains > > them. So I ran `make bootstrap' instead and then I could complete to > > them as expected. I guess this means the autoloads had not been updated > > with just `make'... which command should I have run? Bootstrapping > > takes awhile. > > > > --f403045f572ef9dcb6054eedfa8b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
My approach has been lately: if nobody has commented on a = patch for a week, then just install it.

<= div dir=3D"ltr">Charles A. Roelli <c= harles@aurox.ch> schrieb am Sa., 6. Mai 2017 um 11:57=C2=A0Uhr:
<= /div>
Ping!=C2=A0 Comments?

On 29/04/2017 21:46, Charles A. Roelli wrote:
> Attached is a patch to add other-window/frames version of the
> `find-library' command.
>
> BTW, after I added the two new commands and rebuilt Emacs (with just > `make'), I could not complete to them with `M-x find-library- TAB&= #39;.=C2=A0 I
> could only do this after loading the `find-func' library that cont= ains
> them.=C2=A0 So I ran `make bootstrap' instead and then I could com= plete to
> them as expected.=C2=A0 I guess this means the autoloads had not been = updated
> with just `make'... which command should I have run?=C2=A0 Bootstr= apping
> takes awhile.



--f403045f572ef9dcb6054eedfa8b-- From debbugs-submit-bounces@debbugs.gnu.org Sun May 07 09:36:41 2017 Received: (at 26712) by debbugs.gnu.org; 7 May 2017 13:36:41 +0000 Received: from localhost ([127.0.0.1]:59267 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7MMb-0003nl-9k for submit@debbugs.gnu.org; Sun, 07 May 2017 09:36:41 -0400 Received: from sinyavsky.aurox.ch ([37.35.109.145]:41894) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7MMZ-0003nY-Mq for 26712@debbugs.gnu.org; Sun, 07 May 2017 09:36:40 -0400 Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id AF6352241E for <26712@debbugs.gnu.org>; Sun, 7 May 2017 13:32:21 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= content-transfer-encoding:content-type:content-type:in-reply-to :mime-version:user-agent:date:date:message-id:from:from :references:to:subject:subject; s=dkim; t=1494163940; x= 1495027941; bh=E2TJxr3RukjSOa0odjglTrwpOpC6RwI9IMdxAnMvqkU=; b=A MhbKexoABcYFWmj5RnLzqysKP70I4UGOBKWUfbGEfFmH8JVuSAEEaXzRbdZsiYBg IHK32NsscWk7L7PMjPGtvAVc1SJDyG6bYsYIHz3HhRvaD05Fhq033vh0iHzvb4Cy h03T8GqS6VQpDBTxWrJkZW/T/c7oe8XSmFTeetr7lQ= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id XOvr1lHT-lLz for <26712@debbugs.gnu.org>; Sun, 7 May 2017 13:32:20 +0000 (UTC) Received: from [192.168.1.106] (179.133.105.92.dynamic.wline.res.cust.swisscom.ch [92.105.133.179]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id F200822151; Sun, 7 May 2017 13:32:17 +0000 (UTC) Subject: Re: bug#26712: other-window/frame versions of find-library To: Philipp Stephani , 26712@debbugs.gnu.org References: <8897133a-0836-23a6-6bbe-aecc6ec8b7c8@aurox.ch> From: "Charles A. Roelli" Message-ID: <9b566259-457c-faf2-10e1-42c084afccea@aurox.ch> Date: Sun, 7 May 2017 15:36:27 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 26712 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) I would install it, but I don't have commit access. I'll put in a request for that now on Savannah, since I'd also like to work on a few issues with the NS port. From debbugs-submit-bounces@debbugs.gnu.org Sun May 07 09:45:19 2017 Received: (at 26712) by debbugs.gnu.org; 7 May 2017 13:45:19 +0000 Received: from localhost ([127.0.0.1]:59273 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7MUx-0003zy-5A for submit@debbugs.gnu.org; Sun, 07 May 2017 09:45:19 -0400 Received: from mail-wr0-f177.google.com ([209.85.128.177]:34912) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7MUu-0003zk-Cl for 26712@debbugs.gnu.org; Sun, 07 May 2017 09:45:16 -0400 Received: by mail-wr0-f177.google.com with SMTP id z52so25617239wrc.2 for <26712@debbugs.gnu.org>; Sun, 07 May 2017 06:45:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=7SEQNKn8o9g21GhtrYQa6Sa8L/qqg4b0PKma5ub6AHw=; b=dIugvhDh1lyqk50sbU5/hcAZWy7vSkIvIkyXJJfg7q8NCuUvwXGYd+L83Y1QslSOYD cI2ioYVhCErXtdvEhC20QaqH7nqIOKNfDRoRrDS2/BusIxrMe83Q/zDm+dX0055K97NW CvfEClc86hVGsoDbBmYsD3gjKkIxNDFEErP47xkU+valTpVAEO1aCuiu6wxFszA2LgWL 1wJAPgBdHgnkHIPvFO53fhe42c4SO+6Ss+LWnT9aSzq7YhQAy1onMFo1D6EK3mrOWgyy GL3tJGmqjmbw7U8Gmwqi3Eka9L6jxqz4fn6YIqKRKizkFUER8E2k386mo9+3qmqE/X8q lwbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=7SEQNKn8o9g21GhtrYQa6Sa8L/qqg4b0PKma5ub6AHw=; b=EWZRghSP2uklzKHPaVtE4N63nAcYSfHCLz2PqIb1iFAeA1mAEH6JYDor46N1+p9e41 i6ddsyCkR2YDy3M07eXGhQEf+tESvMaoCT1HNAHeIymrzZzza4ArYljxFQuO2dJx1/DA /hrEBKNVXLqEmtJabWkhVHMjkh93lcXN+6GUsRCHW7gzH+psfyZi03QkBTGEqb+628pp mK4mQ0KAuvgET+VAN0mwcyUjlU+11HeDuOW9bBq2BUZikyjN/NqqKc8blTpFtsHhSmSP oWubv47Es+utvb29WKKO6686wFSjrUY2e/PWVS+HiFDMnbcEeg5SlrLrN54xP8RWjUeP 7YjQ== X-Gm-Message-State: AN3rC/5jVb5tvqP+8iSNYwXxJ1vKMUvPPGF+5TQjASiMx0PgdGB6/nIF hvdLufKFyoqFmbRc8n+8m91EFanPZg== X-Received: by 10.223.170.67 with SMTP id q3mr12941109wrd.19.1494164710551; Sun, 07 May 2017 06:45:10 -0700 (PDT) MIME-Version: 1.0 References: <8897133a-0836-23a6-6bbe-aecc6ec8b7c8@aurox.ch> <9b566259-457c-faf2-10e1-42c084afccea@aurox.ch> In-Reply-To: <9b566259-457c-faf2-10e1-42c084afccea@aurox.ch> From: Philipp Stephani Date: Sun, 07 May 2017 13:45:00 +0000 Message-ID: Subject: Re: bug#26712: other-window/frame versions of find-library To: "Charles A. Roelli" , 26712@debbugs.gnu.org Content-Type: multipart/alternative; boundary=94eb2c1cc5c8cef8a0054eef547b X-Spam-Score: -2.0 (--) X-Debbugs-Envelope-To: 26712 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.0 (--) --94eb2c1cc5c8cef8a0054eef547b Content-Type: text/plain; charset=UTF-8 Charles A. Roelli schrieb am So., 7. Mai 2017 um 15:36 Uhr: > I would install it, but I don't have commit access. Ah, OK. Then a couple of minor comments: - Consider renaming `find-library-read' to `find-func--read-library' to make it internal. It's probably not intended as a public API. - (funcall 'foo ...) should be written as (foo ...) - Please revert unrelated whitespace changes (changing tabs to spaces in find-function-do-it) --94eb2c1cc5c8cef8a0054eef547b Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


Charle= s A. Roelli <charles@aurox.ch>= ; schrieb am So., 7. Mai 2017 um 15:36=C2=A0Uhr:
I would install it, but I don't have commit access.=C2=A0=

Ah, OK. Then a couple of minor comments:

- Consider renaming `find-library-read' to `fin= d-func--read-library' to make it internal. It's probably not intend= ed as a public API.

- (funcall 'foo ...) shoul= d be written as (foo ...)

- Please revert unrelate= d whitespace changes (changing tabs to spaces in find-function-do-it)=C2=A0=
--94eb2c1cc5c8cef8a0054eef547b-- From debbugs-submit-bounces@debbugs.gnu.org Sun May 07 11:07:58 2017 Received: (at 26712) by debbugs.gnu.org; 7 May 2017 15:07:58 +0000 Received: from localhost ([127.0.0.1]:60464 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7Nmw-0006CR-1o for submit@debbugs.gnu.org; Sun, 07 May 2017 11:07:58 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:50558) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d7Nms-0006CC-OO for 26712@debbugs.gnu.org; Sun, 07 May 2017 11:07:55 -0400 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v47F7dne023891 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 7 May 2017 15:07:39 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.13.8/8.14.4) with ESMTP id v47F7cvN027190 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 7 May 2017 15:07:38 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id v47F7bmW009156; Sun, 7 May 2017 15:07:38 GMT MIME-Version: 1.0 Message-ID: Date: Sun, 7 May 2017 08:07:37 -0700 (PDT) From: Drew Adams To: Philipp Stephani , "Charles A. Roelli" , 26712@debbugs.gnu.org Subject: RE: bug#26712: other-window/frame versions of find-library References: <8897133a-0836-23a6-6bbe-aecc6ec8b7c8@aurox.ch> <9b566259-457c-faf2-10e1-42c084afccea@aurox.ch> In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6767.5000 (x86)] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Source-IP: aserv0021.oracle.com [141.146.126.233] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 26712 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > - Consider renaming `find-library-read' to > `find-func--read-library' to make it internal. > It's probably not intended as a public API. Why? No. Please do not consider that. Not for a moment. FWIW, I completely disagree with this point of view and approach to Emacs Lisp. Just the opposite. Unless there is some _very_ important reason why something _must_ be branded as "internal", it should not be. It may be a hard habit to break, but the notion of a "public API" is generally inappropriate for Emacs Lisp. Emacs users are also Emacs-Lisp developers. And yes, they do write their own libraries that read input. Just imagine, if an input-reading function such as `ffap-read-file-or-url', `read-file-name', `completing-read', `read-face-name', or `read-char' were declared at the outset to be "internal". What's the point of such an artificial=20 separation? In fact, I'd suggest that the library prefix be removed from `find-library-read' - just call it `read-library-name'. Elevate it; don't hide or suppress it. GNU Emacs in particular, and free software in general, have the explicit intention that users _are_ developers and that they look under the hood, tinker with engine parts, modify or make their own use of them, to create new and better things. And yes, Emacs development is driven not only by its maintainers or those most active in its C code or fixing its bugs. It is driven also, and importantly, by users, who write their own code for their own uses, and who sometimes extend that code into 3rd-party libraries. Some such development even finds its way into distributed Emacs itself - either directly, by incorporating it, or indirectly, by copy or inspiration. The latter happens more than most people, including Emacs maintainers, are aware of. Emacs would not be what it is today if it did not offer features written by its users (think Org). And this has been true of Emacs since Day One - even before GNU Emacs. So let's please stop with the tendency to view Emacs development as an internal-vs-external thing: we core developers and the code we maintain vs you "lusers" and your customizations. If we are to have _any_ "internal" functions or variables then the burden should be to demonstrate strongly why a given one really _needs_ to be internal. A priori, every single one should be "external" or, more exactly,=20 "nil-ternal". I see no good reason why a general function that reads a library name should be flagged "internal". Why should anyone be discouraged from using it in their code? Why shouldn't everyone be encouraged to use it, if they want to read a library name? This kind of not-for-the-users attitude smacks of elitism, or at least seems control-freakish, even if it is unconscious. Open the corral, please. Emacs, and all of its code, belongs to its users. There is nothing special about this function. It is useful generally. And it should be called something like `read-library-name'. From debbugs-submit-bounces@debbugs.gnu.org Tue May 16 15:08:08 2017 Received: (at 26712) by debbugs.gnu.org; 16 May 2017 19:08:08 +0000 Received: from localhost ([127.0.0.1]:49046 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dAhpI-0007yi-B1 for submit@debbugs.gnu.org; Tue, 16 May 2017 15:08:08 -0400 Received: from sinyavsky.aurox.ch ([37.35.109.145]:48795) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dAhpG-0007yA-0T for 26712@debbugs.gnu.org; Tue, 16 May 2017 15:08:06 -0400 Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id 895B02242F for <26712@debbugs.gnu.org>; Tue, 16 May 2017 19:03:40 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= content-type:content-type:in-reply-to:mime-version:user-agent :date:date:message-id:from:from:references:to:subject:subject; s=dkim; t=1494961417; x=1495825418; bh=1ZtCQ7zQTkl5u4BS0kDy49ml KxM3sEVgWaHtJqTuCTA=; b=QoL0C96aUJ0km5NkXrVridHV+wT+I3nsxSRw/Al2 lQo1p1X7BN4ks5vkXPmNUOItQ/aRf3YArF6/G7Tnu/O1NdflNAnOqKl0vy84qRMx i9mTUe+zbuK++a0YGrmz59F/k94K88giamhnLQ3Xz2WsCVYyR3Jj3PI0ZVr/Awv7 XVQ= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id tmRWINUBIQ0K for <26712@debbugs.gnu.org>; Tue, 16 May 2017 19:03:37 +0000 (UTC) Received: from [192.168.1.121] (179.133.105.92.dynamic.wline.res.cust.swisscom.ch [92.105.133.179]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id 97D8822412; Tue, 16 May 2017 19:03:37 +0000 (UTC) Subject: Re: bug#26712: other-window/frame versions of find-library To: Drew Adams , Philipp Stephani , 26712@debbugs.gnu.org References: <8897133a-0836-23a6-6bbe-aecc6ec8b7c8@aurox.ch> <9b566259-457c-faf2-10e1-42c084afccea@aurox.ch> From: "Charles A. Roelli" Message-ID: Date: Tue, 16 May 2017 21:08:07 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------7748E0D1FDA0E834DAB5C8FB" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 26712 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) This is a multi-part message in MIME format. --------------7748E0D1FDA0E834DAB5C8FB Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit I agree. Not sure if the `read-library' function should go in a different file, but in any case it makes sense to let users take advantage of it in their code. Attached is a revised patch with Philipp's other suggestions taken into account. On 07/05/2017 17:07, Drew Adams wrote: >> - Consider renaming `find-library-read' to >> `find-func--read-library' to make it internal. >> It's probably not intended as a public API. > Why? No. Please do not consider that. Not for a moment. > > FWIW, I completely disagree with this point of view and > approach to Emacs Lisp. Just the opposite. Unless there is > some _very_ important reason why something _must_ be branded > as "internal", it should not be. > > It may be a hard habit to break, but the notion of a "public > API" is generally inappropriate for Emacs Lisp. Emacs users > are also Emacs-Lisp developers. And yes, they do write their > own libraries that read input. > > Just imagine, if an input-reading function such as > `ffap-read-file-or-url', `read-file-name', `completing-read', > `read-face-name', or `read-char' were declared at the outset > to be "internal". What's the point of such an artificial > separation? > > In fact, I'd suggest that the library prefix be removed from > `find-library-read' - just call it `read-library-name'. > Elevate it; don't hide or suppress it. > > GNU Emacs in particular, and free software in general, have > the explicit intention that users _are_ developers and that > they look under the hood, tinker with engine parts, modify > or make their own use of them, to create new and better > things. > > And yes, Emacs development is driven not only by its > maintainers or those most active in its C code or fixing > its bugs. It is driven also, and importantly, by users, > who write their own code for their own uses, and who > sometimes extend that code into 3rd-party libraries. > > Some such development even finds its way into distributed > Emacs itself - either directly, by incorporating it, or > indirectly, by copy or inspiration. The latter happens > more than most people, including Emacs maintainers, are > aware of. > > Emacs would not be what it is today if it did not offer > features written by its users (think Org). And this has > been true of Emacs since Day One - even before GNU Emacs. > > So let's please stop with the tendency to view Emacs > development as an internal-vs-external thing: we core > developers and the code we maintain vs you "lusers" and > your customizations. > > If we are to have _any_ "internal" functions or variables > then the burden should be to demonstrate strongly why > a given one really _needs_ to be internal. A priori, > every single one should be "external" or, more exactly, > "nil-ternal". > > I see no good reason why a general function that reads a > library name should be flagged "internal". Why should > anyone be discouraged from using it in their code? Why > shouldn't everyone be encouraged to use it, if they want > to read a library name? > > This kind of not-for-the-users attitude smacks of > elitism, or at least seems control-freakish, even if it > is unconscious. Open the corral, please. Emacs, and > all of its code, belongs to its users. > > There is nothing special about this function. It is > useful generally. And it should be called something > like `read-library-name'. --------------7748E0D1FDA0E834DAB5C8FB Content-Type: text/x-patch; name="0001-New-commands-find-library-other-window-find-library-.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-New-commands-find-library-other-window-find-library-.pa"; filename*1="tch" >From 7edba19c49edeaa5efe244397dcd93f99fa6705d Mon Sep 17 00:00:00 2001 From: Charles A. Roelli Date: Tue, 16 May 2017 20:40:50 +0200 Subject: [PATCH] New commands: find-library-other-window, find-library-other-frame * lisp/emacs-lisp/find-func.el (find-library-other-window) (find-library-other-frame): New commands to complement the existing `find-library' command. (read-library-name): New function to read a library name. --- etc/NEWS | 3 + lisp/emacs-lisp/find-func.el | 90 +++++++++++++++++++++++++----------------- 2 files changed, 57 insertions(+), 36 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 25f0f18..bea4928 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -344,6 +344,9 @@ for DNS-querying functions 'nslookup-host', 'dns-lookup-host', and 'run-dig'. Each function now accepts an optional name server argument interactively (with a prefix argument) and non-interactively. +** Two new commands 'find-library-other-window' and +'find-library-other-frame'. + * Editing Changes in Emacs 26.1 diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index d0acc14..43be71b 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -271,44 +271,61 @@ find-function-C-source (cons (current-buffer) (match-beginning 0)))) ;;;###autoload -(defun find-library (library &optional other-window) - "Find the Emacs Lisp source of LIBRARY. -LIBRARY should be a string (the name of the library). If the -optional OTHER-WINDOW argument (i.e., the command argument) is -specified, pop to a different window before displaying the -buffer." - (interactive - (let* ((dirs (or find-function-source-path load-path)) - (suffixes (find-library-suffixes)) - (table (apply-partially 'locate-file-completion-table - dirs suffixes)) - (def (if (eq (function-called-at-point) 'require) - ;; `function-called-at-point' may return 'require - ;; with `point' anywhere on this line. So wrap the - ;; `save-excursion' below in a `condition-case' to - ;; avoid reporting a scan-error here. - (condition-case nil - (save-excursion - (backward-up-list) - (forward-char) - (forward-sexp 2) - (thing-at-point 'symbol)) - (error nil)) - (thing-at-point 'symbol)))) - (when (and def (not (test-completion def table))) - (setq def nil)) - (list - (completing-read (if def - (format "Library name (default %s): " def) - "Library name: ") - table nil nil nil nil def) - current-prefix-arg))) +(defun find-library (library) + "Find the Emacs Lisp source of the LIBRARY near point. + +LIBRARY should be a string (the name of the library)." + (interactive (list (read-library-name))) + (prog1 + (switch-to-buffer (find-file-noselect (find-library-name library))) + (run-hooks 'find-function-after-hook))) + +(defun read-library-name () + "Read and return a library name, defaulting to the one near point." + (let* ((dirs (or find-function-source-path load-path)) + (suffixes (find-library-suffixes)) + (table (apply-partially 'locate-file-completion-table + dirs suffixes)) + (def (if (eq (function-called-at-point) 'require) + ;; `function-called-at-point' may return 'require + ;; with `point' anywhere on this line. So wrap the + ;; `save-excursion' below in a `condition-case' to + ;; avoid reporting a scan-error here. + (condition-case nil + (save-excursion + (backward-up-list) + (forward-char) + (forward-sexp 2) + (thing-at-point 'symbol)) + (error nil)) + (thing-at-point 'symbol)))) + (when (and def (not (test-completion def table))) + (setq def nil)) + (completing-read (if def + (format "Library name (default %s): " def) + "Library name: ") + table nil nil nil nil def))) + +;;;###autoload +(defun find-library-other-window (library) + "Find, in another window, the file defining LIBRARY at or near point. + +See `find-library' for more details." + (interactive (list (read-library-name))) + (prog1 + (switch-to-buffer-other-window (find-file-noselect + (find-library-name library))) + (run-hooks 'find-function-after-hook))) + +;;;###autoload +(defun find-library-other-frame (library) + "Find, in another frame, the file defining LIBRARY at or near point. + +See `find-library' for more details." + (interactive (list (read-library-name))) (prog1 - (funcall (if other-window - 'pop-to-buffer - 'pop-to-buffer-same-window) - (find-file-noselect (find-library-name library))) + (switch-to-buffer-other-frame (find-file-noselect + (find-library-name library))) (run-hooks 'find-function-after-hook))) ;;;###autoload -- 1.7.4.4 --------------7748E0D1FDA0E834DAB5C8FB-- From debbugs-submit-bounces@debbugs.gnu.org Tue May 16 15:37:03 2017 Received: (at 26712) by debbugs.gnu.org; 16 May 2017 19:37:03 +0000 Received: from localhost ([127.0.0.1]:49089 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dAiHG-0000E2-7g for submit@debbugs.gnu.org; Tue, 16 May 2017 15:37:03 -0400 Received: from eggs.gnu.org ([208.118.235.92]:59827) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dAiHE-0000DU-IL for 26712@debbugs.gnu.org; Tue, 16 May 2017 15:37:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dAiH4-0006KZ-9o for 26712@debbugs.gnu.org; Tue, 16 May 2017 15:36:55 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_20,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:44402) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dAiH4-0006KV-6P; Tue, 16 May 2017 15:36:50 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2159 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dAiH3-0000LI-1M; Tue, 16 May 2017 15:36:49 -0400 Date: Tue, 16 May 2017 22:36:36 +0300 Message-Id: <83tw4k61bv.fsf@gnu.org> From: Eli Zaretskii To: "Charles A. Roelli" In-reply-to: (charles@aurox.ch) Subject: Re: bug#26712: other-window/frame versions of find-library References: <8897133a-0836-23a6-6bbe-aecc6ec8b7c8@aurox.ch> <9b566259-457c-faf2-10e1-42c084afccea@aurox.ch> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 26712 Cc: 26712@debbugs.gnu.org, p.stephani2@gmail.com, drew.adams@oracle.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > From: "Charles A. Roelli" > Date: Tue, 16 May 2017 21:08:07 +0200 > > Attached is a revised patch with Philipp's other suggestions taken into > account. Thanks. A few comments: > +** Two new commands 'find-library-other-window' and > +'find-library-other-frame'. This is too terse. A few words regarding what these do would be much better. > +(defun find-library (library) > + "Find the Emacs Lisp source of the LIBRARY near point. This is confusing, IMO. Suggest to reword: Find the Emacs Lisp source of LIBRARY. Interactively, prompt for LIBRARY using the one at or near point as the default. > +(defun read-library-name () > + "Read and return a library name, defaulting to the one near point." I would explain here what constitutes a "library name", i.e. how does the function determine the library name at point. > +(defun find-library-other-window (library) > + "Find, in another window, the file defining LIBRARY at or near point. Any reason why the wording is different from that of find-library? From debbugs-submit-bounces@debbugs.gnu.org Wed May 17 15:17:13 2017 Received: (at 26712) by debbugs.gnu.org; 17 May 2017 19:17:13 +0000 Received: from localhost ([127.0.0.1]:51320 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dB4Rc-0005Ab-Uu for submit@debbugs.gnu.org; Wed, 17 May 2017 15:17:13 -0400 Received: from sinyavsky.aurox.ch ([37.35.109.145]:49802) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dB4Ra-0005AM-JP for 26712@debbugs.gnu.org; Wed, 17 May 2017 15:17:11 -0400 Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id 287582242E for <26712@debbugs.gnu.org>; Wed, 17 May 2017 19:12:42 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= content-type:content-type:in-reply-to:mime-version:user-agent :date:date:message-id:from:from:references:to:subject:subject; s=dkim; t=1495048359; x=1495912360; bh=ZypMGR4kBXn6xMvmeSfN1ADp FBULF5bOi+9TO2inl7w=; b=Oz2ebLlvYd1/B+L6pm0Cg8Nsh+v32wXpV4YWLiYK It54CPaiKOsqo2RUS2z9Th+6PX08/qnvs8RK8ROqKSbM0NpLnqEx7rSw/4I7txhI 9C6x8gCov2X4bpEvEX3A4SX+AS6DnYthsl82bHpSVQecSNt0NrIhwex/EZIoWwv4 FdQ= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id IJmBPLfGer6c for <26712@debbugs.gnu.org>; Wed, 17 May 2017 19:12:39 +0000 (UTC) Received: from [192.168.1.121] (179.133.105.92.dynamic.wline.res.cust.swisscom.ch [92.105.133.179]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id C20402242B; Wed, 17 May 2017 19:12:38 +0000 (UTC) Subject: Re: bug#26712: other-window/frame versions of find-library To: Eli Zaretskii References: <8897133a-0836-23a6-6bbe-aecc6ec8b7c8@aurox.ch> <9b566259-457c-faf2-10e1-42c084afccea@aurox.ch> <83tw4k61bv.fsf@gnu.org> From: "Charles A. Roelli" Message-ID: Date: Wed, 17 May 2017 21:16:57 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <83tw4k61bv.fsf@gnu.org> Content-Type: multipart/mixed; boundary="------------D7798D19D40F5A54289FF741" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 26712 Cc: 26712@debbugs.gnu.org, p.stephani2@gmail.com, drew.adams@oracle.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) This is a multi-part message in MIME format. --------------D7798D19D40F5A54289FF741 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Thank you for your comments. Please see again the attachment. On 16/05/2017 21:36, Eli Zaretskii wrote: >> +** Two new commands 'find-library-other-window' and >> +'find-library-other-frame'. > This is too terse. A few words regarding what these do would be much > better. Updated: +** Two new commands for finding the source code of Emacs Lisp +libraries: 'find-library-other-window' and 'find-library-other-frame'. + >> +(defun find-library (library) >> + "Find the Emacs Lisp source of the LIBRARY near point. > This is confusing, IMO. Suggest to reword: > > Find the Emacs Lisp source of LIBRARY. > Interactively, prompt for LIBRARY using the one at or near point as > the default. Thanks, I've updated it. >> +(defun read-library-name () >> + "Read and return a library name, defaulting to the one near point." > I would explain here what constitutes a "library name", i.e. how does > the function determine the library name at point. +A library name is the filename of an Emacs Lisp library located +in a directory under `load-path' (or `find-function-source-path', +if non-nil)." >> +(defun find-library-other-window (library) >> + "Find, in another window, the file defining LIBRARY at or near point. > Any reason why the wording is different from that of find-library? Nope, I've also amended this. --------------D7798D19D40F5A54289FF741 Content-Type: text/x-patch; name="0001-New-commands-find-library-other-window-find-library-.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-New-commands-find-library-other-window-find-library-.pa"; filename*1="tch" >From 44f5a4f6fce2002c4d0c0030a3ef60d31f4b649a Mon Sep 17 00:00:00 2001 From: Charles A. Roelli Date: Wed, 17 May 2017 21:13:17 +0200 Subject: [PATCH] New commands: find-library-other-window, find-library-other-frame * lisp/emacs-lisp/find-func.el (find-library-other-window) (find-library-other-frame): New commands to complement the existing `find-library' command. (read-library-name): New function to read a library name. --- etc/NEWS | 3 + lisp/emacs-lisp/find-func.el | 92 ++++++++++++++++++++++++++---------------- 2 files changed, 60 insertions(+), 35 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 25f0f18..2b04ea5 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -344,6 +344,9 @@ for DNS-querying functions 'nslookup-host', 'dns-lookup-host', and 'run-dig'. Each function now accepts an optional name server argument interactively (with a prefix argument) and non-interactively. +** Two new commands for finding the source code of Emacs Lisp +libraries: 'find-library-other-window' and 'find-library-other-frame'. + * Editing Changes in Emacs 26.1 diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index d0acc14..9b98f05 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -271,43 +271,65 @@ find-function-C-source (cons (current-buffer) (match-beginning 0)))) ;;;###autoload -(defun find-library (library &optional other-window) +(defun find-library (library) "Find the Emacs Lisp source of LIBRARY. -LIBRARY should be a string (the name of the library). If the -optional OTHER-WINDOW argument (i.e., the command argument) is -specified, pop to a different window before displaying the -buffer." - (interactive - (let* ((dirs (or find-function-source-path load-path)) - (suffixes (find-library-suffixes)) - (table (apply-partially 'locate-file-completion-table - dirs suffixes)) - (def (if (eq (function-called-at-point) 'require) - ;; `function-called-at-point' may return 'require - ;; with `point' anywhere on this line. So wrap the - ;; `save-excursion' below in a `condition-case' to - ;; avoid reporting a scan-error here. - (condition-case nil - (save-excursion - (backward-up-list) - (forward-char) - (forward-sexp 2) - (thing-at-point 'symbol)) - (error nil)) - (thing-at-point 'symbol)))) - (when (and def (not (test-completion def table))) - (setq def nil)) - (list - (completing-read (if def - (format "Library name (default %s): " def) - "Library name: ") - table nil nil nil nil def) - current-prefix-arg))) + +Interactively, prompt for LIBRARY using the one at or near point." + (interactive (list (read-library-name))) + (prog1 + (switch-to-buffer (find-file-noselect (find-library-name library))) + (run-hooks 'find-function-after-hook))) + +(defun read-library-name () + "Read and return a library name, defaulting to the one near point. + +A library name is the filename of an Emacs Lisp library located +in a directory under `load-path' (or `find-function-source-path', +if non-nil)." + (let* ((dirs (or find-function-source-path load-path)) + (suffixes (find-library-suffixes)) + (table (apply-partially 'locate-file-completion-table + dirs suffixes)) + (def (if (eq (function-called-at-point) 'require) + ;; `function-called-at-point' may return 'require + ;; with `point' anywhere on this line. So wrap the + ;; `save-excursion' below in a `condition-case' to + ;; avoid reporting a scan-error here. + (condition-case nil + (save-excursion + (backward-up-list) + (forward-char) + (forward-sexp 2) + (thing-at-point 'symbol)) + (error nil)) + (thing-at-point 'symbol)))) + (when (and def (not (test-completion def table))) + (setq def nil)) + (completing-read (if def + (format "Library name (default %s): " def) + "Library name: ") + table nil nil nil nil def))) + +;;;###autoload +(defun find-library-other-window (library) + "Find the Emacs Lisp source of LIBRARY in another window. + +See `find-library' for more details." + (interactive (list (read-library-name))) + (prog1 + (switch-to-buffer-other-window (find-file-noselect + (find-library-name library))) + (run-hooks 'find-function-after-hook))) + +;;;###autoload +(defun find-library-other-frame (library) + "Find the Emacs Lisp source of LIBRARY in another frame. + +See `find-library' for more details." + (interactive (list (read-library-name))) (prog1 - (funcall (if other-window - 'pop-to-buffer - 'pop-to-buffer-same-window) - (find-file-noselect (find-library-name library))) + (switch-to-buffer-other-frame (find-file-noselect + (find-library-name library))) (run-hooks 'find-function-after-hook))) ;;;###autoload -- 1.7.4.4 --------------D7798D19D40F5A54289FF741-- From debbugs-submit-bounces@debbugs.gnu.org Fri May 19 20:55:19 2017 Received: (at submit) by debbugs.gnu.org; 20 May 2017 00:55:19 +0000 Received: from localhost ([127.0.0.1]:55804 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dBsfv-0006Ce-2R for submit@debbugs.gnu.org; Fri, 19 May 2017 20:55:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:42872) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dBsft-0006CR-E4 for submit@debbugs.gnu.org; Fri, 19 May 2017 20:55:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dBsfn-0000hE-4A for submit@debbugs.gnu.org; Fri, 19 May 2017 20:55:11 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:52045) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dBsfn-0000h1-1Q for submit@debbugs.gnu.org; Fri, 19 May 2017 20:55:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33841) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBsfm-0001Ho-0m for bug-gnu-emacs@gnu.org; Fri, 19 May 2017 20:55:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dBsfj-0000dI-14 for bug-gnu-emacs@gnu.org; Fri, 19 May 2017 20:55:10 -0400 Received: from [195.159.176.226] (port=54615 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dBsfi-0000ck-R6 for bug-gnu-emacs@gnu.org; Fri, 19 May 2017 20:55:06 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dBsfU-0002RG-DR for bug-gnu-emacs@gnu.org; Sat, 20 May 2017 02:54:52 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: Howard Melman Subject: Re: bug#26712: other-window/frame versions of find-library Date: Fri, 19 May 2017 20:54:50 -0400 Lines: 8 Message-ID: References: <8897133a-0836-23a6-6bbe-aecc6ec8b7c8@aurox.ch> <9b566259-457c-faf2-10e1-42c084afccea@aurox.ch> <83tw4k61bv.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@blaine.gmane.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (darwin) Cancel-Lock: sha1:xn6yOegTIUF7afLxWpZn38jDVbg= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.8 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.8 (----) I didn't see this in the patch, but can I suggest that find-function-setup-keys bind these new commands (and find-library) to "C-x L", "C-x 4 L" and "C-x 5 L"? -- Howard From debbugs-submit-bounces@debbugs.gnu.org Fri May 19 22:04:17 2017 Received: (at 26712) by debbugs.gnu.org; 20 May 2017 02:04:17 +0000 Received: from localhost ([127.0.0.1]:55822 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dBtkf-0007k0-9h for submit@debbugs.gnu.org; Fri, 19 May 2017 22:04:17 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:24980) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dBtke-0007jo-7c for 26712@debbugs.gnu.org; Fri, 19 May 2017 22:04:16 -0400 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v4K249FU028886 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 20 May 2017 02:04:10 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v4K249Xm011261 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 20 May 2017 02:04:09 GMT Received: from abhmp0016.oracle.com (abhmp0016.oracle.com [141.146.116.22]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v4K248Og005439; Sat, 20 May 2017 02:04:08 GMT MIME-Version: 1.0 Message-ID: <414c4bc6-0a61-4036-be73-a7262c267bb6@default> Date: Fri, 19 May 2017 19:04:07 -0700 (PDT) From: Drew Adams To: Howard Melman , 26712@debbugs.gnu.org Subject: RE: bug#26712: other-window/frame versions of find-library References: <8897133a-0836-23a6-6bbe-aecc6ec8b7c8@aurox.ch> <9b566259-457c-faf2-10e1-42c084afccea@aurox.ch> <83tw4k61bv.fsf@gnu.org> In-Reply-To: X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9.1 (1003210) [OL 12.0.6767.5000 (x86)] Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Source-IP: userv0021.oracle.com [156.151.31.71] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 26712 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) > I didn't see this in the patch, but can I suggest that > find-function-setup-keys bind these new commands (and find-library) to "C= -x > L", "C-x 4 L" and "C-x 5 L"? +1. But personally I'd prefer lowercase `l', not `L'. I almost _never_ use `count-lines-page', and I use `find-library-other-window' several times a day. And I'm probably one of the few people who actually does use page commands. That's just not that useful a command, for me.) FWIW, I suggsested in my original request for this, years ago, that we use `C-x 4 l' for other-window. I've been using that for years. (I use non-nil `pop-up-frames', so I `other-window' acts like other-frame.) From debbugs-submit-bounces@debbugs.gnu.org Fri May 19 23:24:23 2017 Received: (at submit) by debbugs.gnu.org; 20 May 2017 03:24:24 +0000 Received: from localhost ([127.0.0.1]:55837 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dBv0B-0002r2-MI for submit@debbugs.gnu.org; Fri, 19 May 2017 23:24:23 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36157) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dBv0A-0002qq-7g for submit@debbugs.gnu.org; Fri, 19 May 2017 23:24:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dBv04-0000Nj-2A for submit@debbugs.gnu.org; Fri, 19 May 2017 23:24:16 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:53117) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dBv03-0000Ne-VC for submit@debbugs.gnu.org; Fri, 19 May 2017 23:24:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55336) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dBv02-0002tQ-QI for bug-gnu-emacs@gnu.org; Fri, 19 May 2017 23:24:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dBuzy-0000Mj-CZ for bug-gnu-emacs@gnu.org; Fri, 19 May 2017 23:24:14 -0400 Received: from [195.159.176.226] (port=45185 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dBuzy-0000Ly-5b for bug-gnu-emacs@gnu.org; Fri, 19 May 2017 23:24:10 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dBuzq-0000WY-GD for bug-gnu-emacs@gnu.org; Sat, 20 May 2017 05:24:02 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: Howard Melman Subject: Re: bug#26712: other-window/frame versions of find-library Date: Fri, 19 May 2017 23:24:01 -0400 Lines: 25 Message-ID: References: <8897133a-0836-23a6-6bbe-aecc6ec8b7c8@aurox.ch> <9b566259-457c-faf2-10e1-42c084afccea@aurox.ch> <83tw4k61bv.fsf@gnu.org> <414c4bc6-0a61-4036-be73-a7262c267bb6@default> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@blaine.gmane.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (darwin) Cancel-Lock: sha1:CcEEZrVp3plm/O0wwkaevTKLGTI= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.8 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.8 (----) Drew Adams writes: >> I didn't see this in the patch, but can I suggest that >> find-function-setup-keys bind these new commands (and find-library) to "C-x >> L", "C-x 4 L" and "C-x 5 L"? > > +1. But personally I'd prefer lowercase `l', not `L'. I almost > _never_ use `count-lines-page', and I use `find-library-other-window' > several times a day. And I'm probably one of the few people who > actually does use page commands. That's just not that useful a > command, for me.) > > FWIW, I suggsested in my original request for this, years ago, that > we use `C-x 4 l' for other-window. I've been using that for years. > (I use non-nil `pop-up-frames', so I `other-window' acts like > other-frame.) I suggested L because it matches with the other bindings in find-function-setup-keys and I'll remember them better if all are on upppercase letters rather than some on upper and some on lowercase. -- Howard From debbugs-submit-bounces@debbugs.gnu.org Sat May 20 07:47:48 2017 Received: (at 26712-done) by debbugs.gnu.org; 20 May 2017 11:47:48 +0000 Received: from localhost ([127.0.0.1]:56077 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dC2rM-0007mz-F3 for submit@debbugs.gnu.org; Sat, 20 May 2017 07:47:48 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36561) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dC2rL-0007mo-DC for 26712-done@debbugs.gnu.org; Sat, 20 May 2017 07:47:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dC2rC-0004sb-MD for 26712-done@debbugs.gnu.org; Sat, 20 May 2017 07:47:42 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:47612) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dC2rC-0004sS-J8; Sat, 20 May 2017 07:47:38 -0400 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:1767 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dC2rB-0003eW-Ny; Sat, 20 May 2017 07:47:38 -0400 Date: Sat, 20 May 2017 14:47:19 +0300 Message-Id: <83bmqnpx6g.fsf@gnu.org> From: Eli Zaretskii To: "Charles A. Roelli" In-reply-to: (charles@aurox.ch) Subject: Re: bug#26712: other-window/frame versions of find-library References: <8897133a-0836-23a6-6bbe-aecc6ec8b7c8@aurox.ch> <9b566259-457c-faf2-10e1-42c084afccea@aurox.ch> <83tw4k61bv.fsf@gnu.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 26712-done Cc: p.stephani2@gmail.com, 26712-done@debbugs.gnu.org, drew.adams@oracle.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Eli Zaretskii Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) > Cc: drew.adams@oracle.com, p.stephani2@gmail.com, 26712@debbugs.gnu.org > From: "Charles A. Roelli" > Date: Wed, 17 May 2017 21:16:57 +0200 > > Thank you for your comments. Please see again the attachment. Thanks, pushed. A couple of nits for the future: . etc/NEWS changes should be mentioned in the commit log. . If the patches were posted as a bug report, please mention the bug number in the log message. . We prefer quoting symbol names 'like this', not `like this'. From debbugs-submit-bounces@debbugs.gnu.org Sat May 20 23:23:34 2017 Received: (at 26712) by debbugs.gnu.org; 21 May 2017 03:23:34 +0000 Received: from localhost ([127.0.0.1]:57576 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCHSu-0006qw-FO for submit@debbugs.gnu.org; Sat, 20 May 2017 23:23:32 -0400 Received: from eggs.gnu.org ([208.118.235.92]:55241) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCHSr-0006qg-Dm for 26712@debbugs.gnu.org; Sat, 20 May 2017 23:23:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dCHSl-0004De-B5 for 26712@debbugs.gnu.org; Sat, 20 May 2017 23:23:24 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:56853) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dCHSk-0004D4-1M; Sat, 20 May 2017 23:23:22 -0400 Received: from rms by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1dCHSi-0005q7-R0; Sat, 20 May 2017 23:23:20 -0400 Content-Type: text/plain; charset=Utf-8 From: Richard Stallman To: Howard Melman In-reply-to: (message from Howard Melman on Fri, 19 May 2017 20:54:50 -0400) Subject: Re: bug#26712: other-window/frame versions of find-library References: <8897133a-0836-23a6-6bbe-aecc6ec8b7c8@aurox.ch> <9b566259-457c-faf2-10e1-42c084afccea@aurox.ch> <83tw4k61bv.fsf@gnu.org> Message-Id: Date: Sat, 20 May 2017 23:23:20 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 26712 Cc: 26712@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: rms@gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] I think find-function is more useful to put on a key than find-library. Or perhaps they can be combined. It should not be hard to accept an argument and try it first as a function, then as a library. If the name is both a function and a library, the function definition is almost surely in that library. -- Dr Richard Stallman President, Free Software Foundation (gnu.org, fsf.org) Internet Hall-of-Famer (internethalloffame.org) Skype: No way! See stallman.org/skype.html. From debbugs-submit-bounces@debbugs.gnu.org Mon May 29 15:39:38 2017 Received: (at submit) by debbugs.gnu.org; 29 May 2017 19:39:38 +0000 Received: from localhost ([127.0.0.1]:43777 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dFQVu-0003vJ-AJ for submit@debbugs.gnu.org; Mon, 29 May 2017 15:39:38 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51511) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dFQVt-0003v7-3c for submit@debbugs.gnu.org; Mon, 29 May 2017 15:39:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dFQVm-0002re-GY for submit@debbugs.gnu.org; Mon, 29 May 2017 15:39:31 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:60813) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dFQVm-0002ra-CA for submit@debbugs.gnu.org; Mon, 29 May 2017 15:39:30 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42473) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFQVk-00025W-Hz for bug-gnu-emacs@gnu.org; Mon, 29 May 2017 15:39:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dFQVh-0002qC-C4 for bug-gnu-emacs@gnu.org; Mon, 29 May 2017 15:39:28 -0400 Received: from [195.159.176.226] (port=48255 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dFQVg-0002pg-VI for bug-gnu-emacs@gnu.org; Mon, 29 May 2017 15:39:25 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dFQVY-0003DH-Ob for bug-gnu-emacs@gnu.org; Mon, 29 May 2017 21:39:16 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: "Charles A. Roelli" Subject: Re: bug#26712: other-window/frame versions of find-library Date: Mon, 29 May 2017 21:39:10 +0200 Lines: 185 Message-ID: References: <8897133a-0836-23a6-6bbe-aecc6ec8b7c8@aurox.ch> <9b566259-457c-faf2-10e1-42c084afccea@aurox.ch> <83tw4k61bv.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------5EE484FA2A7C99027B26908A" X-Complaints-To: usenet@blaine.gmane.org User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit Cc: 26712@debbugs.gnu.org, Eli Zaretskii , Drew Adams X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) This is a multi-part message in MIME format. --------------5EE484FA2A7C99027B26908A Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Good idea. Is the attached patch OK? It augments 'C-x F', 'C-x 4 F' and 'C-x 5 F' to suggest library names too. On 21/05/2017 05:23, Richard Stallman wrote: > [[[ To any NSA and FBI agents reading my email: please consider ]]] > [[[ whether defending the US Constitution against all enemies, ]]] > [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > > I think find-function is more useful to put on a key than > find-library. Or perhaps they can be combined. It should not be hard > to accept an argument and try it first as a function, then as a library. > > If the name is both a function and a library, the function definition > is almost surely in that library. > --------------5EE484FA2A7C99027B26908A Content-Type: text/x-patch; name="0001-New-commands-find-function-or-library-other-window-f.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-New-commands-find-function-or-library-other-window-f.pa"; filename*1="tch" >From 0c309fb5ad41d4c8c7e356ef365a02b6550a0e2e Mon Sep 17 00:00:00 2001 From: Charles A. Roelli Date: Mon, 29 May 2017 21:35:24 +0200 Subject: [PATCH] New commands: find-function-or-library (-other-window/-frame) * lisp/emacs-lisp/find-func.el (read-function-or-library-name): New function for reading a function or library name. (find-function-or-library, find-function-or-library-other-window) (find-function-or-library-other-frame): New commands. (find-function-setup-keys): Replace 'find-function' bindings with bindings to 'find-function-or-library'. * etc/NEWS: Mention 'find-function-or-library' and new bindings made by 'find-function-setup-keys'. --- etc/NEWS | 6 +++ lisp/emacs-lisp/find-func.el | 90 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 93 insertions(+), 3 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 60066b7..ee6efb9 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -363,6 +363,12 @@ large integers from being displayed as characters. ** Two new commands for finding the source code of Emacs Lisp libraries: 'find-library-other-window' and 'find-library-other-frame'. +** 'find-function-setup-keys' now binds 'C-x F', 'C-x 4 F' and 'C-x 5 +F' to the new command 'find-function-or-library' and its +other-window/-frame counterparts. The new commands find the Emacs +Lisp source code of a function or library, defaulting to the function +or library closest to point. + * Editing Changes in Emacs 26.1 diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 9b98f05..9943598 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -310,6 +310,40 @@ read-library-name "Library name: ") table nil nil nil nil def))) +(defun read-function-or-library-name () + "Read and return a function or library name, defaulting to the one near point. + +A function name is the name of a symbol that satisfies the +predicate `fboundp'. A library name is the filename of an Emacs +Lisp library located in a directory under `load-path' (or +`find-function-source-path', if non-nil)." + (let* ((dirs (or find-function-source-path load-path)) + (suffixes (find-library-suffixes)) + (table (completion-table-merge + (apply-partially 'completion-table-with-predicate + obarray 'fboundp t) + (apply-partially 'locate-file-completion-table + dirs suffixes))) + (def (if (eq (function-called-at-point) 'require) + ;; `function-called-at-point' may return 'require + ;; with `point' anywhere on this line. So wrap the + ;; `save-excursion' below in a `condition-case' to + ;; avoid reporting a scan-error here. + (condition-case nil + (save-excursion + (backward-up-list) + (forward-char) + (forward-sexp 2) + (thing-at-point 'symbol)) + (error nil)) + (symbol-name (function-called-at-point))))) + (when (and def (not (test-completion def table))) + (setq def nil)) + (completing-read (if def + (format "Function or library name (default %s): " def) + "Function or library name: ") + table nil nil nil nil def))) + ;;;###autoload (defun find-library-other-window (library) "Find the Emacs Lisp source of LIBRARY in another window. @@ -537,6 +571,56 @@ find-function-other-frame (find-function-do-it function nil 'switch-to-buffer-other-frame)) ;;;###autoload +(defun find-function-or-library (function-or-library) + "Find the definition of the FUNCTION-OR-LIBRARY near point. + +Finds the source file containing the definition of the +function (selected by `function-called-at-point') or +library (loaded with `require') near point in a buffer and places +point before the definition. + +FUNCTION-OR-LIBRARY is searched for in +`find-function-source-path', if non-nil, otherwise in +`load-path'. See also `find-function-recenter-line' and +`find-function-after-hook'. + +If FUNCTION-OR-LIBRARY names both a function and a library, finds +the corresponding function definition." + (interactive (list (read-function-or-library-name))) + (let ((sym (if (stringp function-or-library) + (intern function-or-library) + function-or-library))) + (if (fboundp sym) + (find-function-do-it sym nil 'switch-to-buffer) + (find-library function-or-library)))) + +;;;###autoload +(defun find-function-or-library-other-window (function-or-library) + "Find, in another window, the definition of FUNCTION-OR-LIBRARY near point. + +See `find-function' for more details." + (interactive (list (read-function-or-library-name))) + (let ((sym (if (stringp function-or-library) + (intern function-or-library) + function-or-library))) + (if (fboundp sym) + (find-function-do-it sym nil 'switch-to-buffer-other-window) + (find-library-other-window function-or-library)))) + +;;;###autoload +(defun find-function-or-library-other-frame (function-or-library) + "Find, in another frame, the definition of FUNCTION-OR-LIBRARY near point. + +See `find-function' for more details." + (interactive (list (read-function-or-library-name))) + (let ((sym (if (stringp function-or-library) + (intern function-or-library) + function-or-library))) + (if (fboundp sym) + (find-function-do-it sym nil 'switch-to-buffer-other-frame) + (find-library-other-frame function-or-library)))) + +;;;###autoload (defun find-variable-noselect (variable &optional file) "Return a pair `(BUFFER . POINT)' pointing to the definition of VARIABLE. @@ -691,9 +775,9 @@ find-variable-at-point ;;;###autoload (defun find-function-setup-keys () "Define some key bindings for the find-function family of functions." - (define-key ctl-x-map "F" 'find-function) - (define-key ctl-x-4-map "F" 'find-function-other-window) - (define-key ctl-x-5-map "F" 'find-function-other-frame) + (define-key ctl-x-map "F" 'find-function-or-library) + (define-key ctl-x-4-map "F" 'find-function-or-library-other-window) + (define-key ctl-x-5-map "F" 'find-function-or-library-other-frame) (define-key ctl-x-map "K" 'find-function-on-key) (define-key ctl-x-4-map "K" 'find-function-on-key-other-window) (define-key ctl-x-5-map "K" 'find-function-on-key-other-frame) -- 1.7.4.4 --------------5EE484FA2A7C99027B26908A-- From debbugs-submit-bounces@debbugs.gnu.org Wed May 31 00:23:40 2017 Received: (at 26712) by debbugs.gnu.org; 31 May 2017 04:23:40 +0000 Received: from localhost ([127.0.0.1]:46034 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dFvAa-000655-KL for submit@debbugs.gnu.org; Wed, 31 May 2017 00:23:40 -0400 Received: from eggs.gnu.org ([208.118.235.92]:43271) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dFvAY-00064q-RX for 26712@debbugs.gnu.org; Wed, 31 May 2017 00:23:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dFvAT-0000RV-1v for 26712@debbugs.gnu.org; Wed, 31 May 2017 00:23:33 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:60364) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dFvAB-00009s-QV; Wed, 31 May 2017 00:23:15 -0400 Received: from rms by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1dFvA9-0005kG-KW; Wed, 31 May 2017 00:23:13 -0400 Content-Type: text/plain; charset=Utf-8 From: Richard Stallman To: "Charles A. Roelli" In-reply-to: (charles@aurox.ch) Subject: Re: bug#26712: other-window/frame versions of find-library References: <8897133a-0836-23a6-6bbe-aecc6ec8b7c8@aurox.ch> <9b566259-457c-faf2-10e1-42c084afccea@aurox.ch> <83tw4k61bv.fsf@gnu.org> Message-Id: Date: Wed, 31 May 2017 00:23:13 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 26712 Cc: 26712@debbugs.gnu.org, eliz@gnu.org, hmelman@gmail.com, drew.adams@oracle.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: rms@gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] Your change does what I had in mind. (I haven't checked the code.) But why should we have find-function-setup-keys? Why not make those bindings standard and document them as such? -- Dr Richard Stallman President, Free Software Foundation (gnu.org, fsf.org) Internet Hall-of-Famer (internethalloffame.org) Skype: No way! See stallman.org/skype.html. From debbugs-submit-bounces@debbugs.gnu.org Fri Jun 02 14:39:33 2017 Received: (at 26712) by debbugs.gnu.org; 2 Jun 2017 18:39:33 +0000 Received: from localhost ([127.0.0.1]:51869 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dGrTx-0005XH-NA for submit@debbugs.gnu.org; Fri, 02 Jun 2017 14:39:33 -0400 Received: from sinyavsky.aurox.ch ([37.35.109.145]:60592) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dGrTv-0005X4-OU for 26712@debbugs.gnu.org; Fri, 02 Jun 2017 14:39:32 -0400 Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id EF28A22454 for <26712@debbugs.gnu.org>; Fri, 2 Jun 2017 18:34:49 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= content-transfer-encoding:content-type:content-type:in-reply-to :mime-version:user-agent:date:date:message-id:from:from :references:to:subject:subject; s=dkim; t=1496428488; x= 1497292489; bh=WjARR9eh4DdET2Emjjyq5JegX1zrB7l8gN+T2T3c/c4=; b=m byd3T7yCvt+0qZuTAY2OC0fU+RgVTHkflGaIHiaTDqI1OAhR/f3lBLOEb5UxqvWQ MFYt39lL6GrJrTuWZZVN6ZYqa6sQpOGcWzjegPO6htvykdNrU8SdgNMYHB2acF7Y IMsaojO4th6ZQ2zj6vZkmBfHXVEvXq45SK/Y1yYnxc= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id PmzaYXA8DrfU for <26712@debbugs.gnu.org>; Fri, 2 Jun 2017 18:34:48 +0000 (UTC) Received: from [192.168.1.121] (179.133.105.92.dynamic.wline.res.cust.swisscom.ch [92.105.133.179]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id 293DE22431; Fri, 2 Jun 2017 18:34:46 +0000 (UTC) Subject: Re: bug#26712: other-window/frame versions of find-library To: rms@gnu.org References: <8897133a-0836-23a6-6bbe-aecc6ec8b7c8@aurox.ch> <9b566259-457c-faf2-10e1-42c084afccea@aurox.ch> <83tw4k61bv.fsf@gnu.org> From: "Charles A. Roelli" Message-ID: <4d682786-632d-ccb4-8d7e-945ee0a3b72d@aurox.ch> Date: Fri, 2 Jun 2017 20:39:19 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 26712 Cc: 26712@debbugs.gnu.org, eliz@gnu.org, hmelman@gmail.com, drew.adams@oracle.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Sounds good to me. Where do you think the documentation should go in the Emacs manual? It seems "(emacs) Misc Help" could be ok. On 31/05/2017 06:23, Richard Stallman wrote: > [[[ To any NSA and FBI agents reading my email: please consider ]]] > [[[ whether defending the US Constitution against all enemies, ]]] > [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > > Your change does what I had in mind. (I haven't checked the code.) > > But why should we have find-function-setup-keys? > Why not make those bindings standard and document them as such? > From debbugs-submit-bounces@debbugs.gnu.org Sat Jun 03 22:55:00 2017 Received: (at 26712) by debbugs.gnu.org; 4 Jun 2017 02:55:00 +0000 Received: from localhost ([127.0.0.1]:54448 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dHLgy-0002Ks-1l for submit@debbugs.gnu.org; Sat, 03 Jun 2017 22:55:00 -0400 Received: from eggs.gnu.org ([208.118.235.92]:55544) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dHLgw-0002Ke-1g for 26712@debbugs.gnu.org; Sat, 03 Jun 2017 22:54:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dHLgq-00078o-8B for 26712@debbugs.gnu.org; Sat, 03 Jun 2017 22:54:53 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:50271) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dHLgb-0006qd-F7; Sat, 03 Jun 2017 22:54:37 -0400 Received: from rms by fencepost.gnu.org with local (Exim 4.82) (envelope-from ) id 1dHLga-0003dU-O9; Sat, 03 Jun 2017 22:54:36 -0400 Content-Type: text/plain; charset=Utf-8 From: Richard Stallman To: "Charles A. Roelli" In-reply-to: <4d682786-632d-ccb4-8d7e-945ee0a3b72d@aurox.ch> (charles@aurox.ch) Subject: Re: bug#26712: other-window/frame versions of find-library References: <8897133a-0836-23a6-6bbe-aecc6ec8b7c8@aurox.ch> <9b566259-457c-faf2-10e1-42c084afccea@aurox.ch> <83tw4k61bv.fsf@gnu.org> <4d682786-632d-ccb4-8d7e-945ee0a3b72d@aurox.ch> Message-Id: Date: Sat, 03 Jun 2017 22:54:36 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 26712 Cc: 26712@debbugs.gnu.org, hmelman@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: rms@gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > It seems "(emacs) Misc Help" could be ok. I agree. -- Dr Richard Stallman President, Free Software Foundation (gnu.org, fsf.org) Internet Hall-of-Famer (internethalloffame.org) Skype: No way! See stallman.org/skype.html. From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 11 06:45:00 2017 Received: (at 26712) by debbugs.gnu.org; 11 Jun 2017 10:45:00 +0000 Received: from localhost ([127.0.0.1]:39788 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dK0Md-0008Pz-Qp for submit@debbugs.gnu.org; Sun, 11 Jun 2017 06:45:00 -0400 Received: from sinyavsky.aurox.ch ([37.35.109.145]:38637) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dK0Mb-0008Pl-A1 for 26712@debbugs.gnu.org; Sun, 11 Jun 2017 06:44:58 -0400 Received: from sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) by sinyavsky.aurox.ch (Postfix) with ESMTP id D488522466 for <26712@debbugs.gnu.org>; Sun, 11 Jun 2017 10:40:08 +0000 (UTC) Authentication-Results: sinyavsky.aurox.ch (amavisd-new); dkim=pass (1024-bit key) reason="pass (just generated, assumed good)" header.d=aurox.ch DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aurox.ch; h= content-type:content-type:in-reply-to:mime-version:user-agent :date:date:message-id:from:from:references:to:subject:subject; s=dkim; t=1497177605; x=1498041606; bh=X907C9NPpQW30GS5W9p+U5rH OHdZ7JaAGg1+h4qlej4=; b=Z3KjzQ900QuAuixZBBCj2ddj1dWigCwkUYEAsMHA idpe/d4Jhof7zTbum6Pf3zCi6Ch7BCpPHMcJuXiLc0AHgOyNCTg2DPYwnRBVK57/ OQrQPHrZrefcv40LV9TZsacmRzhnhLMIyUnZUpiC1JGU/1EJzVaCWAS5EiQcW6Nx j4A= X-Virus-Scanned: Debian amavisd-new at test.virtualizor.com Received: from sinyavsky.aurox.ch ([127.0.0.1]) by sinyavsky.aurox.ch (sinyavsky.aurox.ch [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id UtcCcMAQU_pY for <26712@debbugs.gnu.org>; Sun, 11 Jun 2017 10:40:05 +0000 (UTC) Received: from [192.168.1.121] (125.85.192.178.dynamic.wline.res.cust.swisscom.ch [178.192.85.125]) by sinyavsky.aurox.ch (Postfix) with ESMTPSA id 6899622454; Sun, 11 Jun 2017 10:40:01 +0000 (UTC) Subject: Re: bug#26712: other-window/frame versions of find-library To: rms@gnu.org References: <8897133a-0836-23a6-6bbe-aecc6ec8b7c8@aurox.ch> <9b566259-457c-faf2-10e1-42c084afccea@aurox.ch> <83tw4k61bv.fsf@gnu.org> <4d682786-632d-ccb4-8d7e-945ee0a3b72d@aurox.ch> From: "Charles A. Roelli" Message-ID: <154f2a17-6f0c-2f2d-fbb2-7ff97fcb2ea9@aurox.ch> Date: Sun, 11 Jun 2017 12:44:56 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------8A5EBEF01C0EE208E06F6DBB" X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 26712 Cc: 26712@debbugs.gnu.org, Eli Zaretskii , hmelman@gmail.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) This is a multi-part message in MIME format. --------------8A5EBEF01C0EE208E06F6DBB Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Please see the attached two patches. The first implements 'find-function-or-library' (what I sent previously). The second patch makes the 'find-function-setup-keys' bindings by default, and they're documented in the manual. On 04/06/2017 04:54, Richard Stallman wrote: > [[[ To any NSA and FBI agents reading my email: please consider ]]] > [[[ whether defending the US Constitution against all enemies, ]]] > [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > > > It seems "(emacs) Misc Help" could be ok. > > I agree. > --------------8A5EBEF01C0EE208E06F6DBB Content-Type: text/x-patch; name="0001-New-commands-find-function-or-library-other-window-f.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-New-commands-find-function-or-library-other-window-f.pa"; filename*1="tch" >From f21249122162835e1d22ca72fec6212944328859 Mon Sep 17 00:00:00 2001 From: Charles A. Roelli Date: Mon, 29 May 2017 21:35:24 +0200 Subject: [PATCH 1/2] New commands: find-function-or-library (-other-window/-frame) * lisp/emacs-lisp/find-func.el (read-function-or-library-name): New function for reading a function or library name. (find-function-or-library, find-function-or-library-other-window) (find-function-or-library-other-frame): New commands. (find-function-setup-keys): Replace 'find-function' bindings with bindings to 'find-function-or-library'. * etc/NEWS: Mention 'find-function-or-library' and new bindings made by 'find-function-setup-keys'. --- etc/NEWS | 7 +++- lisp/emacs-lisp/find-func.el | 90 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 93 insertions(+), 4 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 7972511..6ed668c 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -364,13 +364,18 @@ large integers from being displayed as characters. ** Two new commands for finding the source code of Emacs Lisp libraries: 'find-library-other-window' and 'find-library-other-frame'. -+++ ** The new variable 'display-raw-bytes-as-hex' allows to change the display of raw bytes from octal to hex. ** You can now provide explicit field numbers in format specifiers. For example, '(format "%2$s %1$s" "X" "Y")' produces "Y X". +** 'find-function-setup-keys' now binds 'C-x F', 'C-x 4 F' and 'C-x 5 +F' to the new command 'find-function-or-library' and its +other-window/-frame counterparts. The new commands find the Emacs +Lisp source code of a function or library, defaulting to the function +or library closest to point. + * Editing Changes in Emacs 26.1 diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 9b98f05..9943598 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -310,6 +310,40 @@ read-library-name "Library name: ") table nil nil nil nil def))) +(defun read-function-or-library-name () + "Read and return a function or library name, defaulting to the one near point. + +A function name is the name of a symbol that satisfies the +predicate `fboundp'. A library name is the filename of an Emacs +Lisp library located in a directory under `load-path' (or +`find-function-source-path', if non-nil)." + (let* ((dirs (or find-function-source-path load-path)) + (suffixes (find-library-suffixes)) + (table (completion-table-merge + (apply-partially 'completion-table-with-predicate + obarray 'fboundp t) + (apply-partially 'locate-file-completion-table + dirs suffixes))) + (def (if (eq (function-called-at-point) 'require) + ;; `function-called-at-point' may return 'require + ;; with `point' anywhere on this line. So wrap the + ;; `save-excursion' below in a `condition-case' to + ;; avoid reporting a scan-error here. + (condition-case nil + (save-excursion + (backward-up-list) + (forward-char) + (forward-sexp 2) + (thing-at-point 'symbol)) + (error nil)) + (symbol-name (function-called-at-point))))) + (when (and def (not (test-completion def table))) + (setq def nil)) + (completing-read (if def + (format "Function or library name (default %s): " def) + "Function or library name: ") + table nil nil nil nil def))) + ;;;###autoload (defun find-library-other-window (library) "Find the Emacs Lisp source of LIBRARY in another window. @@ -537,6 +571,56 @@ find-function-other-frame (find-function-do-it function nil 'switch-to-buffer-other-frame)) ;;;###autoload +(defun find-function-or-library (function-or-library) + "Find the definition of the FUNCTION-OR-LIBRARY near point. + +Finds the source file containing the definition of the +function (selected by `function-called-at-point') or +library (loaded with `require') near point in a buffer and places +point before the definition. + +FUNCTION-OR-LIBRARY is searched for in +`find-function-source-path', if non-nil, otherwise in +`load-path'. See also `find-function-recenter-line' and +`find-function-after-hook'. + +If FUNCTION-OR-LIBRARY names both a function and a library, finds +the corresponding function definition." + (interactive (list (read-function-or-library-name))) + (let ((sym (if (stringp function-or-library) + (intern function-or-library) + function-or-library))) + (if (fboundp sym) + (find-function-do-it sym nil 'switch-to-buffer) + (find-library function-or-library)))) + +;;;###autoload +(defun find-function-or-library-other-window (function-or-library) + "Find, in another window, the definition of FUNCTION-OR-LIBRARY near point. + +See `find-function' for more details." + (interactive (list (read-function-or-library-name))) + (let ((sym (if (stringp function-or-library) + (intern function-or-library) + function-or-library))) + (if (fboundp sym) + (find-function-do-it sym nil 'switch-to-buffer-other-window) + (find-library-other-window function-or-library)))) + +;;;###autoload +(defun find-function-or-library-other-frame (function-or-library) + "Find, in another frame, the definition of FUNCTION-OR-LIBRARY near point. + +See `find-function' for more details." + (interactive (list (read-function-or-library-name))) + (let ((sym (if (stringp function-or-library) + (intern function-or-library) + function-or-library))) + (if (fboundp sym) + (find-function-do-it sym nil 'switch-to-buffer-other-frame) + (find-library-other-frame function-or-library)))) + +;;;###autoload (defun find-variable-noselect (variable &optional file) "Return a pair `(BUFFER . POINT)' pointing to the definition of VARIABLE. @@ -691,9 +775,9 @@ find-variable-at-point ;;;###autoload (defun find-function-setup-keys () "Define some key bindings for the find-function family of functions." - (define-key ctl-x-map "F" 'find-function) - (define-key ctl-x-4-map "F" 'find-function-other-window) - (define-key ctl-x-5-map "F" 'find-function-other-frame) + (define-key ctl-x-map "F" 'find-function-or-library) + (define-key ctl-x-4-map "F" 'find-function-or-library-other-window) + (define-key ctl-x-5-map "F" 'find-function-or-library-other-frame) (define-key ctl-x-map "K" 'find-function-on-key) (define-key ctl-x-4-map "K" 'find-function-on-key-other-window) (define-key ctl-x-5-map "K" 'find-function-on-key-other-frame) -- 1.7.4.4 --------------8A5EBEF01C0EE208E06F6DBB Content-Type: text/x-patch; name="0002-Make-find-function-setup-keys-bindings-default.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0002-Make-find-function-setup-keys-bindings-default.patch" >From ec6d7c242f7d19bfcaa760e9a991e83244f44974 Mon Sep 17 00:00:00 2001 From: Charles A. Roelli Date: Sun, 4 Jun 2017 11:56:58 +0200 Subject: [PATCH 2/2] Make 'find-function-setup-keys' bindings default * etc/NEWS: Mention the default bindings that were formerly made by 'find-function-setup-keys'. Remove a previous entry that has been superceded by the recent addition of 'find-library-other-window'. * doc/emacs/help.texi (Misc Help): Document the new bindings. * lisp/bindings.el: Add bindings formerly made by 'find-function-setup-keys': 'C-x F', 'C-x K', 'C-x V' and 'C-x 4'/'C-x 5' variants. * lisp/find-func.el (find-function-setup-keys): Alias to #'ignore, and make it obsolete. --- doc/emacs/help.texi | 49 ++++++++++++++++++++++++++++++++++++++++++ etc/NEWS | 17 ++++++------- lisp/bindings.el | 11 +++++++++ lisp/emacs-lisp/find-func.el | 14 ++--------- 4 files changed, 71 insertions(+), 20 deletions(-) diff --git a/doc/emacs/help.texi b/doc/emacs/help.texi index 548ca6a..74a06f5 100644 --- a/doc/emacs/help.texi +++ b/doc/emacs/help.texi @@ -588,6 +588,55 @@ Misc Help which marks a defun. However, @kbd{@key{ESC} @key{F1}} and @kbd{@key{ESC} ?} work fine.) +@kindex C-x F +@findex find-function-or-library +@kindex C-x 4 F +@findex find-function-or-library-other-window +@kindex C-x 5 F +@findex find-function-or-library-other-frame +@kindex C-x K +@findex find-function-on-key +@kindex C-x 4 K +@findex find-function-on-key-other-window +@kindex C-x 5 K +@findex find-function-on-key-other-frame +@kindex C-x V +@findex find-variable +@kindex C-x 4 V +@findex find-variable-other-window +@kindex C-x 5 V +@findex find-variable-other-frame + When reading or writing Emacs Lisp code, it is often helpful to +visit the source of other Emacs Lisp functions, libraries and +variables. The following commands are helpful for doing that: + +@table @kbd +@item C-x F +Find a function or library, with the function or library closest to +point as a suggestion (@code{find-function-or-library}). +@item C-x 4 F +Idem., in another window +(@code{find-function-or-library-other-window}). +@item C-x 5 F +Idem., in another frame (@code{find-function-or-library-other-frame}). +@item C-x K +Find a function on a given key, which you type interactively +(@code{find-function-on-key}). +@item C-x 4 K +Idem., in another window +(@code{find-function-on-key-other-window}). +@item C-x 5 K +Idem., in another frame (@code{find-function-on-key-other-frame}). +@item C-x V +Find a variable, with the variable closest to point as a suggestion +(@code{find-variable}). +@item C-x 4 V +Idem., in another window +(@code{find-variable-other-window}). +@item C-x 5 V +Idem., in another frame (@code{find-variable-other-frame}). +@end table + @node Help Files @section Help Files diff --git a/etc/NEWS b/etc/NEWS index 6ed668c..2b31cc0 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -211,10 +211,6 @@ face instead of the 'escape-glyph' face. part of minibuffers. --- -** 'find-library' now takes a prefix argument to pop to a different -window. - ---- ** 'process-attributes' on Darwin systems now returns more information. +++ @@ -370,11 +366,14 @@ display of raw bytes from octal to hex. ** You can now provide explicit field numbers in format specifiers. For example, '(format "%2$s %1$s" "X" "Y")' produces "Y X". -** 'find-function-setup-keys' now binds 'C-x F', 'C-x 4 F' and 'C-x 5 -F' to the new command 'find-function-or-library' and its -other-window/-frame counterparts. The new commands find the Emacs -Lisp source code of a function or library, defaulting to the function -or library closest to point. +** 'C-x F', 'C-x 4 F' and 'C-x 5 F' are bound to the new command +'find-function-or-library' and its other-window/-frame counterparts. +The new commands find the Emacs Lisp source code of a function or +library, defaulting to the function or library closest to point. 'C-x +K' and 'C-x V' are bound to 'find-function-on-key' and +'find-variable', with equivalent other-window/-frame commands in the +'C-x 4' and 'C-x 5' keymaps. These were formerly bound by the +function 'find-function-setup-keys', which is now obsolete. * Editing Changes in Emacs 26.1 diff --git a/lisp/bindings.el b/lisp/bindings.el index 0994b71..4807b57 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -1325,6 +1325,17 @@ esc-map (define-key ctl-x-4-map "a" 'add-change-log-entry-other-window) (define-key ctl-x-4-map "c" 'clone-indirect-buffer-other-window) +;; from emacs-lisp/find-func.el +(define-key ctl-x-map "F" 'find-function-or-library) +(define-key ctl-x-4-map "F" 'find-function-or-library-other-window) +(define-key ctl-x-5-map "F" 'find-function-or-library-other-frame) +(define-key ctl-x-map "K" 'find-function-on-key) +(define-key ctl-x-4-map "K" 'find-function-on-key-other-window) +(define-key ctl-x-5-map "K" 'find-function-on-key-other-frame) +(define-key ctl-x-map "V" 'find-variable) +(define-key ctl-x-4-map "V" 'find-variable-other-window) +(define-key ctl-x-5-map "V" 'find-variable-other-frame) + ;; Signal handlers (define-key special-event-map [sigusr1] 'ignore) (define-key special-event-map [sigusr2] 'ignore) diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el index 9943598..c08df49 100644 --- a/lisp/emacs-lisp/find-func.el +++ b/lisp/emacs-lisp/find-func.el @@ -773,17 +773,9 @@ find-variable-at-point (find-variable-other-window symb)))) ;;;###autoload -(defun find-function-setup-keys () - "Define some key bindings for the find-function family of functions." - (define-key ctl-x-map "F" 'find-function-or-library) - (define-key ctl-x-4-map "F" 'find-function-or-library-other-window) - (define-key ctl-x-5-map "F" 'find-function-or-library-other-frame) - (define-key ctl-x-map "K" 'find-function-on-key) - (define-key ctl-x-4-map "K" 'find-function-on-key-other-window) - (define-key ctl-x-5-map "K" 'find-function-on-key-other-frame) - (define-key ctl-x-map "V" 'find-variable) - (define-key ctl-x-4-map "V" 'find-variable-other-window) - (define-key ctl-x-5-map "V" 'find-variable-other-frame)) +(defalias 'find-function-setup-keys 'ignore) +(make-obsolete 'find-function-setup-keys + "commands from `find-func' are bound by default." "26.1") (provide 'find-func) -- 1.7.4.4 --------------8A5EBEF01C0EE208E06F6DBB-- From unknown Sat Sep 06 11:13:02 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 09 Jul 2017 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator