all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* xref-find-definitions on obarray
@ 2025-02-03 20:39 Heime via Users list for the GNU Emacs text editor
  2025-02-04 18:27 ` Jean Louis
  0 siblings, 1 reply; 6+ messages in thread
From: Heime via Users list for the GNU Emacs text editor @ 2025-02-03 20:39 UTC (permalink / raw)
  To: Heime via Users list for the GNU Emacs text editor

Have made this interactive function to display the relevant code
for the user entered function or variable name.  But getting 
"Visit Tags Table".

(defun svm-findef ()
  "Quickly navigate code, jumping directly to definitions of
functions or variables by inputting their names with completion."

  (interactive)

  ;; Search in global symbol table OBARRAY
  (let* ( (symbol (completing-read " Name [function, variable]: "
                    obarray
                    (lambda (s) (or (fboundp s) (boundp s)))
                    t)))

    (if (and symbol (not (string-empty-p symbol)))
        (xref-find-definitions symbol)
      (message "No valid symbol entered."))))




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: xref-find-definitions on obarray
  2025-02-03 20:39 xref-find-definitions on obarray Heime via Users list for the GNU Emacs text editor
@ 2025-02-04 18:27 ` Jean Louis
  2025-02-04 18:51   ` Heime via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 6+ messages in thread
From: Jean Louis @ 2025-02-04 18:27 UTC (permalink / raw)
  To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor

* Heime via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org> [2025-02-03 23:41]:
> Have made this interactive function to display the relevant code
> for the user entered function or variable name.  But getting 
> "Visit Tags Table".
> 
(defun svm-findef ()
  "Quickly navigate code, jumping directly to definitions of
functions or variables by inputting their names with completion."

  (interactive)

  ;; Search in global symbol table OBARRAY
  (with-temp-buffer
    (emacs-lisp-mode)
    (let* ( (symbol (completing-read " Name [function, variable]: "
				     obarray
				     (lambda (s) (or (fboundp s) (boundp s)))
				     t)))

      (if (and symbol (not (string-empty-p symbol)))
          (xref-find-definitions symbol)
	(message "No valid symbol entered.")))))

-- 
Jean Louis



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: xref-find-definitions on obarray
  2025-02-04 18:27 ` Jean Louis
@ 2025-02-04 18:51   ` Heime via Users list for the GNU Emacs text editor
  2025-02-05  8:48     ` Jean Louis
  0 siblings, 1 reply; 6+ messages in thread
From: Heime via Users list for the GNU Emacs text editor @ 2025-02-04 18:51 UTC (permalink / raw)
  To: Jean Louis; +Cc: Heime via Users list for the GNU Emacs text editor






Sent with Proton Mail secure email.

On Wednesday, February 5th, 2025 at 6:27 AM, Jean Louis <bugs@gnu.support> wrote:

> * Heime via Users list for the GNU Emacs text editor help-gnu-emacs@gnu.org [2025-02-03 23:41]:
> 
> > Have made this interactive function to display the relevant code
> > for the user entered function or variable name. But getting
> > "Visit Tags Table".
> 
> (defun svm-findef ()
> "Quickly navigate code, jumping directly to definitions of
> functions or variables by inputting their names with completion."
> 
> (interactive)
> 
> ;; Search in global symbol table OBARRAY
> (with-temp-buffer
> (emacs-lisp-mode)
> (let* ( (symbol (completing-read " Name [function, variable]: "
> obarray
> (lambda (s) (or (fboundp s) (boundp s)))
> t)))
> 
> (if (and symbol (not (string-empty-p symbol)))
> (xref-find-definitions symbol)
> (message "No valid symbol entered."))))) -- Jean Louis

As you point out, a buffer is needed to display the result.

If I select a function name from file svm.el, I get the buffer
to be svm.el.  Is this how with-temp-buffer names things?





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: xref-find-definitions on obarray
  2025-02-04 18:51   ` Heime via Users list for the GNU Emacs text editor
@ 2025-02-05  8:48     ` Jean Louis
  2025-02-05 11:56       ` Heime via Users list for the GNU Emacs text editor
  0 siblings, 1 reply; 6+ messages in thread
From: Jean Louis @ 2025-02-05  8:48 UTC (permalink / raw)
  To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor


> As you point out, a buffer is needed to display the result.
> 
> If I select a function name from file svm.el, I get the buffer
> to be svm.el.  Is this how with-temp-buffer names things?

I just observe that emacs-lisp-mode has to be turned on before
anything, so I used temporarily buffer, and it works.

-- 
Jean Louis



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: xref-find-definitions on obarray
  2025-02-05  8:48     ` Jean Louis
@ 2025-02-05 11:56       ` Heime via Users list for the GNU Emacs text editor
  2025-02-06  4:54         ` Jean Louis
  0 siblings, 1 reply; 6+ messages in thread
From: Heime via Users list for the GNU Emacs text editor @ 2025-02-05 11:56 UTC (permalink / raw)
  To: Jean Louis; +Cc: Heime via Users list for the GNU Emacs text editor






Sent with Proton Mail secure email.

On Wednesday, February 5th, 2025 at 8:48 PM, Jean Louis <bugs@gnu.support> wrote:

> > As you point out, a buffer is needed to display the result.
> > 
> > If I select a function name from file svm.el, I get the buffer
> > to be svm.el. Is this how with-temp-buffer names things?
> 
> 
> I just observe that emacs-lisp-mode has to be turned on before
> anything, so I used temporarily buffer, and it works.
> 
> --
> Jean Louis

If I run the thing from the scratch buffer, it does not work
if the temporary buffer is not used.  Wouldn't emacs-lisp-mode
be enabled there?




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: xref-find-definitions on obarray
  2025-02-05 11:56       ` Heime via Users list for the GNU Emacs text editor
@ 2025-02-06  4:54         ` Jean Louis
  0 siblings, 0 replies; 6+ messages in thread
From: Jean Louis @ 2025-02-06  4:54 UTC (permalink / raw)
  To: Heime; +Cc: Heime via Users list for the GNU Emacs text editor

* Heime <heimeborgia@protonmail.com> [2025-02-05 14:57]:
> > I just observe that emacs-lisp-mode has to be turned on before
> > anything, so I used temporarily buffer, and it works.
> > 
> > --
> > Jean Louis
> 
> If I run the thing from the scratch buffer, it does not work
> if the temporary buffer is not used.  Wouldn't emacs-lisp-mode
> be enabled there?

It works on my side in Emacs Lisp buffer, at least I cam press M-. and move to the function.

-- 
Jean Louis



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-02-06  4:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-03 20:39 xref-find-definitions on obarray Heime via Users list for the GNU Emacs text editor
2025-02-04 18:27 ` Jean Louis
2025-02-04 18:51   ` Heime via Users list for the GNU Emacs text editor
2025-02-05  8:48     ` Jean Louis
2025-02-05 11:56       ` Heime via Users list for the GNU Emacs text editor
2025-02-06  4:54         ` Jean Louis

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.