From unknown Sun Jun 15 08:15:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#68921: File and Buffer register functions. Resent-From: Barra =?UTF-8?Q?=C3=93_?= =?UTF-8?Q?Cath=C3=A1in?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Feb 2024 03:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 68921 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 68921@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.170701788732745 (code B ref -1); Sun, 04 Feb 2024 03:39:02 +0000 Received: (at submit) by debbugs.gnu.org; 4 Feb 2024 03:38:07 +0000 Received: from localhost ([127.0.0.1]:47396 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rWTKY-0008Vy-Kl for submit@debbugs.gnu.org; Sat, 03 Feb 2024 22:38:07 -0500 Received: from lists.gnu.org ([2001:470:142::17]:39110) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rWN89-000693-2h for submit@debbugs.gnu.org; Sat, 03 Feb 2024 16:00:53 -0500 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 ) id 1rWN7g-0006ph-FN for bug-gnu-emacs@gnu.org; Sat, 03 Feb 2024 16:00:24 -0500 Received: from abi149bb126.cwl1.oracleemaildelivery.com ([129.149.22.126]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rWN7a-0003S2-EQ for bug-gnu-emacs@gnu.org; Sat, 03 Feb 2024 16:00:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=ocathain-2023-02-08; d=ocathain.ie; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=rmyzwvom0EnItwqLOe2wmOvogGnr3i6Klys3licb+1s=; b=P3keYWCRfP41yc2egTlMQf2rTINNkNP0cBjA0utaXH9PD+4x082wy5BxIeDcJHG4fM4yNIHXboYf zjKX+FOptn/qjHhcNHJjkqy+wNLpJ1epG2eWQEGRzaheLybW13IQ830ZyeLjArG55nqZ1zcXT3AD gj+B3RHuINScmNGPrxVdjsojZ+x/zl873nKIUCFuOtKzNXYDcIDgh2mO7Nr6OF+zjJhtS+mtEs9t faKOD5k6u8sOcEHknzPDD1+WPN5LPYpcipIek12xhbeSi96Y4X2i4SCeDvLloI1ov9ZzRsOqvABx 1e3FH+ohh4G2U0vOSjxP2jxonL8mUoIvgQTlRw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-cwl-20201026; d=cwl1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=rmyzwvom0EnItwqLOe2wmOvogGnr3i6Klys3licb+1s=; b=UJvZ5kDg1T3aGcR4w4dKFkR8WzZlh9e6z/gn3k/rJ8U8yaZdRcWgxOhW5dGEWP0GgbiLzRF3Qbln I1MT52RpYSIZpp8+3lphhRNc27kLPndPUTGfLEIKBxOzMVm3RrFoL8D0e3rv5rwC8k9UGmgPwaRA vs0S8KkQTEV7U+x92mPOy3hbLodF7EYypnh/yIXfO8SHcLRuf6mDHxUYYDSx240KmMjCmjpDgQDB BCX4DzJfWBM6t/e7Ca/+kYutnGK79SNFsnvjf9AC05pQbYWfKNQP83Ly+TqCIKekCZxrQXtuPv2I DOUEIBPMdoMKxsY9s5iMZuBAVXrH5Ow5xvkfBg== Received: by omta-ad1-fd2-101-uk-cardiff-1.omtaad1.vcndpcwl.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20231214 64bit (built Dec 14 2023)) with ESMTPS id <0S8A004B0SJQFQB0@omta-ad1-fd2-101-uk-cardiff-1.omtaad1.vcndpcwl.oraclevcn.com> for bug-gnu-emacs@gnu.org; Sat, 03 Feb 2024 20:50:14 +0000 (GMT) From: Barra =?UTF-8?Q?=C3=93_?= =?UTF-8?Q?Cath=C3=A1in?= Date: Sat, 03 Feb 2024 20:50:45 +0000 Message-id: <875xz5gtlm.fsf@ocathain.ie> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-version: 1.0 Content-type: multipart/mixed; boundary="=-=-=" Reporting-Meta: AAG6IJ1+5PpPce61hfUaqc/pnRR+GCP4Blia4LgZx+4G1gdmaHQbA2xJQX13Y2hZ JoyO2Z91tapSzDksHsR0KgPZLSjlDHTuMl+xDuV8siw3m8OztbTrN3dHbeIZsNWl AnVUaEFd7cp8/iYqZEP9N4AIzxrM0vcZnfIa1MaHy+EnjPrsAZ0nLKqKhV5xsm/q p+BUOzUSyO4bmk6BrieTJQ1FgyGdeVEqLWQfB3c2FXCmNEDLQhhgHmEPWhIlI2BQ JbNjHSu3FSyKN+JHXa4ujjoT9iSTJz8U+y/yQ5cbj3wGOS9/DwHd3J/nYX8e9hWy 0MZu3CdUzxjJgP6IRmCh+0Jm4EdHZ6J6oXDn2ivk5sOfC+4CXEpKTjyo9B5V3jB9 WwZ0/Zs/6EXjqXKxfxMfsgBnGZRlq2CjKWPMcT2DQPiLBrH3N9eZ0H+NLDP12Unv BGWDIYb+vljKh8iaTnfy6fm7cAfNjhJmi/Nt8TsZHp/FcWqGPzKxBTbTcQ== Received-SPF: pass client-ip=129.149.22.126; envelope-from=bounces+bug-gnu-emacs=gnu.org@cwl1.rp.oracleemaildelivery.com; helo=abi149bb126.cwl1.oracleemaildelivery.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, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Hello! I noticed that files and buffers don't have "to-register" functions of their own, rather, relying on (set-register). To that end, I have written 4 functions that I feel may be useful and "complete the [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Mailman-Approved-At: Sat, 03 Feb 2024 22:38:04 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) --=-=-= Content-Type: text/plain Hello! I noticed that files and buffers don't have "to-register" functions of their own, rather, relying on (set-register). To that end, I have written 4 functions that I feel may be useful and "complete the set" of register functions. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Added-buffer-and-file-to-register-functions.patch >From d697dc8b3fb66fb3c37851ab1d33af665870ae1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barra=20=C3=93=20Cath=C3=A1in?= Date: Fri, 2 Feb 2024 21:45:05 +0000 Subject: [PATCH 1/4] Added buffer and file to register functions. Added buffer-to-register, file-to-register, current-buffer-to-register, and current-file-to-register to register.el. --- lisp/register.el | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/lisp/register.el b/lisp/register.el index 822467a0d72..8fff867e547 100644 --- a/lisp/register.el +++ b/lisp/register.el @@ -685,6 +685,50 @@ Interactively, prompt for REGISTER using `register-read-with-preview'." (let ((val (get-register register))) (register-val-jump-to val delete))) +(defun file-to-register (register file-name) + "Inserts a given file into a register. To visit the file, use + \\[jump-to-register]. + +Called from Lisp, takes two args: REGISTER, and FILE-NAME. + +Interactively, prompt for REGISTER using `register-read-with-preview', +and prompt for FILE-NAME using `read-file-name'." + (interactive (list (register-read-with-preview "File to register: ") + (read-file-name "File: "))) + (set-register register `(file . ,file-name))) + +(defun current-file-to-register (register) + "Places the current file name into a register. To visit the file, use +\\[jump-to-register]. + +Called from Lisp, takes one arg: REGISTER. + +Interactively, prompt for REGISTER using `register-read-with-preview." + (interactive (list (register-read-with-preview "Current file to register: "))) + (set-register register `(file . ,(buffer-file-name)))) + +(defun buffer-to-register (register buffer) + "Inserts a given buffer into a register. To visit the buffer, use +\\[jump-to-register]. + +Called from Lisp, takes two args: REGISTER, and BUFFER. + +Interactively, prompt for REGISTER using `register-read-with-preview', and +prompt for BUFFER-NAME using `read-buffer'." + (interactive (list (register-read-with-preview "Buffer to register: ") + (read-buffer "Buffer: "))) + (set-register register `(buffer . ,buffer))) + +(defun current-buffer-to-register (register) + "Places the current buffer into a register. To visit the buffer, use +\\[jump-to-register]. + +Called from Lisp, takes one arg: REGISTER. + +Interactively, prompt for REGISTER using `register-read-with-preview.'" + (interactive (list (register-read-with-preview "Current buffer to register: "))) + (set-register register `(buffer . ,(current-buffer)))) + (cl-defgeneric register-val-jump-to (_val _arg) "Execute the \"jump\" operation of VAL. VAL is the contents of a register as returned by `get-register'. -- 2.43.0 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0002-Added-bindings-for-the-new-to-register-functions.patch >From f53b313bbf9e033ca0aea9e1e1e4a547d6b5b194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barra=20=C3=93=20Cath=C3=A1in?= Date: Fri, 2 Feb 2024 22:28:44 +0000 Subject: [PATCH 2/4] Added bindings for the new "to register" functions Added bindings for "current-file-to-register" and "current-buffer-to-register" to bindings.el. --- lisp/bindings.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/bindings.el b/lisp/bindings.el index 4690897fed4..21767f37f61 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -1570,7 +1570,10 @@ if `inhibit-field-text-motion' is non-nil." "n" #'number-to-register "+" #'increment-register "w" #'window-configuration-to-register - "f" #'frameset-to-register) + "f" #'frameset-to-register + "F" #'current-file-to-register + "B" #'current-buffer-to-register) + (define-key ctl-x-map "r" ctl-x-r-map) (define-key esc-map "q" 'fill-paragraph) -- 2.43.0 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0003-Basic-error-checking-for-new-register-functions.patch >From 23dcde96046a9edc04bca68579174300dde5cd44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barra=20=C3=93=20Cath=C3=A1in?= Date: Sat, 3 Feb 2024 20:34:45 +0000 Subject: [PATCH 3/4] Basic error checking for new register functions --- lisp/register.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/register.el b/lisp/register.el index 8fff867e547..cfb3c6a2b13 100644 --- a/lisp/register.el +++ b/lisp/register.el @@ -695,7 +695,9 @@ Interactively, prompt for REGISTER using `register-read-with-preview', and prompt for FILE-NAME using `read-file-name'." (interactive (list (register-read-with-preview "File to register: ") (read-file-name "File: "))) - (set-register register `(file . ,file-name))) + (if (file-exists-p file-name) + (set-register register `(file . ,file-name))) + (user-error "File does not exist.") (defun current-file-to-register (register) "Places the current file name into a register. To visit the file, use @@ -717,7 +719,9 @@ Interactively, prompt for REGISTER using `register-read-with-preview', and prompt for BUFFER-NAME using `read-buffer'." (interactive (list (register-read-with-preview "Buffer to register: ") (read-buffer "Buffer: "))) - (set-register register `(buffer . ,buffer))) + (if (buffer-p buffer) + (set-register register `(buffer . ,buffer)) + (user-error "Not a buffer.")) (defun current-buffer-to-register (register) "Places the current buffer into a register. To visit the buffer, use -- 2.43.0 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0004-Documentation-in-Info-for-new-register-commands.patch >From cf28598990cb374f6e3bedb0b5c49e0ccc861477 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barra=20=C3=93=20Cath=C3=A1in?= Date: Sat, 3 Feb 2024 20:43:05 +0000 Subject: [PATCH 4/4] Documentation in Info for new register commands Simple modification to regs.texi to refer to the new register commands. --- doc/emacs/regs.texi | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/doc/emacs/regs.texi b/doc/emacs/regs.texi index cac5b32c566..e9fb2c74773 100644 --- a/doc/emacs/regs.texi +++ b/doc/emacs/regs.texi @@ -291,11 +291,13 @@ numeric argument stores zero in the register. @cindex saving buffer name in a register If you visit certain file names frequently, you can visit them more -conveniently if you put their names in registers. Here's the Lisp code -used to put a file @var{name} into register @var{r}: +conveniently if you put their names in registers. You may use @kbd{C-x +r F} to place the currently visited file in a register. + +Here's the Lisp code used to put a file @var{name} into register @var{r}: @smallexample -(set-register @var{r} '(file . @var{name})) +(file-to-register @var{r} @var{name}) @end smallexample @need 3000 @@ -303,7 +305,7 @@ used to put a file @var{name} into register @var{r}: For example, @smallexample -(set-register ?z '(file . "/gd/gnu/emacs/19.0/src/ChangeLog")) +(file-to-register ?z "/gd/gnu/emacs/19.0/src/ChangeLog") @end smallexample @noindent @@ -314,12 +316,13 @@ puts the file name shown in register @samp{z}. restore a frame configuration.) Similarly, if there are certain buffers you visit frequently, you -can put their names in registers. For instance, if you visit the +can put their names in registers. You may use @kbd{C-x r B} to store +the current buffer in a register. Or, for instance, if you visit the @samp{*Messages*} buffer often, you can use the following snippet to put that buffer into the @samp{m} register: @smallexample -(set-register ?m '(buffer . "*Messages*")) +(buffer-to-register ?m "*Messages*") @end smallexample To switch to the buffer whose name is in register @var{r}, type -- 2.43.0 --=-=-=-- From unknown Sun Jun 15 08:15:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#68921: File and Buffer register functions. Resent-From: Thierry Volpiatto Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Feb 2024 06:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68921 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 68921@debbugs.gnu.org Cc: barra@ocathain.ie X-Debbugs-Original-To: Barra =?UTF-8?Q?=C3=93_?= =?UTF-8?Q?Cath=C3=A1in?= via "Bug reports for GNU Emacs, the Swiss army knife of text editors" X-Debbugs-Original-Cc: Barra =?UTF-8?Q?=C3=93_?= =?UTF-8?Q?Cath=C3=A1in?= , 68921@debbugs.gnu.org Received: via spool by submit@debbugs.gnu.org id=B.170702822519689 (code B ref -1); Sun, 04 Feb 2024 06:31:02 +0000 Received: (at submit) by debbugs.gnu.org; 4 Feb 2024 06:30:25 +0000 Received: from localhost ([127.0.0.1]:48071 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rWW1I-00057S-D2 for submit@debbugs.gnu.org; Sun, 04 Feb 2024 01:30:25 -0500 Received: from lists.gnu.org ([2001:470:142::17]:55550) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rWW1G-00056y-85 for submit@debbugs.gnu.org; Sun, 04 Feb 2024 01:30:23 -0500 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 ) id 1rWW0y-0003Ff-Kk for bug-gnu-emacs@gnu.org; Sun, 04 Feb 2024 01:30:04 -0500 Received: from mout02.posteo.de ([185.67.36.66]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rWW0v-00086c-RQ for bug-gnu-emacs@gnu.org; Sun, 04 Feb 2024 01:30:04 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id C029D240101 for ; Sun, 4 Feb 2024 07:29:57 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1707028197; bh=f+udZYyYsr5oe4PzBgZnISRdV/f0bLjHQMGOJV0oMY0=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding:Autocrypt:OpenPGP:From; b=VFh7QlzuOIYXdE5RfReBreGSaENTuVCgM8w8qZU0wiCgA5Ltlhe9c8WeeMI+r0L5U DSk1Db6Pytiv56ziY7mNSSrpF3/bt+BRA4IZVjrQu68KtenRH0rqgZkS9XOUkk7wbq i8/wNhqWABrrbWZG6KsCj5oMhlMp7n5nrBWJkNYBHyqeKfrhUsFyWtUlOELrrjsV1/ ROT+3vUWkdCJm9qroF+NFAB56Mlp4xzfI5KbS1JntOWHRCINDmOUBdA9/z5vDUAAbJ wf6Pg6hM26csFJsm3V81EXX1cF7iW6OKFYKLYtJyz5VGjzxDjIHiNrl/f+dQgrj4Lb 5XFsemnDYH8iA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TSKPH4BpVz9rxG; Sun, 4 Feb 2024 07:29:55 +0100 (CET) From: Thierry Volpiatto In-Reply-To: <875xz5gtlm.fsf@ocathain.ie> ("Barra =?UTF-8?Q?=C3=93_?= =?UTF-8?Q?Cath=C3=A1in?= via \"Bug reports for GNU Emacs, the Swiss army knife of text editors\""'s message of "Sat, 03 Feb 2024 20:50:45 +0000") References: <875xz5gtlm.fsf@ocathain.ie> Date: Sun, 04 Feb 2024 06:30:12 +0000 Message-ID: <877cjkagi3.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Autocrypt: addr=thievol@posteo.net; prefer-encrypt=mutual; keydata=xsDNBF8ylcIBDADG+hy+zR6L4/vbdDDZuSaMmSrU3A5QZJpeBCvxTr7MpzzruZbhLPW1K3R6N2MA edi8Y+C8o27F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DAbHFdLvQzurnroBHQV0jSPNLTP5Suo7RnLbehfg5INpGjToCUlrd2qQqgXW7h5qZ TgUq5UmBc7YZ0JYWQgPTbQ== OpenPGP: url=https://posteo.de/keys/thievol@posteo.net.asc; preference=encrypt Received-SPF: pass client-ip=185.67.36.66; envelope-from=thievol@posteo.net; helo=mout02.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 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, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, 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-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) Barra =C3=93 Cath=C3=A1in via "Bug reports for GNU Emacs, the Swiss army kn= ife of text editors" writes: > Hello! > > I noticed that files and buffers don't have "to-register" functions of > their own, rather, relying on (set-register). The reason is that when your use `point-to-register`, a position is recorded in the buffer, and when you kill this buffer your register record (a marker) is transformed in a file-query register: Example: If I do C-x r SPC in init.el, register record a register like this: (119 . #) Then I kill init.el buffer, I have now in register-alist instead of the register above: (122 file-query "/path/to/init.el" 76829)=20 This register is writable i.e. you can save it for further emacs sessions. So there is no really needs for function that register files or buffers. That said if you really want to add such functions, you will have to add for each function the corresponding defmethod, here an example with a delete register function, you will find other examples in register.el: (defun register-delete (register) (interactive (list (register-read-with-preview "Delete register: ")= )) (setq register-alist (delete (assoc register register-alist) register-alist))) (cl-defmethod register-preview-command-info ((_command (eql register-de= lete))) (make-register-preview-info :types '(all) :msg "Delete register `%s'" :act 'modify :smatch t)) > To that end, I have written 4 functions that I feel may be useful and > "complete the set" of register functions. > > From d697dc8b3fb66fb3c37851ab1d33af665870ae1d Mon Sep 17 00:00:00 2001 > From: =3D?UTF-8?q?Barra=3D20=3DC3=3D93=3D20Cath=3DC3=3DA1in?=3D > Date: Fri, 2 Feb 2024 21:45:05 +0000 > Subject: [PATCH 1/4] Added buffer and file to register functions. > > Added buffer-to-register, file-to-register, current-buffer-to-register, > and current-file-to-register to register.el. > --- > lisp/register.el | 44 ++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 44 insertions(+) > > diff --git a/lisp/register.el b/lisp/register.el > index 822467a0d72..8fff867e547 100644 > --- a/lisp/register.el > +++ b/lisp/register.el > @@ -685,6 +685,50 @@ Interactively, prompt for REGISTER using `register-r= ead-with-preview'." > (let ((val (get-register register))) > (register-val-jump-to val delete))) >=20=20 > +(defun file-to-register (register file-name) > + "Inserts a given file into a register. To visit the file, use > + \\[jump-to-register]. > + > +Called from Lisp, takes two args: REGISTER, and FILE-NAME. > + > +Interactively, prompt for REGISTER using `register-read-with-preview', > +and prompt for FILE-NAME using `read-file-name'." > + (interactive (list (register-read-with-preview "File to register: ") > + (read-file-name "File: "))) > + (set-register register `(file . ,file-name))) > + > +(defun current-file-to-register (register) > + "Places the current file name into a register. To visit the file, use > +\\[jump-to-register]. > + > +Called from Lisp, takes one arg: REGISTER. > + > +Interactively, prompt for REGISTER using `register-read-with-preview." > + (interactive (list (register-read-with-preview "Current file to regist= er: ")))=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 > + (set-register register `(file . ,(buffer-file-name)))) > + > +(defun buffer-to-register (register buffer) > + "Inserts a given buffer into a register. To visit the buffer, use > +\\[jump-to-register]. > + > +Called from Lisp, takes two args: REGISTER, and BUFFER. > + > +Interactively, prompt for REGISTER using `register-read-with-preview', a= nd > +prompt for BUFFER-NAME using `read-buffer'." > + (interactive (list (register-read-with-preview "Buffer to register: ") > + (read-buffer "Buffer: "))) > + (set-register register `(buffer . ,buffer))) > + > +(defun current-buffer-to-register (register) > + "Places the current buffer into a register. To visit the buffer, use > +\\[jump-to-register]. > + > +Called from Lisp, takes one arg: REGISTER. > + > +Interactively, prompt for REGISTER using `register-read-with-preview.'" > + (interactive (list (register-read-with-preview "Current buffer to regi= ster: ")))=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 > + (set-register register `(buffer . ,(current-buffer)))) > + > (cl-defgeneric register-val-jump-to (_val _arg) > "Execute the \"jump\" operation of VAL. > VAL is the contents of a register as returned by `get-register'. > --=20 > 2.43.0 > > From f53b313bbf9e033ca0aea9e1e1e4a547d6b5b194 Mon Sep 17 00:00:00 2001 > From: =3D?UTF-8?q?Barra=3D20=3DC3=3D93=3D20Cath=3DC3=3DA1in?=3D > Date: Fri, 2 Feb 2024 22:28:44 +0000 > Subject: [PATCH 2/4] Added bindings for the new "to register" functions > > Added bindings for "current-file-to-register" and > "current-buffer-to-register" to bindings.el. > --- > lisp/bindings.el | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/lisp/bindings.el b/lisp/bindings.el > index 4690897fed4..21767f37f61 100644 > --- a/lisp/bindings.el > +++ b/lisp/bindings.el > @@ -1570,7 +1570,10 @@ if `inhibit-field-text-motion' is non-nil." > "n" #'number-to-register > "+" #'increment-register > "w" #'window-configuration-to-register > - "f" #'frameset-to-register) > + "f" #'frameset-to-register > + "F" #'current-file-to-register > + "B" #'current-buffer-to-register) > + > (define-key ctl-x-map "r" ctl-x-r-map) >=20=20 > (define-key esc-map "q" 'fill-paragraph) > --=20 > 2.43.0 > > From 23dcde96046a9edc04bca68579174300dde5cd44 Mon Sep 17 00:00:00 2001 > From: =3D?UTF-8?q?Barra=3D20=3DC3=3D93=3D20Cath=3DC3=3DA1in?=3D > Date: Sat, 3 Feb 2024 20:34:45 +0000 > Subject: [PATCH 3/4] Basic error checking for new register functions > > --- > lisp/register.el | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/lisp/register.el b/lisp/register.el > index 8fff867e547..cfb3c6a2b13 100644 > --- a/lisp/register.el > +++ b/lisp/register.el > @@ -695,7 +695,9 @@ Interactively, prompt for REGISTER using `register-re= ad-with-preview', > and prompt for FILE-NAME using `read-file-name'." > (interactive (list (register-read-with-preview "File to register: ") > (read-file-name "File: "))) > - (set-register register `(file . ,file-name))) > + (if (file-exists-p file-name) > + (set-register register `(file . ,file-name))) > + (user-error "File does not exist.") >=20=20 > (defun current-file-to-register (register) > "Places the current file name into a register. To visit the file, use > @@ -717,7 +719,9 @@ Interactively, prompt for REGISTER using `register-re= ad-with-preview', and > prompt for BUFFER-NAME using `read-buffer'." > (interactive (list (register-read-with-preview "Buffer to register: ") > (read-buffer "Buffer: "))) > - (set-register register `(buffer . ,buffer))) > + (if (buffer-p buffer) > + (set-register register `(buffer . ,buffer)) > + (user-error "Not a buffer.")) >=20=20 > (defun current-buffer-to-register (register) > "Places the current buffer into a register. To visit the buffer, use > --=20 > 2.43.0 > > From cf28598990cb374f6e3bedb0b5c49e0ccc861477 Mon Sep 17 00:00:00 2001 > From: =3D?UTF-8?q?Barra=3D20=3DC3=3D93=3D20Cath=3DC3=3DA1in?=3D > Date: Sat, 3 Feb 2024 20:43:05 +0000 > Subject: [PATCH 4/4] Documentation in Info for new register commands > > Simple modification to regs.texi to refer to the new register commands. > --- > doc/emacs/regs.texi | 15 +++++++++------ > 1 file changed, 9 insertions(+), 6 deletions(-) > > diff --git a/doc/emacs/regs.texi b/doc/emacs/regs.texi > index cac5b32c566..e9fb2c74773 100644 > --- a/doc/emacs/regs.texi > +++ b/doc/emacs/regs.texi > @@ -291,11 +291,13 @@ numeric argument stores zero in the register. > @cindex saving buffer name in a register >=20=20 > If you visit certain file names frequently, you can visit them more > -conveniently if you put their names in registers. Here's the Lisp code > -used to put a file @var{name} into register @var{r}: > +conveniently if you put their names in registers. You may use @kbd{C-x > +r F} to place the currently visited file in a register.=20 > + > +Here's the Lisp code used to put a file @var{name} into register @var{r}: >=20=20 > @smallexample > -(set-register @var{r} '(file . @var{name})) > +(file-to-register @var{r} @var{name}) > @end smallexample >=20=20 > @need 3000 > @@ -303,7 +305,7 @@ used to put a file @var{name} into register @var{r}: > For example, >=20=20 > @smallexample > -(set-register ?z '(file . "/gd/gnu/emacs/19.0/src/ChangeLog")) > +(file-to-register ?z "/gd/gnu/emacs/19.0/src/ChangeLog") > @end smallexample >=20=20 > @noindent > @@ -314,12 +316,13 @@ puts the file name shown in register @samp{z}. > restore a frame configuration.) >=20=20 > Similarly, if there are certain buffers you visit frequently, you > -can put their names in registers. For instance, if you visit the > +can put their names in registers. You may use @kbd{C-x r B} to store > +the current buffer in a register. Or, for instance, if you visit the > @samp{*Messages*} buffer often, you can use the following snippet to > put that buffer into the @samp{m} register: >=20=20 > @smallexample > -(set-register ?m '(buffer . "*Messages*")) > +(buffer-to-register ?m "*Messages*") > @end smallexample >=20=20 > To switch to the buffer whose name is in register @var{r}, type --=20 Thierry From unknown Sun Jun 15 08:15:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#68921: File and Buffer register functions. Resent-From: Thierry Volpiatto Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Feb 2024 06:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68921 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 68921@debbugs.gnu.org Cc: barra@ocathain.ie Received: via spool by 68921-submit@debbugs.gnu.org id=B68921.170702916421507 (code B ref 68921); Sun, 04 Feb 2024 06:47:01 +0000 Received: (at 68921) by debbugs.gnu.org; 4 Feb 2024 06:46:04 +0000 Received: from localhost ([127.0.0.1]:48088 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rWWGS-0005ap-DE for submit@debbugs.gnu.org; Sun, 04 Feb 2024 01:46:04 -0500 Received: from mout02.posteo.de ([185.67.36.66]:56579) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rWWGM-0005aG-RH for 68921@debbugs.gnu.org; Sun, 04 Feb 2024 01:46:02 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 18BD4240101 for <68921@debbugs.gnu.org>; Sun, 4 Feb 2024 07:45:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1707029141; bh=GZqqst8EU6G8ArSpfykygsJxns7jBOfweBiD16YtMdo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: Content-Transfer-Encoding:Autocrypt:OpenPGP:From; b=YGJQmFEGMEC22p/CbPrbIb1m5+rjEtjUiPHpZZOZ05vJapEP5mJyyI+0OeCkGOC/d OL4yvGy8XMV/i+vZUXU7kxsLbA4Szdv/UZVpyS/P92VSXPTw84sM17zEKmrjm4DYXO LsPXOZgSB54wSesXRpG1EdJ8FnDD2DParWu7sYKwT77bnYrK7DXL1bFiwzYrKgshYk VIxeTB8AKEFzRzf5l6lE8oPiY/dNanl1WP4ZwGDo1J41M+5jrR/EVdQMWpCwhxPnZm 5jnYSiHQ+hIpjX4TpLrdbBFIZf0rF70RRPJFwdAD1nE+kk9VoAUh3RrVfDjaFfVbTh ZEcrXDm4hfgKw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TSKlS2Vhrz9rxF; Sun, 4 Feb 2024 07:45:40 +0100 (CET) From: Thierry Volpiatto In-Reply-To: <877cjkagi3.fsf@posteo.net> (Thierry Volpiatto's message of "Sun, 04 Feb 2024 06:30:12 +0000") References: <875xz5gtlm.fsf@ocathain.ie> <877cjkagi3.fsf@posteo.net> Date: Sun, 04 Feb 2024 06:45:56 +0000 Message-ID: <8734u8afrv.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Enc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cZYSV7OsWnxJIYDV1gH5LTLj7bGswXaB4B+qkckihWkRZixu8q1IK 0c/xwUzyF092uFRM/sQKrSmnwA1+hQiiIuEl4XVz5li0/TmMta3ijUM7GNbl2IjioTRxWWecwad1 mNHvKTcXPsKDAbHFdLvQzurnroBHQV0jSPNLTP5Suo7RnLbehfg5INpGjToCUlrd2qQqgXW7h5qZ TgUq5UmBc7YZ0JYWQgPTbQ== OpenPGP: url=https://posteo.de/keys/thievol@posteo.net.asc; preference=encrypt X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Thierry Volpiatto writes: > Barra =C3=93 Cath=C3=A1in via "Bug reports for GNU Emacs, the Swiss army = knife of > text editors" writes: > >> Hello! >> >> I noticed that files and buffers don't have "to-register" functions of >> their own, rather, relying on (set-register). > > The reason is that when your use `point-to-register`, a position is > recorded in the buffer, and when you kill this buffer your register > record (a marker) is transformed in a file-query register: > > Example: > > If I do C-x r SPC in init.el, register record a register like this: > > (119 . #) > > Then I kill init.el buffer, I have now in register-alist instead of the > register above: > > (122 file-query "/path/to/init.el" 76829)=20 ^^^ 119 Sorry, for the error when copying. --=20 Thierry From unknown Sun Jun 15 08:15:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#68921: File and Buffer register functions. Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Feb 2024 07:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68921 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Barra =?UTF-8?Q?=C3=93_?= =?UTF-8?Q?Cath=C3=A1in?= , Thierry Volpiatto Cc: 68921@debbugs.gnu.org Received: via spool by 68921-submit@debbugs.gnu.org id=B68921.170703002524072 (code B ref 68921); Sun, 04 Feb 2024 07:01:01 +0000 Received: (at 68921) by debbugs.gnu.org; 4 Feb 2024 07:00:25 +0000 Received: from localhost ([127.0.0.1]:48097 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rWWUL-0006GC-Dw for submit@debbugs.gnu.org; Sun, 04 Feb 2024 02:00:25 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39822) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rWWUK-0006Fy-8k for 68921@debbugs.gnu.org; Sun, 04 Feb 2024 02:00:24 -0500 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 ) id 1rWWU3-0004jn-2u; Sun, 04 Feb 2024 02:00:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=L6GrDIKGDJwQG8sM7Y2haWlYLIRmJu/v5Fr6sNGt4FU=; b=IyPO53LWkQy3hJIgQfRM IRGgK+RyjDu3HWuiKFX3pBVmNsyZDiZmMdQ6kO4uUi6sjsxHTkV94hcwD+k7clq567m9O2W0yeEV7 1V/Mcj3LYeOP8JWzXx5R8xBgH2mEh2eyOC3Y7V7TOpE/Rm4NZZIR8AxfhdyKINGO7uxfOC/nORWB8 +HokmyMwwxjLMjzqABHTifkokiQpiWGUg+4PdPn7NRr/9Af+QZtFV7i2vTGZ/5g/Emy58jid/sRpt TGLYHZBarDnNYwIVKYXIw1c98BvlXSVP4z++CIbqoqw+ZoG2WZqD6MsJQ8rUPZ4aus+xBCRO9x/DU 4gwYMIlYNGoOQA==; Date: Sun, 04 Feb 2024 09:00:04 +0200 Message-Id: <86il343ea3.fsf@gnu.org> From: Eli Zaretskii In-Reply-To: <875xz5gtlm.fsf@ocathain.ie> (bug-gnu-emacs@gnu.org) References: <875xz5gtlm.fsf@ocathain.ie> MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Date: Sat, 03 Feb 2024 20:50:45 +0000 > From: Barra Ó Catháin via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" > > I noticed that files and buffers don't have "to-register" functions of > their own, rather, relying on (set-register). To that end, I have > written 4 functions that I feel may be useful and "complete the set" of > register functions. Thanks. I posted some comments on emacs-devel, where you posted these patches as well. Let's continue discussing only here, so that the discussion is recorded by the bug tracker. From unknown Sun Jun 15 08:15:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#68921: File and Buffer register functions. Resent-From: Thierry Volpiatto Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 04 Feb 2024 07:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68921 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 68921@debbugs.gnu.org Cc: barra@ocathain.ie Received: via spool by 68921-submit@debbugs.gnu.org id=B68921.170703096125590 (code B ref 68921); Sun, 04 Feb 2024 07:16:02 +0000 Received: (at 68921) by debbugs.gnu.org; 4 Feb 2024 07:16:01 +0000 Received: from localhost ([127.0.0.1]:48138 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rWWjR-0006ef-2A for submit@debbugs.gnu.org; Sun, 04 Feb 2024 02:16:01 -0500 Received: from mout01.posteo.de ([185.67.36.65]:45197) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rWWjP-0006eO-1V for 68921@debbugs.gnu.org; Sun, 04 Feb 2024 02:15:59 -0500 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 00E9F240028 for <68921@debbugs.gnu.org>; Sun, 4 Feb 2024 08:15:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1707030941; bh=jwJFO9jnpCTmvm7GN6nh1sfoO4f8/yvpREnN9JQibMc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: Autocrypt:OpenPGP:From; b=KZRloZwf42FSIxUvBZJ4hyCSy7P9QuLEvFe5W412ngLu9zMW/GZCiLQZvjAmbdC9T F0SkLns7odMECc1M3hBuixtA+lNBMLAnnKZFEcNpFPj0oqEHtWVOysaQ9hmaSPVJxS br++jmTQBbustmTE5Mr/RYg/b68NAtOlGIoRVp3B17HSXskUmeO20Mv8P/zQ+eUrcw hyrfBK4l2+2mc/1EFmLET2EyEbNbRGE1Dm2gylTZwqWmkV7EP683xfB60g8jPrxSjF LWb4YI4HDvUXp1KTjEcOW0Xpx8dh7VptpxWA8hkXc7MuTMeBoppsXsZ6EhRt8RlQiv 2jI3iufWwqWnA== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4TSLQ35mfqz9rxD; Sun, 4 Feb 2024 08:15:39 +0100 (CET) From: Thierry Volpiatto In-Reply-To: <877cjkagi3.fsf@posteo.net> (Thierry Volpiatto's message of "Sun, 04 Feb 2024 06:30:12 +0000") References: <875xz5gtlm.fsf@ocathain.ie> <877cjkagi3.fsf@posteo.net> Date: Sun, 04 Feb 2024 07:15:56 +0000 Message-ID: <87sf288ztf.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain Autocrypt: addr=thievol@posteo.net; prefer-encrypt=mutual; keydata=xsDNBF8ylcIBDADG+hy+zR6L4/vbdDDZuSaMmSrU3A5QZJpeBCv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3ijUM7GNbl2IjioTRxWWecwad1 mNHvKTcXPsKDAbHFdLvQzurnroBHQV0jSPNLTP5Suo7RnLbehfg5INpGjToCUlrd2qQqgXW7h5qZ TgUq5UmBc7YZ0JYWQgPTbQ== OpenPGP: url=https://posteo.de/keys/thievol@posteo.net.asc; preference=encrypt X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Thierry Volpiatto writes: > That said if you really want to add such functions, you will have to add > for each function the corresponding defmethod, here an example with a > delete register function, you will find other examples in register.el: > > (defun register-delete (register) > (interactive (list (register-read-with-preview "Delete register: "))) > (setq register-alist (delete (assoc register register-alist) > register-alist))) > > (cl-defmethod register-preview-command-info ((_command (eql register-delete))) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Read here register-command-info instead. I use register-preview-command-info for my personal usage on Emacs-29, the real thing is register-command-info. Sorry again. -- Thierry From unknown Sun Jun 15 08:15:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#68921: File and Buffer register functions. References: <875xz5gtlm.fsf@ocathain.ie> Resent-From: Barra =?UTF-8?Q?=C3=93_?= =?UTF-8?Q?Cath=C3=A1in?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 07 Feb 2024 01:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68921 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 68921@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.170727100924719 (code B ref -1); Wed, 07 Feb 2024 01:57:02 +0000 Received: (at submit) by debbugs.gnu.org; 7 Feb 2024 01:56:49 +0000 Received: from localhost ([127.0.0.1]:55454 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rXXBA-0006Qa-Bq for submit@debbugs.gnu.org; Tue, 06 Feb 2024 20:56:49 -0500 Received: from lists.gnu.org ([2001:470:142::17]:47238) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rXUIh-0006uU-Ml for submit@debbugs.gnu.org; Tue, 06 Feb 2024 17:52:24 -0500 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 ) id 1rXUIO-0000rE-AL for bug-gnu-emacs@gnu.org; Tue, 06 Feb 2024 17:52:04 -0500 Received: from abi149bb125.cwl1.oracleemaildelivery.com ([129.149.22.125]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rXUIM-00010H-4l for bug-gnu-emacs@gnu.org; Tue, 06 Feb 2024 17:52:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=ocathain-2023-02-08; d=ocathain.ie; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=e89FRIq0JrFWw4iz1SNnSe69o0l+eF7cmUw3wIHKBjM=; b=QgJJdP+5ER9tJYShd4D5YqQY5BslSSnUuY9iPUVb+xpW9Wpve1+s5QCokNEK7RpcPejF7iT4XX4B 4NIcsBjGB2D4vPdeoDR0fL2NeBVPtCjz50CgXXbB++iGIJQIUKwsNB9gZz1wNqw0IegqAJ/EJjUs ExEqlBtHUGnKt8zyLS01P0Ff8M3pEPwx+8HqxaToibfbLG1DCB+NHsjY3baMDCbvwmnuzF3Ew5vE iO2D17d3fNMzGplRc+IpCI3u5MvMP7jzsv3eJnmIi4BZFS+XnQSjbq2D6hVfF0tj/SSBmjN9i6k3 nz35T1+TtIWpeoXxzlfrrbjCRkCrKfCMi9aF2Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-cwl-20201026; d=cwl1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=e89FRIq0JrFWw4iz1SNnSe69o0l+eF7cmUw3wIHKBjM=; b=Em8un+3H42sNrUB0KdvFAU/hMZrjPO1JUN4dzJem/sYpxPgcOhQ+jvYqr0OR4YB1lQ7JDDKIHI1S +vo/+C7wBLvvl6Y8qPE3InMehmQcDPdRpqxoiAM14ep7N3inWhNdQlsF/fDRvweNcZk7CM3hOzv9 B+3JTPwIbs007SkcAqitnSRMPtaJ5dpo2OwRVeXs3QBqZ2OiDnxqfT86sFq7ekIo/Wc4qdQFYvCh krx0OX670NTjk8DA90xFK6y9D8y8nZX+JxgfcZ/zLA0pYRmZJ8WYxCyRXcpuh5/lC04UARLBgqD0 DUkudwtLwLs9M9xFLxFn34WJk8RIXXD3EbEovg== Received: by omta-ad1-fd1-101-uk-cardiff-1.omtaad1.vcndpcwl.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20240110 64bit (built Jan 10 2024)) with ESMTPS id <0S8G003A8HPV1O60@omta-ad1-fd1-101-uk-cardiff-1.omtaad1.vcndpcwl.oraclevcn.com> for bug-gnu-emacs@gnu.org; Tue, 06 Feb 2024 22:41:55 +0000 (GMT) From: Barra =?UTF-8?Q?=C3=93_?= =?UTF-8?Q?Cath=C3=A1in?= In-reply-to: 875xz5gtlm.fsf@ocathain.ie Date: Tue, 06 Feb 2024 22:42:26 +0000 Message-id: <87h6ilqkod.fsf@ocathain.ie> MIME-version: 1.0 Content-type: multipart/mixed; boundary="=-=-=" Reporting-Meta: AAHxyrz0kbwpj6o8ojXeiSHsjaMFBeGegY4+4aF2FEOU3pLZ5oqReObGA3IzSFS3 AVLtdaeOdDym9gAjDEXkscsEnfMQcoOS73RxJ/rdzsL+J1dbaYcznF+oZXfJrYF2 XRQon13QXZ+RRtyf5m/UpH5r8CuY1UWJ/JARieoU2+enUNFiyS71aue/tY66Fuwk P9V49/M8kRDHWnh7x0L3BalgIFtOq1SdpiI5VeLgJQbqFrdw8eMdBcUdNU6ldQ7n 2BD1S72QOs1xlneFsmlqI41jbv9j8CEs5OQQB8IEV28JYRJGryCAZyhCPAO4vyY2 xUM4CZckhNQH609S05OB0OpeoWgA+rB/7Km3+x3P6Z3edMGP8XHE1y24vCBXTDL9 L+J+iRYCAYv2cqLQFFXKhSEPKMtPEDzqOxAyiZm1YyX0tfo7+Pjdns++SkCiYy6n 6A7A2pXwzw3V5UW6O7TKNs4zflAtsUZMHPKCDbj9o/KFAs3HzaOYrWP5 Received-SPF: pass client-ip=129.149.22.125; envelope-from=bounces+bug-gnu-emacs=gnu.org@cwl1.rp.oracleemaildelivery.com; helo=abi149bb125.cwl1.oracleemaildelivery.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, HEADER_FROM_DIFFERENT_DOMAINS=0.25, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Here follows (hopefully) much improved versions of the patches. I have to admit, a lot of the "decisions" of the last one were just plain sillyness, but I hope I've correctly formatted the documentati [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Mailman-Approved-At: Tue, 06 Feb 2024 20:56:47 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Here follows (hopefully) much improved versions of the patches. I have to admit, a lot of the "decisions" of the last one were just plain sillyness, but I hope I've correctly formatted the documentation. I rendered it and it looked correct to my eyes, but that's my own eyes. Both commands now take a prefix argument to pick a specific file or buffer, and otherwise default to the currently visited one. Further comments would be appreciated! Thanks, Barra =C3=93 Cath=C3=A1in. --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=0001-Added-buffer-and-file-to-register-functions.patch >From d7d6878664ae22c622f60608e9304fbffe29676c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barra=20=C3=93=20Cath=C3=A1in?= Date: Tue, 6 Feb 2024 22:33:32 +0000 Subject: [PATCH] Added buffer and file to register functions. * lisp/register.el (register-command-info): Register two new functions. (file-to-register): New function. (buffer-to-register): New function. --- lisp/register.el | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/lisp/register.el b/lisp/register.el index 822467a0d72..645bbc4b0ec 100644 --- a/lisp/register.el +++ b/lisp/register.el @@ -297,6 +297,18 @@ If NOCONFIRM is non-nil, request confirmation of register name by RET." :act 'set :noconfirm (memq register-use-preview '(nil never)) :smatch t)) +(cl-defmethod register-command-info ((_command (eql file-to-register))) + (make-register-preview-info + :types '(all) + :msg "File to register `%s'" + :act 'set + :noconfirm (memq register-use-preview '(nil never)))) +(cl-defmethod register-command-info ((_command (eql buffer-to-register))) + (make-register-preview-info + :types '(all) + :msg "Buffer to register `%s'" + :act 'set + :noconfirm (memq register-use-preview '(nil never)))) (defun register-preview-forward-line (arg) "Move to next or previous line in register preview buffer. @@ -685,6 +697,35 @@ Interactively, prompt for REGISTER using `register-read-with-preview'." (let ((val (get-register register))) (register-val-jump-to val delete))) +(defun file-to-register (file-name register) + "Inserts FILE-NAME in REGISTER. +To visit the file, use \\[jump-to-register]. + +Interactively, prompts for REGISTER using `register-read-with-preview'. +With a prefix-argument, prompts for FILE-NAME using `read-file-name', +otherwise, uses the currently visited file or directory for FILE-NAME." + (interactive (list (if (eq current-prefix-arg nil) + (if (eq major-mode 'dired-mode) + (dired-current-directory) + (buffer-file-name)) + (read-file-name "File: ")) + (register-read-with-preview "File to register: "))) + (unless (eq file-name nil) + (set-register register (cons 'file file-name)))) + +(defun buffer-to-register (buffer register) + "Inserts BUFFER in REGISTER. +To visit the buffer, use \\[jump-to-register]. + +Interactively, prompts for REGISTER using `register-read-with-preview'. +With a prefix-argument, prompts for BUFFER-NAME using `read-buffer', +otherwise, uses the current buffer." + (interactive (list (if (eq current-prefix-arg nil) + (current-buffer) + (read-buffer "Buffer: ")) + (register-read-with-preview "Buffer to register: "))) + (set-register register (cons 'buffer buffer))) + (cl-defgeneric register-val-jump-to (_val _arg) "Execute the \"jump\" operation of VAL. VAL is the contents of a register as returned by `get-register'. -- 2.43.0 --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=0002-lisp-bindings.el-ctl-x-r-map.patch >From c38e70ad2a93269e46343ea2b1a366ea064cdf84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barra=20=C3=93=20Cath=C3=A1in?= Date: Tue, 6 Feb 2024 14:18:47 +0000 Subject: [PATCH 2/3] * lisp/bindings.el (ctl-x-r-map): Added file-to-register and buffer-to-register in to keymap, under "F", and "B" --- lisp/bindings.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/bindings.el b/lisp/bindings.el index 4690897fed4..64f83efbb0a 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -1570,7 +1570,9 @@ ctl-x-r-map "n" #'number-to-register "+" #'increment-register "w" #'window-configuration-to-register - "f" #'frameset-to-register) + "f" #'frameset-to-register + "F" #'file-to-register + "B" #'buffer-to-register) (define-key ctl-x-map "r" ctl-x-r-map) (define-key esc-map "q" 'fill-paragraph) -- 2.43.0 --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=0003-Wrote-documentation-for-new-to-register-functions.patch >From 6c6524f70f93b88378c54be5bf4a7c21f422a8fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barra=20=C3=93=20Cath=C3=A1in?= Date: Tue, 6 Feb 2024 22:01:14 +0000 Subject: [PATCH 3/3] Wrote documentation for new to register functions. * doc/emacs/regs.texi (File and Buffer Registers): Revised documentation to explain the new commands, rather than the set-register elisp. --- doc/emacs/regs.texi | 55 ++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/doc/emacs/regs.texi b/doc/emacs/regs.texi index cac5b32c566..9dce7557de2 100644 --- a/doc/emacs/regs.texi +++ b/doc/emacs/regs.texi @@ -289,41 +289,46 @@ File and Buffer Registers @section Keeping File and Buffer Names in Registers @cindex saving file name in a register @cindex saving buffer name in a register +@kindex C-x r F +@kindex C-x r B If you visit certain file names frequently, you can visit them more -conveniently if you put their names in registers. Here's the Lisp code -used to put a file @var{name} into register @var{r}: +conveniently if you put their names in registers. Here's how you can +put a file into a buffer. -@smallexample -(set-register @var{r} '(file . @var{name})) -@end smallexample - -@need 3000 -@noindent -For example, - -@smallexample -(set-register ?z '(file . "/gd/gnu/emacs/19.0/src/ChangeLog")) -@end smallexample - -@noindent -puts the file name shown in register @samp{z}. +@table @kbd +@item C-x r F @var{r} +@kindex C-x r F +@findex file-to-register +Store the currently visited file or directory into register @var{r} (@code{file-to-register}). +@item C-u C-x r F @var{r} +@kindex C-x r F +@findex file-to-register +Prompt for a file, and store into register @var{r} (@code{file-to-register}). +@end table To visit the file whose name is in register @var{r}, type @kbd{C-x r j @var{r}}. (This is the same command used to jump to a position or restore a frame configuration.) - Similarly, if there are certain buffers you visit frequently, you -can put their names in registers. For instance, if you visit the -@samp{*Messages*} buffer often, you can use the following snippet to -put that buffer into the @samp{m} register: + Similarly, if there are certain buffers you visit frequently, you can +put their names in registers. You can use the following command to put a +buffer into a register. -@smallexample -(set-register ?m '(buffer . "*Messages*")) -@end smallexample +@table @kbd +@item C-x r B @var{r} +@kindex C-x r B +@findex buffer-to-register +Store the current buffer into register @var{r} (@code{buffer-to-register}). +@item C-u C-x r B @var{r} +@kindex C-x r B +@findex buffer-to-register +Prompt for a buffer, and store into register @var{r} (@code{buffer-to-register}). +@end table - To switch to the buffer whose name is in register @var{r}, type -@kbd{C-x r j @var{r}}. + To visit the buffer whose name is in register @var{r}, type @kbd{C-x r + j @var{r}}. (This is the same command used to jump to a position or + restore a frame configuration.) @node Keyboard Macro Registers @section Keyboard Macro Registers -- 2.43.0 --=-=-=-- From unknown Sun Jun 15 08:15:18 2025 X-Loop: help-debbugs@gnu.org Subject: bug#68921: File and Buffer register functions. References: <875xz5gtlm.fsf@ocathain.ie> Resent-From: Barra =?UTF-8?Q?=C3=93_?= =?UTF-8?Q?Cath=C3=A1in?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 28 Mar 2024 15:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68921 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: barra@ocathain.ie, 68921@debbugs.gnu.org X-Debbugs-Original-To: barra@ocathain.ie,bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.171164049413242 (code B ref -1); Thu, 28 Mar 2024 15:42:02 +0000 Received: (at submit) by debbugs.gnu.org; 28 Mar 2024 15:41:34 +0000 Received: from localhost ([127.0.0.1]:40939 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rprsk-0003RV-GT for submit@debbugs.gnu.org; Thu, 28 Mar 2024 11:41:34 -0400 Received: from lists.gnu.org ([2001:470:142::17]:36698) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rprsg-0003Qh-7e for submit@debbugs.gnu.org; Thu, 28 Mar 2024 11:41:31 -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 ) id 1rprsZ-0002tg-SJ for bug-gnu-emacs@gnu.org; Thu, 28 Mar 2024 11:41:23 -0400 Received: from abi149bb125.cwl1.oracleemaildelivery.com ([129.149.22.125]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rprsV-0007Ve-Ta for bug-gnu-emacs@gnu.org; Thu, 28 Mar 2024 11:41:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=ocathain-2023-02-08; d=ocathain.ie; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=jaswsJteYyN+IWfGHioOqfFvUtDgP7sKJ69c9J7uHYM=; b=KC88cbKmsCaJiW9BJPdVbUYIzi1WVvjmFCETBNNr2hvq5z+XKHjpxfa2wF66gBkbU25aepcqJqKF CyDb6qIwkTzHI2ZyDfcUKNyD5c51U1vgbayIaM5BQYI+jKGqtBaEVaJvjYRiWZlvFurZZ2p00bux d021wNPnWm6MZRJVktbmFVJSJsmSsGP5LMhEdRiY1QbbI4+QwXTWF1V10GptZhtOPQEF91gc/Izf NrXO/OZYBMkWEBN4lQkkjHSRQQLPs5AEG2XFHQvzIbDPkRvRQ5n8caR0dBklybNQ+cV8bMCU7ll+ ghbhXGO8zeuuBePcn933RocxcjUJRG3AllSKcQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; s=prod-cwl-20201026; d=cwl1.rp.oracleemaildelivery.com; h=Date:To:From:Subject:Message-Id:MIME-Version:Sender; bh=jaswsJteYyN+IWfGHioOqfFvUtDgP7sKJ69c9J7uHYM=; b=MGBfWUR6BhOLRjDABBZ3IukDPkEM1SMbIZU+tQab1wZZsvMrL0E85lkietUadYOJ9sUDVMG/oy8Y Whd5L3Hiw1A1myIcQF44ZvjgzqO1+KrbKyYQGjVtCXvlKgp/22mte3EdmSHl6lG+9t2+qxdYygTY W4jiIo0aQg9zIUADxzEvfQcB4pUHwGEwjtb/VfrBQLRXtsd9Y1Vbj1/soJboIZ7hAgaH6NTd1lYY 2FG8fMy2Hmtk4kMA8p94t78YFa66NVMIBtJbO0uimRf2lBaWIlbYVIEogKuwNNch1MeCmTm3Lt+R /TD4ivHI/02LPBAwhB5l+nka/qoytTpuFuFaqw== Received: by omta-ad1-fd1-101-uk-cardiff-1.omtaad1.vcndpcwl.oraclevcn.com (Oracle Communications Messaging Server 8.1.0.1.20240215 64bit (built Feb 15 2024)) with ESMTPS id <0SB200IZ0DS0KL20@omta-ad1-fd1-101-uk-cardiff-1.omtaad1.vcndpcwl.oraclevcn.com> for bug-gnu-emacs@gnu.org; Thu, 28 Mar 2024 15:31:12 +0000 (GMT) From: Barra =?UTF-8?Q?=C3=93_?= =?UTF-8?Q?Cath=C3=A1in?= In-reply-to: 87h6ilqkod.fsf@ocathain.ie Date: Thu, 28 Mar 2024 15:31:53 +0000 Message-id: <87v8564bkm.fsf@ocathain.ie> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-transfer-encoding: quoted-printable Reporting-Meta: AAGUh4XXt83HafiMR29UHlBTeTS9nYNVrg8XSw2iEDZMgqcBxCLl9oURwxrgQKuy 3CyKr05NLwGYoK+kDobIOZzvb0yMzJDeHBbnYPD8pItZIBcX5kNRtrVBtKUclPiF 7t8vFHOm8QZGd4Tr/Jp7og69ORKL4HL33mYldXkY2Vv6RnAZwKDReKVKRLGf04NW uyJgQgWPIY4zgnJBRYEkDOX1AtCD/As0V5JkC0RXnOYvqS+8pYLzJwHq4BAM+Xy2 KUv7xQ29OpMRF8/EchwTWlIZor5OGicRdiD8Lay7ZMOpTg6oQIXD8BP6UiAZGRnS fwca2qSiSC4NIwYZVAsfinFqElaVF8VHzKVUn5QUbf4wh2uUq2H7tLoUKJucNYGH zIQH+6+12rBSglPDpa34Zx9Zdn6ePYXb+nXfo5Rk933KgeBWqhSp8rPn+axrSZ6U 5eEtgOCxiBgYncyL2AGccq9maC1zr6TqklzH+OO4o4NCCpAJpgYVyQsI Received-SPF: pass client-ip=129.149.22.125; envelope-from=bounces+bug-gnu-emacs=gnu.org@cwl1.rp.oracleemaildelivery.com; helo=abi149bb125.cwl1.oracleemaildelivery.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, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Just thought I'd follow this up, since I have some time on my hands at the moment. Additionally, my copyright assignment is completed. -- ============================ Barry Kane | Barra =?UTF-8?Q?=C3=93_?= =?UTF-8?Q?Cath=C3=A1in?= "It's probably DNS." ============================ Website: ocathain.ie Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) Just thought I'd follow this up, since I have some time on my hands at the moment. Additionally, my copyright assignment is completed. --=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D Barry Kane | Barra =C3=93 Cath=C3=A1in "It's probably DNS." =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D Website: ocathain.ie PGP Key Fingerprint: C8DC 7443 991F B346 DE28 8FFA 85DE 3153 96B7 FFC6 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D