From: ej32u--- via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 43503@debbugs.gnu.org
Subject: bug#43503: Patch: Improvements regarding commands like find-file-other-tab.
Date: Fri, 18 Sep 2020 21:41:41 +0000 [thread overview]
Message-ID: <cb81b484-d880-6902-9fc5-2bccced44477@protonmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 484 bytes --]
Hello.
This is what the patch does:
1. Document existing command `ffap-other-tab'.
2. Create `find-file-read-only-other-tab' and `ffap-read-only-other-tab'.
3. Bind "\C-r" to `find-file-read-only-other-tab', like how "\C-f" is
bound to `find-file-other-tab'.
4. Document `ffap-read-only-other-tab' in misc.texi.
I don't really know the Texinfo format, so I just copied the mark-up used for
other items.
Is there anything that should be changed?
Thank you.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Improvements-regarding-like-find-file-other-tab.patch --]
[-- Type: text/x-patch; name=0001-Improvements-regarding-like-find-file-other-tab.patch, Size: 3339 bytes --]
From cb079bfa57694d529bee0fac0a38c68600c33a8e Mon Sep 17 00:00:00 2001
From: Earl <>
Date: Wed, 16 Sep 2020 17:07:58 -0400
Subject: [PATCH] Improvements regarding like find-file-other-tab.
1. Document existing command `ffap-other-tab'.
2. Create find-file-read-only-other-tab and ffap-read-only-other-tab.
3. Bind "\C-r" to find-file-read-only-other-tab, like how "\C-f" is
bound to find-file-other-tab.
4. Document ffap-read-only-other-tab in misc.texi.
---
doc/emacs/misc.texi | 5 +++++
lisp/ffap.el | 8 ++++++++
lisp/tab-bar.el | 15 +++++++++++++++
3 files changed, 28 insertions(+)
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index c8b21e701c..4865ee1751 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -3028,6 +3028,11 @@ FFAP
@code{find-file-read-only-other-frame}.
@item C-x 5 d @var{directory} @key{RET}
@code{ffap-dired-other-frame}, analogous to @code{dired-other-frame}.
+@kindex C-x t C-f @r{(FFAP)}
+@item C-x t C-f @var{filename} @key{return}
+@code{ffap-other-tab}, analogous to @code{find-file-other-tab}.
+@item C-x t C-r @var{filename} @key{return}
+@code{ffap-read-only-other-tab}, analogous to @code{find-file-read-only-other-tab}.
@item M-x ffap-next
Search buffer for next file name or URL, then find that file or URL.
@item S-mouse-3
diff --git a/lisp/ffap.el b/lisp/ffap.el
index 3e65c687af..29883693a7 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -1926,6 +1926,14 @@ ffap-read-only-other-frame
(ffap--toggle-read-only value)
value))
+(defun ffap-read-only-other-tab (filename)
+ "Like `ffap', but put buffer in another tab and mark as read-only.
+Only intended for interactive use."
+ (interactive (list (ffap-prompter nil " other tab")))
+ (let ((value (window-buffer (ffap-other-tab filename))))
+ (ffap--toggle-read-only value)
+ value))
+
(defun ffap-alternate-file (filename)
"Like `ffap' and `find-alternate-file'.
Only intended for interactive use."
diff --git a/lisp/tab-bar.el b/lisp/tab-bar.el
index d8f932e7a4..840c67d5cc 100644
--- a/lisp/tab-bar.el
+++ b/lisp/tab-bar.el
@@ -1567,6 +1567,20 @@ find-file-other-tab
value)
(switch-to-buffer-other-tab value))))
+(defun find-file-read-only-other-tab (filename &optional wildcards)
+ "Edit file FILENAME, in another tab, but don't allow changes.
+Like \\[find-file-other-frame] (which see), but creates a new tab.
+
+Like C-x t C-f, but marks buffer as read-only.
+Use C-x C-q to permit editing."
+ (interactive
+ (find-file-read-args "Find file read-only in other tab: "
+ (confirm-nonexistent-file-or-buffer)))
+ (find-file--read-only (lambda (filename wildcards)
+ (window-buffer
+ (find-file-other-tab filename wildcards)))
+ filename wildcards))
+
(defun other-tab-prefix ()
"Display the buffer of the next command in a new tab.
The next buffer is the buffer displayed by the next command invoked
@@ -1596,6 +1610,7 @@ tab-prefix-map
(define-key tab-prefix-map "b" 'switch-to-buffer-other-tab)
(define-key tab-prefix-map "f" 'find-file-other-tab)
(define-key tab-prefix-map "\C-f" 'find-file-other-tab)
+(define-key tab-prefix-map "\C-r" 'find-file-read-only-other-tab)
(define-key tab-prefix-map "t" 'other-tab-prefix)
\f
--
2.25.1
next reply other threads:[~2020-09-18 21:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-18 21:41 ej32u--- via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2020-09-19 14:34 ` bug#43503: Patch: Improvements regarding commands like find-file-other-tab Lars Ingebrigtsen
2020-09-19 18:19 ` ej32u--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2020-09-20 9:30 ` Lars Ingebrigtsen
2020-09-20 9:37 ` Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cb81b484-d880-6902-9fc5-2bccced44477@protonmail.com \
--to=bug-gnu-emacs@gnu.org \
--cc=43503@debbugs.gnu.org \
--cc=ej32u@protonmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.