all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Felipe Ochoa <felipe.nospam.ochoa@gmail.com>
To: 30888@debbugs.gnu.org
Subject: bug#30888: Allow searching compressed C sources for `find-function'
Date: Tue, 20 Mar 2018 16:40:50 -0500	[thread overview]
Message-ID: <878tams9wd.fsf@inc-query.com> (raw)

This patch makes the handling of compressed sources consistent between C
functions and lisp functions (for which `find-function' already supports
compression).

From 3fd28dd1682f9e7a723cc7cbaeaad10da63989cd Mon Sep 17 00:00:00 2001
From: Felipe Ochoa <felipe.nospam.ochoa@gmail.com>
Date: Tue, 20 Mar 2018 16:26:25 -0500
Subject: [PATCH] Allow searching compressed C sources for `find-function'

From: felipe <felipe@fov.space>

* emacs-lisp/find-func.el (find-function-C-source)
---
 lisp/emacs-lisp/find-func.el | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index 300bfab..cc1af01 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -243,14 +243,14 @@ find-function-advised-original
 (defun find-function-C-source (fun-or-var file type)
   "Find the source location where FUN-OR-VAR is defined in FILE.
 TYPE should be nil to find a function, or `defvar' to find a variable."
-  (let ((dir (or find-function-C-source-directory
-                 (read-directory-name "Emacs C source dir: " nil nil t))))
-    (setq file (expand-file-name file dir))
-    (if (file-readable-p file)
+  (let* ((dir (or find-function-C-source-directory
+                  (read-directory-name "Emacs C source dir: " nil nil t)))
+         (full-name (locate-file file (list dir) load-file-rep-suffixes)))
+    (if full-name
         (if (null find-function-C-source-directory)
             (setq find-function-C-source-directory dir))
-      (error "The C source file %s is not available"
-             (file-name-nondirectory file))))
+      (error "The C source file %s is not available" file))
+    (setq file full-name))
   (unless type
     ;; Either or both an alias and its target might be advised.
     (setq fun-or-var (find-function-advised-original
-- 
2.7.4








             reply	other threads:[~2018-03-20 21:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-20 21:40 Felipe Ochoa [this message]
2019-06-24 18:50 ` bug#30888: Allow searching compressed C sources for `find-function' Lars Ingebrigtsen
2019-09-16 23:17   ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878tams9wd.fsf@inc-query.com \
    --to=felipe.nospam.ochoa@gmail.com \
    --cc=30888@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.