From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ihor Radchenko Newsgroups: gmane.emacs.devel Subject: Re: Patch proposal: display symbol source code in help buffers Date: Fri, 01 Oct 2021 15:05:57 +0800 Message-ID: <87wnmxcjhm.fsf@localhost> References: <875yuvlrz3.fsf@gnus.org> <87r1djixiw.fsf@gnus.org> <878rzrzpfz.fsf@localhost> <87zgs7y5wc.fsf@localhost> <87sfxyftrw.fsf@gnus.org> <87mto6ifd2.fsf@localhost> <83r1diz5k9.fsf@gnu.org> <87r1diqodc.fsf@localhost> <87ee9h27rm.fsf@gnus.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19115"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , Stefan Kangas , arthur.miller@live.com, emacs-devel@gnu.org To: Lars Ingebrigtsen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Oct 01 09:06:32 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 1mWCcq-0004lR-Ox for ged-emacs-devel@m.gmane-mx.org; Fri, 01 Oct 2021 09:06:32 +0200 Original-Received: from localhost ([::1]:59150 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWCcp-00015k-2B for ged-emacs-devel@m.gmane-mx.org; Fri, 01 Oct 2021 03:06:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35064) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWCb4-0007yq-Uc for emacs-devel@gnu.org; Fri, 01 Oct 2021 03:04:43 -0400 Original-Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:44844) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWCb3-00072N-6S; Fri, 01 Oct 2021 03:04:42 -0400 Original-Received: by mail-pl1-x62f.google.com with SMTP id t11so5694954plq.11; Fri, 01 Oct 2021 00:04:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=DEzbjb6VgzVsrKN1duiQMLaEHsI+KHjlvq8g3/QBlaQ=; b=DhrG/c5q4GKSKO9NF/j2w5JjUy+60vddaqVorXRM9LTfBdl6b2BisjAV3mjOKSiOIA jn+xhfc+bclauZzU9BXkUOcqXcs7h5g64hTc+iGCt5shMSLjjUBMAulD5CxHGA9wYMol sEGMXDUK4eI0rfZEGzMfXyk3Og753HScHC6eufQaY9n784suXw3aAqTUX1X2a1Jnv04v YiBqFdH9kJ41JBfyrfFxBhViEbSwXhf+xOzuOH4q/NxepvwR+d6s+JRdXfUhej8dDVZ3 8Xk4AUSO4CEMHcrACpJ639FmGox/TSSWslday/gGDSmDRMu3NShDlG0Hcks+RqqhCW0R 3THQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=DEzbjb6VgzVsrKN1duiQMLaEHsI+KHjlvq8g3/QBlaQ=; b=S9UQ3xJ4jkX9oaUuk911kWrjgzfeP8CucAZvVPv/Z1EzfuXO9E+CphAuAWkArZEqRg F1e3FDVDBMoYMme5sLj6YGCZapVAghOM/caWpddL5mbqejsxP2L8xn8slDWEkHDRQLAI 6h1ZlH2ljUOx28GXt4h+9bxaWqnf5qBBSSAN3zE+iuz+Sa/mbVh1CusATBQ06gu8JLhd gzdq4d64+mWFVZyQCMnksC6bJDcdZw8ZU4kI53JdlmDz3aqu7hEk+anwxgvPxzNyd4N6 ANuN/IuylkMbKbRbd74eGF7DXoYm07/bmAv/omhlXSy6qCcAqd9pG8zUT+kxWiIGGG1H eDyA== X-Gm-Message-State: AOAM533dhK3yCjVUpyv1YQ6I9ODb2qLvpA7/Pk8MqpSTP0q6JRdiBSew dKgwWU1q1dB7PgvOCXtpE3k= X-Google-Smtp-Source: ABdhPJyIYSevEkAqsbSoKxb18BwiS0IwKmPlcn0Zc4IzK4ni8AHy2Ou8Jk+4R5s9AYzoJdqOhqnt7A== X-Received: by 2002:a17:90a:5d89:: with SMTP id t9mr18524311pji.22.1633071879453; Fri, 01 Oct 2021 00:04:39 -0700 (PDT) Original-Received: from localhost ([211.21.210.181]) by smtp.gmail.com with ESMTPSA id s197sm3663513pfs.141.2021.10.01.00.04.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 00:04:38 -0700 (PDT) In-Reply-To: <87ee9h27rm.fsf@gnus.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=yantar92@gmail.com; helo=mail-pl1-x62f.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=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:275955 Archived-At: --=-=-= Content-Type: text/plain Lars Ingebrigtsen writes: > I was thinking something slightly more subtle. That is, if we've just > opened the file (i.e., it has not been displayed before), we should not > push the mark. And if point didn't move, we shouldn't push the mark > either, I think. I agree that there is not much reason to push mark when point does not move. I slightly disagree about the case of opening new file. I personally find it useful when the first element added to mark ring is BOB. When cycling across mark ring, BOB is a nice visual indication that I already looked across the whole ring, especially if I am searching for mark that is actually not in the mark ring (though I thought otherwise). On the other hand, it is rather a matter of personal preference. Not pushing BOB to mark ring might be a better default. Even if it not, we would probably need to change other places across the code to add BOB consistently. That's a whole other discussion. See the updated patch. Hopefully I got the news entry for Emacs 29.1 right. Best, Ihor --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Save-position-in-mark-ring-before-jumping-to-definit.patch >From e8d71f7e9fe111965f81b8627f27530d2ce80048 Mon Sep 17 00:00:00 2001 Message-Id: From: Ihor Radchenko Date: Fri, 1 Oct 2021 14:56:43 +0800 Subject: [PATCH] Save position in mark ring before jumping to definition * lisp/help-mode.el (help-function-def--button-function): Current point is saved in the mark ring before jumping to definition. Following up: https://lists.gnu.org/archive/html/emacs-devel/2021-09/msg01561.html --- etc/NEWS | 3 +++ lisp/help-mode.el | 5 +++++ 2 files changed, 8 insertions(+) diff --git a/etc/NEWS b/etc/NEWS index d0e41baaeb..1dfcc1ae09 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -29,6 +29,9 @@ applies, and please also update docstrings as needed. * Changes in Emacs 29.1 +** Help +*** Jumping to function/variable source now saves mark before moving point +Jumping to source from "*Help*" buffer moves the point when the source buffer is already open. Now, the old point is pushed to mark ring. * Editing Changes in Emacs 29.1 diff --git a/lisp/help-mode.el b/lisp/help-mode.el index 0b404fe89f..0dc4229006 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -273,6 +273,11 @@ help-function-def--button-function (when (or (< position (point-min)) (> position (point-max))) (widen)) + ;; Save mark for the old location, unless we just opened + ;; the buffer or the point is not actually going to move. + (unless (or (= 1 (point)) + (= (point) position)) + (push-mark nil t)) (goto-char position)) (message "Unable to find location in file"))))) -- 2.32.0 --=-=-=--