From: Michael Albinus <michael.albinus@gmx.de>
To: Stefan Kangas <stefan@marxist.se>
Cc: 56225@debbugs.gnu.org
Subject: bug#56225: args-out-of-range error in tramp-debug-buffer-command-completion-p
Date: Sun, 26 Jun 2022 11:04:52 +0200 [thread overview]
Message-ID: <87fsjrvlqj.fsf@gmx.de> (raw)
In-Reply-To: <CADwFkm=RyJn_QJ745ebJO=0evDjM+M4LgXyYT6K3TbrRic214Q@mail.gmail.com>
Stefan Kangas <stefan@marxist.se> writes:
Hi Stefan,
> I'm seeing the below error when typing `M-x' (`execute-extended-command')
> in narrowed buffers. I haven't been able to reproduce it in "emacs -Q".
You can reproduce it with "emacs -Q -l tramp" with
--8<---------------cut here---------------start------------->8---
(with-temp-buffer
(insert (make-string 20 ?x))
(narrow-to-region 2 5)
(tramp-debug-buffer-command-completion-p nil (current-buffer)))
--8<---------------cut here---------------end--------------->8---
> The below patch seems to fix it, but I have no idea if it's correct:
tramp-debug-buffer-command-completion-p should be very cheap. So it is
sufficient to apply
--8<---------------cut here---------------start------------->8---
diff --git a/lisp/tramp.el b/lisp/tramp.el
index 1674bf27..7aba76d7 100644
--- a/lisp/tramp.el
+++ b/lisp/tramp.el
@@ -1955,7 +1955,8 @@ The outline level is equal to the verbosity of the Tramp message."
"A predicate for Tramp interactive commands.
They are completed by \"M-x TAB\" only in Tramp debug buffers."
(with-current-buffer buffer
- (string-equal (buffer-substring 1 (min 10 (point-max))) ";; Emacs:")))
+ (string-equal
+ (buffer-substring (point-min) (min 10 (point-max))) ";; Emacs:")))
(put #'tramp-debug-buffer-command-completion-p 'tramp-suppress-trace t)
--8<---------------cut here---------------end--------------->8---
There could be false positives when the string ";; Emacs:" is somewhere
in the buffer, and the buffer is narrowed at this point. But that's not
the end of the world :-)
And we don't need to worry about narrowed Tramp debug buffers: they
don't exist.
> Michael, what do you think?
I've applied the patch to master. Could you pls check?
Best regards, Michael.
next prev parent reply other threads:[~2022-06-26 9:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-25 23:16 bug#56225: args-out-of-range error in tramp-debug-buffer-command-completion-p Stefan Kangas
2022-06-26 9:04 ` Michael Albinus [this message]
2022-06-28 21:20 ` Stefan Kangas
2022-06-29 7:56 ` Michael Albinus
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87fsjrvlqj.fsf@gmx.de \
--to=michael.albinus@gmx.de \
--cc=56225@debbugs.gnu.org \
--cc=stefan@marxist.se \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).