From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Omar Polo Newsgroups: gmane.emacs.help Subject: Re: The convenient method to check/inspect/retrieve the definition/usage of any commands/symbols/operators used in elisp code. Date: Sat, 19 Jun 2021 17:57:32 +0200 Message-ID: <87pmwhg843.fsf@omarpolo.com> References: <87sg1dgbbk.fsf@omarpolo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18769"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.4.15; emacs 28.0.50 Cc: help-gnu-emacs To: Hongyi Zhao Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 19 17:58:08 2021 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ludMF-0004iq-UD for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 19 Jun 2021 17:58:07 +0200 Original-Received: from localhost ([::1]:53952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ludMF-0000f2-0l for geh-help-gnu-emacs@m.gmane-mx.org; Sat, 19 Jun 2021 11:58:07 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:43824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ludLv-0000ep-3E for help-gnu-emacs@gnu.org; Sat, 19 Jun 2021 11:57:47 -0400 Original-Received: from mail.omarpolo.com ([144.91.116.244]:62466) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ludLs-0000tt-O9 for help-gnu-emacs@gnu.org; Sat, 19 Jun 2021 11:57:46 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=omarpolo.com; s=20200327; t=1624118257; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gNXKUlwDKjin1gfI0O+F7VEMiThOoDpE+uQPIcvU6jk=; b=jtvw2dyUdnT+ZzLdudWbnav+FkOZd9YcVjvLiQ9XeFef5IuB4F63iO9qe8RsXqUQnsCi+B CEM6CAuF1lN3X2Sa2S6tBNRkopsHuQCJj9CcZcfg7tHr1r+AeeeNxCW9WG/5aBj2VKlASZ ew5Ga73/e/moHdS9+Zf5myrWbKYIpz8= Original-Received: from localhost (host-79-16-11-173.retail.telecomitalia.it [79.16.11.173]) by mail.omarpolo.com (OpenSMTPD) with ESMTPSA id 9cb50070 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Sat, 19 Jun 2021 17:57:34 +0200 (CEST) Original-Received: from venera (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 2bb4a23a; Sat, 19 Jun 2021 17:57:32 +0200 (CEST) In-reply-to: Received-SPF: pass client-ip=144.91.116.244; envelope-from=op@omarpolo.com; helo=mail.omarpolo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:131020 Archived-At: Hongyi Zhao writes: > On Sat, Jun 19, 2021 at 10:48 PM Omar Polo wrote: >> >> >> Hongyi Zhao writes: >> >> > Dear all, >> > >> > Are there any built-in method of Emacs which can let me conveniently >> > check/inspect/retrieve the definition/usage of any >> > commands/symbols/operators used in elisp code at-the-point/in-situ? >> > Say, for the following code snippets: >> > >> > ;;; >> > (defun fk/company-wordfreq-toggle-language (&optional language) >> > (interactive) >> > (setq ispell-local-dictionary (or language >> > (if (string=3D >> > ispell-local-dictionary "english") >> > "turkish" >> > "english"))) >> > [...] >> > `(progn >> > ,@(mapcar (lambda (p) `(use-package ,p)) >> > packages))) >> > >> > (use-multiple-packages flycheck >> > dash >> > ) >> > >> > [...] >> > (mapcar #'straight-use-package '(flycheck lsp-mode dash ...)) >> > >> > ;or equivalently >> > >> > (defvar my-package-list '(flycheck lsp-mode dash ...)) >> > (mapcar #'straight-use-package my-package-list) >> > ;;; >> > >> > I want to find some convenient methods built in Emacs itself with an >> > in-situ manner - by moving the point to the interest position - to >> > check any commands/symbols/operators used in them. >> > >> > Regards >> >> there is M-. (xref-find-definitions) that will jump to the definition of >> the symbol at point (at least in emacs lisp buffers), > > Thank you very much. But still there are some symbols can't find with > this method, say, #' ,@ ' and so on. #' ' ` , and ,@ aren't symbols, they are reader macros, i.e. special character sequences that the lisp reader expands into some special constructs. For instance, #'foo is the same as (function 'foo) and 'foo the same as (quote foo). If you M-. with the point over quote (in an elisp buffer) it should jump to eval.c (assuming you have the C source files available). >> and M-, (xref-pop-marker-stack) to jump back. > > I use scratch buffer to test, and it can't jump back there. M-, is meant to be used after one or more M-. For instance: 1. in *scratch* type describe-function 2. press M-. -- it'll jump to help-fns.el.gz 3. move the point over with-help-window (something like ~10 lines below) 4. M-. again -- it'll jump to a different place in the same file 5. go back with M-, -- now you're back in the definition of describe-function 6. M-, again -- now you're back in the *scratch* buffer >> >> Or you can C-h f or C-h v (describe-function/variable) and then M-n >> (next-history-element) to bring in the symbol at point. > > I meet the following message: M-n is undefined, as shown in the > attached screenshot file. M-n should be defined in some minibuffer maps; with `emacs -Q' I can C-h v C-h k M-n and it tells me that. > M-n runs the command next-history-element (found in > minibuffer-local-must-match-map), which is an interactive compiled > Lisp function in =E2=80=98simple.el=E2=80=99. Cheers, > HY