From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Arthur Miller Newsgroups: gmane.emacs.devel Subject: Re: Emacs development... Date: Sat, 21 Aug 2021 16:07:40 +0200 Message-ID: References: <56B1C272-CB13-4793-930C-9F6B96F9856B@traduction-libre.org> <83r1enz453.fsf@gnu.org> <87h7fjuuva.fsf@gnu.org> <351DF59E-BFE0-4CC2-8A40-B4E7CB73D81E@traduction-libre.org> <2281ccca2d439b935535197d931c1ccf41b0f86f.camel@yandex.ru> 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="34483"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Jean-Christophe Helary , Eli Zaretskii , emacs-devel@gnu.org, Tassilo Horn To: Konstantin Kharlamov Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Aug 21 16:08:51 2021 Return-path: Envelope-to: ged-emacs-devel@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 1mHRg1-0008l8-AG for ged-emacs-devel@m.gmane-mx.org; Sat, 21 Aug 2021 16:08:51 +0200 Original-Received: from localhost ([::1]:36402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mHRg0-0006jC-1o for ged-emacs-devel@m.gmane-mx.org; Sat, 21 Aug 2021 10:08:48 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36930) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHRf2-0005bV-4M for emacs-devel@gnu.org; Sat, 21 Aug 2021 10:07:48 -0400 Original-Received: from mail-oln040092069050.outbound.protection.outlook.com ([40.92.69.50]:23195 helo=EUR02-VE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mHRez-0001rh-T3; Sat, 21 Aug 2021 10:07:47 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H7UG4M94qa592cENiqhTJPc+xcf8VF00mfh+kTm2Gztm9yG0X6xnpgpvfqtSL4ner/RhCEwQali9e0ye622zimg6brXQhM6Ma6oM0rYgw9li+owPiGXYIk7KNauzW4nbZXnKZHDXBLEL+AOdIswAwiPIU7aI36kTfpgS7ylSO2FsMDfbrqixEwd5TDu4uo69TZ+vy+U8Mgv6YKBEo8vOpLqJhiPm+3jZ3Zjy+e6jJYltpWIRt4VTCe/6OVjdfwbPIPjSp3kl00tlDuUNZbbvOS3LmCqOLA+DVisW3HuYJXZt8BSdzKcBeSPP+m7PnjnPLwpw6/JczkmRo2d52FoaHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WbEzZ7zY6/IfjMHKfVI7j5vDRfFCJyu23QxqvLRhtOo=; b=UnTjg+eKS0Xbs/1EpYPIbWuc4jdFWvcs/ELFs0SYTyJk6hGROlQHb/EhcO6twI6GfpYx802xGGhaT3yXqF7/EfxGy+KggACaXOs835ee84adQK/WkofQyxAEceBN/yTT0VQbT42MFSeBT3lSq31Y2zQmmERpT7SvBILAnq82AtORz5XjwN8hbkH5VJkDIYuQRGUNRJq2J9WsUY1IshvqpV9rLpVsNUisWl8YezmrlUS+JrzDag6pelJvX/b+eRMMFBQnxoJiYAnQeZvijg2WyiiA6bIz+kj8AYWw2VFVUYSZQlFJlk0znHBRSAlXlpSs5rMl7L7226xR1vpu4x0PkQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=live.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WbEzZ7zY6/IfjMHKfVI7j5vDRfFCJyu23QxqvLRhtOo=; b=T6BPZ8NCrdlbaEP+uHM3oaAkkGgTw62qXJOvcQE6Ux9j/gpJwGE1FR6CND2rt9CU0F205SbAx0I8YF9OOUIJmRCy2k4dNiIZzemD6ZbdiqJcJddVhbEZxyCf+vQfC/drViGANSJ/Qgea1a3VJuOJfQrKNQ+mUxYshbGngd2Y6yGzu85qFr3KMKxpasw27g/yVc/vZeiEKkUiYcJXMF2GjedVodSCfg5FxQ98Pk8cqkaNyCZb26Y+oq83tMxi+/lpTx36D0Lcsyh7fL/PsslBaEEYcAgy/uNL/UgKSNq5WaVRy5uqj5qdU8LXz0YkxUAWflk7erJ9A8rO+FXoaGpRVQ== Original-Received: from AM5EUR02FT062.eop-EUR02.prod.protection.outlook.com (2a01:111:e400:7e1c::43) by AM5EUR02HT099.eop-EUR02.prod.protection.outlook.com (2a01:111:e400:7e1c::265) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Sat, 21 Aug 2021 14:07:41 +0000 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com (2a01:111:e400:7e1c::4b) by AM5EUR02FT062.mail.protection.outlook.com (2a01:111:e400:7e1c::472) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Sat, 21 Aug 2021 14:07:41 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:62DACE490627999573517E4BF53B9722CE156D1714ECC4E1A1BCCEA604AA8F9A; UpperCasedChecksum:99286924699DF8ACEB5F4D9914DB62CAE44249E5D9B3AC34EB0C37BB86CAB302; SizeAsReceived:8983; Count:47 Original-Received: from AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::6558:f201:6d1a:3f39]) by AM9PR09MB4977.eurprd09.prod.outlook.com ([fe80::6558:f201:6d1a:3f39%2]) with mapi id 15.20.4436.022; Sat, 21 Aug 2021 14:07:41 +0000 In-Reply-To: <2281ccca2d439b935535197d931c1ccf41b0f86f.camel@yandex.ru> (Konstantin Kharlamov's message of "Sat, 21 Aug 2021 15:05:23 +0300") X-TMN: [gz6IoIWxgySRkq580YJtsQgMGpiPsjS4] X-ClientProxiedBy: AM6P192CA0006.EURP192.PROD.OUTLOOK.COM (2603:10a6:209:83::19) To AM9PR09MB4977.eurprd09.prod.outlook.com (2603:10a6:20b:304::20) X-Microsoft-Original-Message-ID: <87v93yc2mr.fsf@live.com> X-MS-Exchange-MessageSentRepresentingType: 1 Original-Received: from pascal.homepc (81.232.177.30) by AM6P192CA0006.EURP192.PROD.OUTLOOK.COM (2603:10a6:209:83::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Sat, 21 Aug 2021 14:07:40 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 47 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 9a8d9588-8951-49d4-ad69-08d964ad0a0e X-MS-TrafficTypeDiagnostic: AM5EUR02HT099: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /AQ5gkKDBhw2IyLIa6i49VsGv6LCeTD4bVaEyIrHwxv/IjwNK6/++nASX4bWEITSSwND1a1NDpYx+mIeeSgSZ2xQQ9kuSGhKsExp49FfBXOYoVQSVlre1qAPQuv8dzk3F0IR2UNot5lfDumMaPx3EDiS64BtvlW5HiX912Td0TRYMCjryf4WSrRMEz7uzg62+1K26lxk391kdTzd3eWPnwdbujA4ljuX6fphCn4JmSLAQtC7INtDvG4CXwMcKLdGvQxgfA9w/g35Io3sHCQk8PA3bDiy7heemwfEPROX//rxpAx9I8u86k7RUcDj8YU0iau+UtCxSMqpmjyY959pV1JTK+48xu5Bruc2OjeH8OtEzPL1u6XkNRpqmBpHYurDAnUhK22P0Ba9oIexZlVg3jrlLIIj7Y9EbQOwDwGPKSbIWLAIOham2nh+C/Nrn5NX1JhhyZyfPjuPl4sBxGhOc2UkdUvAtFC7i5pSVtTQMx8= X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OeQ3vmPfdTSP4mYaEplQ95TT7S2lB+TmCv1vc6gpB6T5Se6VkXc9BCjqvjOlCH9xIYNJaMNRjvm0guaI6hEjyuofs4MRlnnWmTicKO7auqd9Lb14Q5Pg6nY55WbLjahDxFPAGa7+fZEjGJuX7n77hg== X-OriginatorOrg: live.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9a8d9588-8951-49d4-ad69-08d964ad0a0e X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2021 14:07:41.3496 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: AM5EUR02FT062.eop-EUR02.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5EUR02HT099 Received-SPF: pass client-ip=40.92.69.50; envelope-from=arthur.miller@live.com; helo=EUR02-VE1-obe.outbound.protection.outlook.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, MSGID_FROM_MTA_HEADER=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:272788 Archived-At: Konstantin Kharlamov writes: > On Sat, 2021-08-21 at 16:50 +0900, Jean-Christophe Helary wrote: >>=20 >>=20 >> > On Aug 21, 2021, at 16:16, Tassilo Horn wrote: >> >=20 >> > Jean-Christophe Helary writes: >> >=20 >> > Hi Jean-Christophe, >> >=20 >> > > Right now, I use C-h f to find the function definitions and move >> > > around the code. >> >=20 >> > That, and also M-. on a function call or variable will bring you to it= s >> > definition. >>=20 >> Thank you. >>=20 >> Sorry for this very basic question, what's the best way to navigate back= to >> where I was ? > > Seems to me, you don't have a workflow yet for development in general thr= ough > Emacs. Because questions like "how to go to definition" and "how to go ba= ck" > aren't really specific to ELisp, it's something you'd use while working w= ith > pretty much any language, be it C, Python, Haskell, C++, Rust=E2=80=A6 Th= e only question > you asked specific to ELisp is about debugging ELisp code. > > This is okay ofc, I'm just pointing it out because it might give you some= ideas on what to look for. > > There's a popular opinion that default Emacs keybindings aren't the best,= and people usually reconfigure some of them as they find appropriate. > > And there're many different workflows for code/text navigation in Emacs. = For > example, I personally prefer using Evil plugin (a vim-mode inside Emacs, = but it > actually had more features than the actual vim), and using C-o, C-i in "n= ormal > mode" of Evil to go back and forth between locations in text. By default = it may > switch buffers which I don't like, so I disabled that. "going to definiti= on" I > personally bound to "gd" in normal mode of Evil. And then, inside a singl= e file > there are usually multiple specific places that are of interest to me, so= I set > marks to them with (again, keybinding specific to Evil) "m1", "m2", "m3"= =E2=80=A6 > i.e. just enumerating them in an order I find interesting. > > There's also "avy" package for faster navigation within the visible text = portions. > > There are also Emacs "starter-kits" with lots of preconfigured stuff, e.g= . Doom > Emacs I heard is very good (I never personally used it, because by the ti= me it > became popular I already had a personalized configuration, however people= seem > to like it). > > So, yeah, for things non-specific to ELisp development (which is so far w= as > everything you mentioned except ELisp debugging), you just need to start = trying > to do the development, and along the way to try to reflect "what I really= wish I > was able to do right now". Stuff like autocompletion, seeing function hel= p in a > minibuffer or elsewhere, going to definition=E2=80=A6 Whatever you think = of, it is > probably implemented in Emacs (with or without plugins), so you just try = to > search for it using your favorite search engine. Another not-so-elisp-specific thing would be to learn how to use a debugger. He could also take a class of computer science, or an online course etc :). Otherwise for non mentioned tips yet, structure editing cal also be helpful (paredit/smartparens/lispy). Lispy is very good for elisp=20 development. Also a remapping some of hard to hit key combos predefined by Emacs, and addign few trivial defs on top, for me makes a difference when evaluating stuff. I have these following few small helpers: #+begin_src emacs-lisp ;; From: https://emacs.wordpress.com/2007/01/17/eval-and-replace-anywhere/ (defun fc-eval-and-replace () "Replace the preceding sexp with its value." (interactive) (backward-kill-sexp) (condition-case nil (prin1 (eval (read (current-kill 0))) (current-buffer)) (error (message "Invalid expression") (insert (current-kill 0))))) ;; https://stackoverflow.com/questions/2171890/emacs-how-to-evaluate-the-sm= allest-s-expression-the-cursor-is-in-or-the-follow (defun eval-next-sexp () (interactive) (save-excursion (forward-sexp) (eval-last-sexp nil))) ;; this works sometimes (defun eval-surrounding-sexp (levels) (interactive "p") (save-excursion (up-list (abs levels)) (eval-last-sexp nil))) (require 'popup) (defun describe-thing-in-popup () (interactive) (let* ((thing (symbol-at-point)) (help-xref-following t) (description (save-window-excursion (with-temp-buffer (help-mode) (describe-symbol thing) (buffer-string))))) (popup-tip description :point (point) :around t :height 30 :scroll-bar t :margin t))) (defun value-at-point-in-popup () (interactive) (let* ((thing (symbol-at-point)) (value (and (boundp thing) (symbol-value thing)))) (popup-tip (format "%s" value) :point (point) :around t :height 30 :scroll-bar t :margin t))) (defun last-sexp-in-popup () (interactive) (let* ((value (eval-last-sexp nil))) (popup-tip (format "%s" value) :point (point) :around t :height 30 :scroll-bar t :margin t))) (defun next-sexp-in-popup () (interactive) (let* ((value (eval-next-sexp))) (popup-tip (format "%s" value) :point (point) :around t :height 30 :scroll-bar t :margin t))) (defun surrounding-sexp-in-popup () (interactive) (let* ((value (eval-surrounding-sexp 1))) (popup-tip (format "%s" value) :point (point) :around t :height 30 :scroll-bar t :margin t))) #+end_src And I bind those like this: #+begin_src emacs-lisp (defkeys emacs-lisp-mode-map "\C-c a" emacs-lisp-byte-compile-and-load "\C-c b" emacs-lisp-byte-compile "\C-c c" emacs-lisp-native-compile-and-load "\C-c d" eval-defun "\C-c e" eval-buffer "\C-c i" reindent-buffer "\C-c l" eval-last-sexp "\C-c n" eval-next-sexp "\C-c r" fc-eval-and-replace "\C-c s" eval-surrounding-sexp) #+end_src So I can (often) just place my cursor somewhere in, before or after an expression and eval it, as well as an expression before or after. It reduces somewhat movements with cursor. For example I can place cursor between a defun and a test for defun and eval prev/nect without moving cursor etc. These are small trivial helpers, but I find them quite useful sometimes. Eldoc is also good to have when working with elisp.