From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: thibaut.verron@gmail.com Newsgroups: gmane.emacs.help Subject: Re: Generality of defvar Date: Thu, 28 Jul 2022 11:37:35 +0200 Message-ID: <95a861a4-56ab-de04-14a9-e0dbfee57253@gmail.com> References: <87r127h40s.fsf@posteo.net-N7wjq17--3-2> <87pmhqbuoo.fsf@dataswamp.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22872"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 To: Christopher Dimech , carlmarcos@tutanota.com, Emanuel Berg , help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 28 11:43:56 2022 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 1oH03f-0005jH-Qd for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 28 Jul 2022 11:43:55 +0200 Original-Received: from localhost ([::1]:49494 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oH03e-000459-QD for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 28 Jul 2022 05:43:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37772) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oGzxi-00008m-CZ for help-gnu-emacs@gnu.org; Thu, 28 Jul 2022 05:37:47 -0400 Original-Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:41721) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oGzxg-0000gP-PE for help-gnu-emacs@gnu.org; Thu, 28 Jul 2022 05:37:46 -0400 Original-Received: by mail-wr1-x431.google.com with SMTP id q18so1445716wrx.8 for ; Thu, 28 Jul 2022 02:37:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:from:to:subject:references :in-reply-to:content-transfer-encoding; bh=kAh3LoZ1tiFNV6Wq7t+favupjQ3xYRW703nfo3u8ZEs=; b=I1K7LRxMktEZfiv0dXUIMY2XB3B5qxWjuWlx2COiqtMMVme+hPSiPvVeHOGXDmoZr+ n8cknLQjcZjB9WBNs88KR0uFQkX0B2jehXYUDdieHi2lA9D8KYDxMo4lTNNnpFdTiHF7 R236Xbg9d9M24yk4Y2f4qV/qIzRgAGi5gtU10a5o+hOFt8uoSkutRWz29mELGtU3VNZm /SXVgFuYxaJb26hIqQUcaSqb8nm3CSV9Q8Hry/C1a0sCQLyhk1j8Wmi8dFseo4WiN9Kk css7/X19IuISEQqsuT4lsHs6YYAfyWZTJZa5AehGBxySrzmFRvnMN8fw7lzDmHGw7tx3 3X8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:from:to :subject:references:in-reply-to:content-transfer-encoding; bh=kAh3LoZ1tiFNV6Wq7t+favupjQ3xYRW703nfo3u8ZEs=; b=64LGSBpGEFDd9FhoZreUBwetHfrvqJEIomlAzZSrH3RgKHKLcLOZCeqEjBb3wh39Q9 s7JAFCGNgYoRFjyO89Aooe19EMb8VeQVwmA9DaztTJfJKXGoP8WeZIRxYnA3+ynYwKpj sbbyPzInZcSe2p8z4svgseLdFGIVCDMqjJUumiucFWvptekkknxOayaXl+WAF918LblQ 2THqAcEvX1g+i42iDy8e/WrPEkyk+zaGC0ZFN1hdEjdg/ABOHjkH6bdwhuvqUuB78xRh +zC90msFdm4WHD/57p7s5ThkTvnU8fRGXe1crPnxo2t2+37gAlGTfAMHbV6eKFnWuNbm DVtw== X-Gm-Message-State: AJIora9c1TPCl2HnaTjVlb1AAg2iP0AxGCPF45nZbXKbAabKZHIDInRl 5Y6AffzEaj1tRQqLlBJdDBM= X-Google-Smtp-Source: AGRyM1teCB+6oK5LE25q/8F56xVUaLPvCExSV7+OYfjlkoNNycF6CJxWE9JI7IfWL/TwMZmtY0VvKw== X-Received: by 2002:adf:e84b:0:b0:21e:61cd:647e with SMTP id d11-20020adfe84b000000b0021e61cd647emr16972356wrn.715.1659001057056; Thu, 28 Jul 2022 02:37:37 -0700 (PDT) Original-Received: from ?IPV6:2001:628:2010:22:de4d:4a1a:a704:4ee0? ([2001:628:2010:22:de4d:4a1a:a704:4ee0]) by smtp.gmail.com with ESMTPSA id k13-20020adfe8cd000000b0021e3e73dec6sm484082wrn.72.2022.07.28.02.37.35 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Jul 2022 02:37:36 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::431; envelope-from=thibaut.verron@gmail.com; helo=mail-wr1-x431.google.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, FREEMAIL_FROM=0.001, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 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:138655 Archived-At: On 28/07/2022 09:34, Christopher Dimech wrote: > *Sent:* Thursday, July 28, 2022 at 7:06 PM > *From:* "Thibaut Verron" > *To:* "Christopher Dimech" > *Cc:* carlmarcos@tutanota.com, "Emanuel Berg" , > "help-gnu-emacs" > *Subject:* Re: Generality of defvar > Le jeu. 28 juil. 2022 à 08:42, Christopher Dimech > a écrit : > > *Sent:* Thursday, July 28, 2022 at 4:39 AM > *From:* "Thibaut Verron" > > *To:* "Christopher Dimech" > > *Cc:* carlmarcos@tutanota.com , > "Emanuel Berg" >, > "help-gnu-emacs" > > *Subject:* Re: Generality of defvar > Le mer. 27 juil. 2022 à 18:29, Christopher Dimech > a écrit : > > > > > Sent: Thursday, July 28, 2022 at 1:47 AM > > From: "Thibaut Verron" > > > To: carlmarcos@tutanota.com > > Cc: "Emanuel Berg" >, "help-gnu-emacs" > > > > Subject: Re: Generality of defvar > > > > Le mer. 27 juil. 2022 à 15:24, > a écrit : > > > > > > > > Jul 27, 2022, 13:21 by thibaut.verron@gmail.com > : > > > > > > > Le mer. 27 juil. 2022 à 14:52, carlmarcos--- via Users > list for the GNU > > > Emacs text editor <> help-gnu-emacs@gnu.org > > > a écrit : > > > > > > > >> > > > >> > > > >>  Jul 27, 2022, 12:34 by >> incal@dataswamp.org > >> : > > > >> > > > >>  > carlmarcos--- via Users list for the GNU Emacs text > editor wrote: > > > >>  > > > > >>  >> (defun enable-error-diagnostics () > > > >>  >>  "Enable error diagnostics with backtrace buffer. > > > >>  >> One can exit the debugger with the q command." > > > >>  >> > > > >>  > > > > >>  > You can refer to keys in docstrings like this: > > > >>  > > > > >>  >  \\[forward-word] > > > >>  > > > > >>  > That way, it isn't hardcoded so if later > changed/configured > > > >>  > it'll still show the right key. > > > >>  > > > > >>  How can I figure out what key to use in the docstring > for exiting the > > > backtrace buffer? > > > >> > > > > > > > > The function bound to 'q' is quit-window. But since this > function > > > doesn't have a global binding, you need to tell the > docstring to use the > > > appropriate keymap to look the binding up. > > > > > > > > Something like > > > > > > > >   "Enable error diagnostics with backtrace buffer. > > > > > > > > \\ (note: this is the part telling > emacs where to > > > look for the key) > > > > One can exit the debugger with the `quit-window' command > (bound to > > > \\[quit-window])." > > > > > > > > > > > Although quit-window is bound to q, the command > \\[quit-window] just > > > inserts > > > M-x quit-window, rather than q. > > > > > > > Yes, that's precisely because quit-window doesn't have a > global binding. > > You need to add \\ somewhere in the > docstring to tell > > emacs to show bindings for the backtrace buffers, rather than > global > > bindings. > > > > Best wishes, > > Thibaut > > Sounds good advice, but the result could be > > Uses keymap ‘backtrace-mode-map’, which is not currently defined. > > My bad, it should have been debugger-mode-map. > Not quite right yet. > > I guess one should also put (require 'debug) at some point along with > the function definition? > Seems more bother than it solves.  Cannot see how users would be able to > figure all this complication > out. For sure. But it's really a rare situation, and not one that is likely to hit first time users: one has to be writing a function with a docstring, and this docstring has to involve a key bound in a keymap defined in another file, and not loaded by default. Even for users developing their own packages, usually the keymap will be defined in a file loaded at the same time as the function, completely hiding this subtlety. Still, I would almost be tempted to consider this case a bug, and to expect that emacs should autoload debug.el to display the relevant information. Thibaut