Stefan Kangas <stefankangas@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 64574) by debbugs.gnu.org; 3 Sep 2023 11:44:49 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 03 07:44:49 2023 Received: from localhost ([127.0.0.1]:39841 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qclX7-0004X1-D9 for submit <at> debbugs.gnu.org; Sun, 03 Sep 2023 07:44:49 -0400 Received: from mail-lf1-x12d.google.com ([2a00:1450:4864:20::12d]:60424) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>) id 1qclX5-0004Wg-Ac for 64574 <at> debbugs.gnu.org; Sun, 03 Sep 2023 07:44:48 -0400 Received: by mail-lf1-x12d.google.com with SMTP id 2adb3069b0e04-500a398cda5so1018235e87.0 for <64574 <at> debbugs.gnu.org>; Sun, 03 Sep 2023 04:44:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693741471; x=1694346271; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:from:to:cc:subject:date:message-id:reply-to; bh=QHaCsudUza42Gqvn8vrQMeNB5U+nLSeRjo8BT0eqTHs=; b=FSsqcsQH5o4HY7lUYOaofJo2uoD7jZh7UqCWgJTrq5EtRLO89HxT8fiYt5nZEEcdQN ZICl/eT37NeUX9m/bhtPVnI3tK76M9Ina5Fpep/woYVwIpicYeI63q4X6NwtvEzretJT LGmffv8wmyA82h9y2s7jJjd/VzrHRqEJ7YKTbpqiMlbDfpdfRg+WUm3JnVt1E2l5D/SY jQ6k+TNK5aC9mTka3guygN2ynSNJupB84YI1eZ+svOnnwjHC8ytrF7Bhh60y57qXnyKw 8RRdQLQ0Pdrr+PT260vUDjXH6K41taI5iPIMtqvyRJJb8UskKMmd1dJqbRUuAFoKHKaF 3e5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693741471; x=1694346271; h=cc:to:subject:message-id:date:mime-version:references:in-reply-to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QHaCsudUza42Gqvn8vrQMeNB5U+nLSeRjo8BT0eqTHs=; b=HvMQ01hvqt8k9ZbpVfKpBq/hBvWZAu9hdX9ONEVuJbjVQFnCemMAuwVni3uvJNKzNp QB6cjdrEc1uTlyB8qShezmHUO1OfZcrwTw3MPDZZppe+PYcfNXeklMDTzbCTFOeha6Kz HeZF1Tbck3aLl/fOC9+vdMbWnfBu2j9Qtrq+q6qXqKnM9wdRBTKNyHQ6QN4kjEZnZTVE 2xg9TlSW2z9G/MTUIKuIU0JBPznO15SOqOtOMpuLC2ROoXB7gak4R112cXIk03uZWDK3 I/fvxdsPF3xcN33q/ryNRxgag2MYqb7shnzE2E0vx4HkRKSaSxuRn7jnOHo3YrxhDBJs rwxw== X-Gm-Message-State: AOJu0Yx3s04n7ZfMn4xA5nDs0HzRgDNgpC3gV1iz07Zm7YbgdpJ0qhVf m1bAJaGNC2ezLk4R1y/roWhqePWmZIFd39qxsqI= X-Google-Smtp-Source: AGHT+IHfQDg+Xb+4rLCYgRJs3IabiHfK+K2O8r+r38n/5Ua+u2tHokgFKdeurTZRhDcO1+zZZU3ieMrGvR0D3/9l3rg= X-Received: by 2002:a05:6512:4845:b0:4f8:74b5:b4ec with SMTP id ep5-20020a056512484500b004f874b5b4ecmr4994338lfb.41.1693741470890; Sun, 03 Sep 2023 04:44:30 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sun, 3 Sep 2023 04:44:30 -0700 From: Stefan Kangas <stefankangas@HIDDEN> In-Reply-To: <ierjzv5qis1.fsf@HIDDEN> (Spencer Baugh's message of "Wed, 12 Jul 2023 10:57:50 -0400") References: <ierpm4yqpq0.fsf@HIDDEN> <83edle704t.fsf@HIDDEN> <ierjzv5qis1.fsf@HIDDEN> MIME-Version: 1.0 Date: Sun, 3 Sep 2023 04:44:30 -0700 Message-ID: <CADwFkmmQg5QBbFuZEACyuSFE4k95PAZq5_XHezm_n-H1LeEZZQ@HIDDEN> Subject: Re: bug#64574: [PATCH] Support not jumping to bol in beginning-of-defun To: Spencer Baugh <sbaugh@HIDDEN> Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 64574 Cc: Eli Zaretskii <eliz@HIDDEN>, 64574 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Spencer Baugh <sbaugh@HIDDEN> writes: > Users at my site have expressed a preference for this (including me, > once I thought about it enough to realize I don't like the default > behavior). And Jim Porter just mentioned that they would prefer this > too. I'd use it too. >>> +(defvar beginning-of-defun-go-beginning-of-line t >> >> Why not defcustom? >> >> And I would use a shorter name, like beginning-of-defun-go-bol. > > Can do. Perhaps `beginning-of-defun-jumps-to-bol'? >>From be03d6e994303c3f32d676194f6f31e89917013e Mon Sep 17 00:00:00 2001 > From: Spencer Baugh <sbaugh@HIDDEN> > Date: Tue, 11 Jul 2023 14:14:34 -0400 > Subject: [PATCH] Support not jumping to bol in beginning-of-defun > > As mentioned in the commit, this default behavior by > beginning-of-defun may be undesirable in some languages and major > modes. I'm thinking of OCaml in particular here, but it's also > arguably unwanted in Python and C++ as well, where defs may be > indented inside class definitions. Let's let the user make this > decision. Your patch still lacks a NEWS item before it can be installed.
bug-gnu-emacs@HIDDEN
:bug#64574
; Package emacs
.
Full text available.Received: (at 64574) by debbugs.gnu.org; 22 Jul 2023 13:16:56 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jul 22 09:16:56 2023 Received: from localhost ([127.0.0.1]:35660 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qNCTf-0006Hj-PD for submit <at> debbugs.gnu.org; Sat, 22 Jul 2023 09:16:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43434) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1qNCTd-0006HW-Mw for 64574 <at> debbugs.gnu.org; Sat, 22 Jul 2023 09:16:54 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1qNCTW-00059R-WD; Sat, 22 Jul 2023 09:16:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=1U6Vl69jPqUju9OQx6tgmXnRoAMLMEc8wX1z+Esg2Y0=; b=XmkLlOgTn98q ZXDYlXt8BQkpQkYHOiL9+4txRbJsoPwK6sEVM2vQabfHp8N9XAG0SiEhMcEjM1kaNPi/8+VkMlfyk k5uP0TjNFKPXpD0A4MNBa70zrs5PhXPTOElwsBbCMOhNOX2hRLpyW0AVERP09nw+fj8LEt25Ztqjf NO6y5RkhR9EvA4RqknWRO1Wrkkv/tE/97NG7HuiKWuwh1TrWcxrWb7XM62elyi2B63xB7keKuasx8 skjSC3J07ulxJ1NvNSnKaEWLZjppivNIBjAQZaJ0Qz/U2IkyeE9Ljqr28hUmHugJkRU3DdxQy7suk DxrEo0aju0lOes2fhMGt1g==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1qNCTV-0000xS-TP; Sat, 22 Jul 2023 09:16:46 -0400 Date: Sat, 22 Jul 2023 16:17:25 +0300 Message-Id: <83h6pw84re.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Spencer Baugh <sbaugh@HIDDEN> In-Reply-To: <ierjzv5qis1.fsf@HIDDEN> (message from Spencer Baugh on Wed, 12 Jul 2023 10:57:50 -0400) Subject: Re: bug#64574: [PATCH] Support not jumping to bol in beginning-of-defun References: <ierpm4yqpq0.fsf@HIDDEN> <83edle704t.fsf@HIDDEN> <ierjzv5qis1.fsf@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64574 Cc: 64574 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Spencer Baugh <sbaugh@HIDDEN> > Cc: 64574 <at> debbugs.gnu.org > Date: Wed, 12 Jul 2023 10:57:50 -0400 > > Revised patch: Thanks. Please add a NEWS entry, and we can install this then.
bug-gnu-emacs@HIDDEN
:bug#64574
; Package emacs
.
Full text available.Received: (at 64574) by debbugs.gnu.org; 12 Jul 2023 14:57:59 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 12 10:57:59 2023 Received: from localhost ([127.0.0.1]:52773 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qJbHy-0001jt-Lj for submit <at> debbugs.gnu.org; Wed, 12 Jul 2023 10:57:59 -0400 Received: from mxout5.mail.janestreet.com ([64.215.233.18]:40763) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <sbaugh@HIDDEN>) id 1qJbHv-0001jc-VB for 64574 <at> debbugs.gnu.org; Wed, 12 Jul 2023 10:57:56 -0400 From: Spencer Baugh <sbaugh@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#64574: [PATCH] Support not jumping to bol in beginning-of-defun In-Reply-To: <83edle704t.fsf@HIDDEN> (Eli Zaretskii's message of "Tue, 11 Jul 2023 21:50:58 +0300") References: <ierpm4yqpq0.fsf@HIDDEN> <83edle704t.fsf@HIDDEN> Date: Wed, 12 Jul 2023 10:57:50 -0400 Message-ID: <ierjzv5qis1.fsf@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 64574 Cc: 64574 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Eli Zaretskii <eliz@HIDDEN> writes: >> From: Spencer Baugh <sbaugh@HIDDEN> >> Date: Tue, 11 Jul 2023 14:15:35 -0400 >> >> As mentioned in the commit, this default behavior by >> beginning-of-defun is undesirable in some languages and major modes. >> I'm thinking of OCaml in particular here, but it's also arguably >> unwanted in Python and C++ as well, where defs may be indented inside >> class definitions. Let's let users and major modes make this decision >> on a case-by-case basis. > > Such optional behavior is fine by me, but is there any evidence enough > people will want it? Can you gather some feedback about that? Users at my site have expressed a preference for this (including me, once I thought about it enough to realize I don't like the default behavior). And Jim Porter just mentioned that they would prefer this too. >> +(defvar beginning-of-defun-go-beginning-of-line t > > Why not defcustom? > > And I would use a shorter name, like beginning-of-defun-go-bol. Can do. >> + "If non-nil, `beginning-of-defun' runs `beginning-of-line' at the end. > > This describes implementation, not the behavior. It also assumes > everyone knows what exactly beginning-of-line does (think RTL text). > >> +By default, `beginning-of-defun' jumps to the beginning of the >> +line with `beginning-of-line' after finding the start of the >> +defun. > > I see no reason to tell in the doc string how exactly the function > goes to BOL. It can even be a problem if at some future point we > decide to change the implementation. Can do. >> +For languages where defuns may be indented inside nested >> +structures like classes or modules, this behavior may be >> +undesirable. Major modes for such languages can set this >> +variable to nil to avoid it.") > > Not sure we should leave this to major modes and not to the individual > users. > > Thanks. Sure, I'm fine with having it be a defcustom that users can set. Revised patch: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Support-not-jumping-to-bol-in-beginning-of-defun.patch From be03d6e994303c3f32d676194f6f31e89917013e Mon Sep 17 00:00:00 2001 From: Spencer Baugh <sbaugh@HIDDEN> Date: Tue, 11 Jul 2023 14:14:34 -0400 Subject: [PATCH] Support not jumping to bol in beginning-of-defun As mentioned in the commit, this default behavior by beginning-of-defun may be undesirable in some languages and major modes. I'm thinking of OCaml in particular here, but it's also arguably unwanted in Python and C++ as well, where defs may be indented inside class definitions. Let's let the user make this decision. * lisp/emacs-lisp/lisp.el (beginning-of-defun-go-bol): Add defcustom. (beginning-of-defun): Check beginning-of-defun-go-bol. --- lisp/emacs-lisp/lisp.el | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index b91d56cfb4f..e5b024b19a6 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -335,6 +335,17 @@ kill-backward-up-list (insert current-sexp)) (user-error "Not at a sexp")))) +(defcustom beginning-of-defun-go-bol t + "If non-nil, `beginning-of-defun' moves to beginning of line. + +By default, `beginning-of-defun' point moves to the beginning of +the line where a defun starts. For languages where defuns may be +indented inside nested structures like classes or modules, this +behavior may be undesirable." + :type '(choice (const :tag "Don't go to BOL in beginning-of-defun" nil) + (const :tag "Go to BOL in beginning-of-defun" t)) + :group 'lisp) + (defvar beginning-of-defun-function nil "If non-nil, function for `beginning-of-defun-raw' to call. This is used to find the beginning of the defun instead of using the @@ -367,16 +378,17 @@ beginning-of-defun value is called as a function, with argument ARG, to find the defun's beginning. -Regardless of the values of `defun-prompt-regexp' and -`beginning-of-defun-function', point always moves to the -beginning of the line whenever the search is successful." +If `beginning-of-defun-go-bol' is non-nil, point moves to the +beginning of the line if the search is successful." (interactive "^p") (or (not (eq this-command 'beginning-of-defun)) (eq last-command 'beginning-of-defun) (and transient-mark-mode mark-active) (push-mark)) (and (beginning-of-defun-raw arg) - (progn (beginning-of-line) t))) + (progn (when beginning-of-defun-go-bol + (beginning-of-line)) + t))) (defun beginning-of-defun-raw (&optional arg) "Move point to the character that starts a defun. -- 2.39.3 --=-=-=--
bug-gnu-emacs@HIDDEN
:bug#64574
; Package emacs
.
Full text available.Received: (at 64574) by debbugs.gnu.org; 12 Jul 2023 02:28:05 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 11 22:28:05 2023 Received: from localhost ([127.0.0.1]:51357 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qJPaH-0005VZ-87 for submit <at> debbugs.gnu.org; Tue, 11 Jul 2023 22:28:05 -0400 Received: from mail-pl1-f182.google.com ([209.85.214.182]:49409) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <jporterbugs@HIDDEN>) id 1qJPaF-0005V0-Mf for 64574 <at> debbugs.gnu.org; Tue, 11 Jul 2023 22:28:04 -0400 Received: by mail-pl1-f182.google.com with SMTP id d9443c01a7336-1b89cfb4571so48258645ad.3 for <64574 <at> debbugs.gnu.org>; Tue, 11 Jul 2023 19:28:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689128877; x=1691720877; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=Yg0YdL7jHcvp138rl0CLZEtdBCbsmwiQ6g3nwKhJQqs=; b=KqoJlyKFyR5gSZhu7YUTKYei9hgbrqAL3NC6z6A0sN3zckwBE7UWoZFqyJvfI0334l AV1rzgPZVkNkAiU8EIET3FB07B/DexPGHPBNU4F9Gdg7QzOm8lHG8PCM5FRw98qXYJ8d nekJCGo+jlzcN5vw9rYj/g3ppaEp56vzqCSwNZyoso7tC35+LXlZlrqAO2Zmf9SnXARy xPi3Cie8VqZkyTXrW64m3I//E9K6siwcbtariNqNs8tZUqsv8reNC8wuOBLSl7nmj7xS XuX6dn1BEf/O7XO1hNm2NLNXWjHzAWnxa8pp948+TeO3LmtLGWOJnrHAE7G5x/bzgvGh ZMBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689128877; x=1691720877; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Yg0YdL7jHcvp138rl0CLZEtdBCbsmwiQ6g3nwKhJQqs=; b=TwXhUAVXf1Eik4isGvaLOx2W7x0GT1j9Cn1lOUI684LoDZgIHxeetaW4LGYhN9Ea+g G3w7YJ6Lv+B5vWxM/BQrESnuMhlbEFzynKYEW7se4n8v4PDAhKC7uApHK4SynZdRaUW5 /XYlz4WlZy4PPIeUvGRvdaS+BwGePRq4CQKR++sX16GTEEiIZqn6Gs/CUUq0jYrG3hfc KvBoSFYDHeGxhu8I9cR4SlTiitov+A7xXWmMzwC2rEIA7l2+MLU5GyEgD7OLnAOUeYYB er+Z6Z/ZOZws6j1nUHiykk0Sw+dTR8FXJ1bf6j0VL6nEmeZTeuF8cSOCtmmUTIwFcexj 8spg== X-Gm-Message-State: ABy/qLZyzZyihGmpShueT01o6qykj4jDxxQIW4C3q12P3UYsJu+OLCzR ut+JnSNGLakJ13UmmvwT5zQ= X-Google-Smtp-Source: APBJJlGRvNOgYPHHPMPGn8vo+9+K0RlneQnNp6/8kRmYZh+SaXrOqG3FPHIkMX3NhvvZu7OoDykPMg== X-Received: by 2002:a17:902:e88b:b0:1af:981b:eeff with SMTP id w11-20020a170902e88b00b001af981beeffmr17716672plg.64.1689128877023; Tue, 11 Jul 2023 19:27:57 -0700 (PDT) Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id c11-20020a170902724b00b001b53d3d8f3dsm2602714pll.299.2023.07.11.19.27.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 Jul 2023 19:27:56 -0700 (PDT) Message-ID: <ad97e832-1d8d-ca1c-0e42-3bf2ae233332@HIDDEN> Date: Tue, 11 Jul 2023 19:27:55 -0700 MIME-Version: 1.0 Subject: Re: bug#64574: [PATCH] Support not jumping to bol in beginning-of-defun Content-Language: en-US To: Eli Zaretskii <eliz@HIDDEN>, Spencer Baugh <sbaugh@HIDDEN> References: <ierpm4yqpq0.fsf@HIDDEN> <83edle704t.fsf@HIDDEN> From: Jim Porter <jporterbugs@HIDDEN> In-Reply-To: <83edle704t.fsf@HIDDEN> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 64574 Cc: 64574 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) On 7/11/2023 11:50 AM, Eli Zaretskii wrote: > Such optional behavior is fine by me, but is there any evidence enough > people will want it? Can you gather some feedback about that? For what it's worth, I'd probably use this.
bug-gnu-emacs@HIDDEN
:bug#64574
; Package emacs
.
Full text available.Received: (at 64574) by debbugs.gnu.org; 11 Jul 2023 18:50:57 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 11 14:50:57 2023 Received: from localhost ([127.0.0.1]:51075 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qJIRs-00027g-T1 for submit <at> debbugs.gnu.org; Tue, 11 Jul 2023 14:50:57 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44912) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1qJIRq-00027P-H9 for 64574 <at> debbugs.gnu.org; Tue, 11 Jul 2023 14:50:55 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1qJIRk-0001D3-H9; Tue, 11 Jul 2023 14:50:48 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=PLZbhZGXyKkuPLycUtGVGUL0+JjwwyOMfaUYpStNLmM=; b=eKocryrfTmg8 S3NGcRfTgCUkxqzCF6cLjWF/xd0CMNm/rp2PvHNC91viljdFnolJF+819ExaDy/38LGTMVvQmmz6U rcpI/hdJGotLEk1Vj6D4+ls6bVu2ye1LZ5fQ9EqKiN4TvZz9dLGYqJUlm5YS80cJeXatVwt6YW2CO aAFV6/E4aWVrk9hsp5RydlI7r1jPNkLJmXpELpy8R0tTPHn7ksoDwEx6WfbtDH0rlu7pUKROTGX8t bs26JNR1EyYDEQb/VscSZvg3n8ZcCEg8RKlKQNblMb9Oa/x/QaeEvqqngAfanB2V+wGyz+ddO7gGQ p/NyM5zZfzqfDKKadza/Bg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1qJIRi-0008H3-Rz; Tue, 11 Jul 2023 14:50:47 -0400 Date: Tue, 11 Jul 2023 21:50:58 +0300 Message-Id: <83edle704t.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Spencer Baugh <sbaugh@HIDDEN> In-Reply-To: <ierpm4yqpq0.fsf@HIDDEN> (message from Spencer Baugh on Tue, 11 Jul 2023 14:15:35 -0400) Subject: Re: bug#64574: [PATCH] Support not jumping to bol in beginning-of-defun References: <ierpm4yqpq0.fsf@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 64574 Cc: 64574 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Spencer Baugh <sbaugh@HIDDEN> > Date: Tue, 11 Jul 2023 14:15:35 -0400 > > As mentioned in the commit, this default behavior by > beginning-of-defun is undesirable in some languages and major modes. > I'm thinking of OCaml in particular here, but it's also arguably > unwanted in Python and C++ as well, where defs may be indented inside > class definitions. Let's let users and major modes make this decision > on a case-by-case basis. Such optional behavior is fine by me, but is there any evidence enough people will want it? Can you gather some feedback about that? > +(defvar beginning-of-defun-go-beginning-of-line t Why not defcustom? And I would use a shorter name, like beginning-of-defun-go-bol. > + "If non-nil, `beginning-of-defun' runs `beginning-of-line' at the end. This describes implementation, not the behavior. It also assumes everyone knows what exactly beginning-of-line does (think RTL text). > +By default, `beginning-of-defun' jumps to the beginning of the > +line with `beginning-of-line' after finding the start of the > +defun. I see no reason to tell in the doc string how exactly the function goes to BOL. It can even be a problem if at some future point we decide to change the implementation. > +For languages where defuns may be indented inside nested > +structures like classes or modules, this behavior may be > +undesirable. Major modes for such languages can set this > +variable to nil to avoid it.") Not sure we should leave this to major modes and not to the individual users. Thanks.
bug-gnu-emacs@HIDDEN
:bug#64574
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 11 Jul 2023 18:15:47 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 11 14:15:47 2023 Received: from localhost ([127.0.0.1]:51025 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1qJHtq-000724-PP for submit <at> debbugs.gnu.org; Tue, 11 Jul 2023 14:15:47 -0400 Received: from lists.gnu.org ([209.51.188.17]:44814) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <sbaugh@HIDDEN>) id 1qJHto-00071w-5h for submit <at> debbugs.gnu.org; Tue, 11 Jul 2023 14:15:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <sbaugh@HIDDEN>) id 1qJHtm-0005os-2B for bug-gnu-emacs@HIDDEN; Tue, 11 Jul 2023 14:15:44 -0400 Received: from mxout5.mail.janestreet.com ([64.215.233.18]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <sbaugh@HIDDEN>) id 1qJHth-0000H1-KL for bug-gnu-emacs@HIDDEN; Tue, 11 Jul 2023 14:15:41 -0400 From: Spencer Baugh <sbaugh@HIDDEN> To: bug-gnu-emacs@HIDDEN Subject: [PATCH] Support not jumping to bol in beginning-of-defun Date: Tue, 11 Jul 2023 14:15:35 -0400 Message-ID: <ierpm4yqpq0.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=64.215.233.18; envelope-from=sbaugh@HIDDEN; helo=mxout5.mail.janestreet.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.4 (--) --=-=-= Content-Type: text/plain Tags: patch As mentioned in the commit, this default behavior by beginning-of-defun is undesirable in some languages and major modes. I'm thinking of OCaml in particular here, but it's also arguably unwanted in Python and C++ as well, where defs may be indented inside class definitions. Let's let users and major modes make this decision on a case-by-case basis. In GNU Emacs 29.0.92 (build 5, x86_64-pc-linux-gnu, X toolkit, cairo version 1.15.12, Xaw scroll bars) of 2023-07-10 built on igm-qws-u22796a Repository revision: dd15432ffacbeff0291381c0109f5b1245060b1d Repository branch: emacs-29 Windowing system distributor 'The X.Org Foundation', version 11.0.12011000 System Description: CentOS Linux 7 (Core) Configured using: 'configure --config-cache --with-x-toolkit=lucid --with-gif=ifavailable' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Support-not-jumping-to-bol-in-beginning-of-defun.patch From 12c4f80e046c3c6dd6996e13f332d0eb41d1f1dd Mon Sep 17 00:00:00 2001 From: Spencer Baugh <sbaugh@HIDDEN> Date: Tue, 11 Jul 2023 14:14:34 -0400 Subject: [PATCH] Support not jumping to bol in beginning-of-defun As mentioned in the commit, this default behavior by beginning-of-defun is undesirable in some languages and major modes. I'm thinking of OCaml in particular here, but it's also arguably unwanted in Python and C++ as well, where defs may be indented inside class definitions. Let's let users and major modes make this decision on a case-by-case basis. * lisp/emacs-lisp/lisp.el (beginning-of-defun-go-beginning-of-line): Add variable. (beginning-of-defun): Check variable. --- lisp/emacs-lisp/lisp.el | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el index b91d56cfb4f..70c296b2c31 100644 --- a/lisp/emacs-lisp/lisp.el +++ b/lisp/emacs-lisp/lisp.el @@ -335,6 +335,18 @@ kill-backward-up-list (insert current-sexp)) (user-error "Not at a sexp")))) +(defvar beginning-of-defun-go-beginning-of-line t + "If non-nil, `beginning-of-defun' runs `beginning-of-line' at the end. + +By default, `beginning-of-defun' jumps to the beginning of the +line with `beginning-of-line' after finding the start of the +defun. + +For languages where defuns may be indented inside nested +structures like classes or modules, this behavior may be +undesirable. Major modes for such languages can set this +variable to nil to avoid it.") + (defvar beginning-of-defun-function nil "If non-nil, function for `beginning-of-defun-raw' to call. This is used to find the beginning of the defun instead of using the @@ -376,7 +388,9 @@ beginning-of-defun (and transient-mark-mode mark-active) (push-mark)) (and (beginning-of-defun-raw arg) - (progn (beginning-of-line) t))) + (progn (when beginning-of-defun-go-beginning-of-line + (beginning-of-line)) + t))) (defun beginning-of-defun-raw (&optional arg) "Move point to the character that starts a defun. -- 2.39.3 --=-=-=--
Spencer Baugh <sbaugh@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#64574
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.