* bug#56225: args-out-of-range error in tramp-debug-buffer-command-completion-p
@ 2022-06-25 23:16 Stefan Kangas
2022-06-26 9:04 ` Michael Albinus
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Kangas @ 2022-06-25 23:16 UTC (permalink / raw)
To: 56225; +Cc: Michael Albinus
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".
The below patch seems to fix it, but I have no idea if it's correct:
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index c6665c2792..a6b4d3dffe 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1954,8 +1954,10 @@ tramp-debug-outline-level
(defun tramp-debug-buffer-command-completion-p (_symbol buffer)
"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:")))
+ (save-restriction
+ (widen)
+ (with-current-buffer buffer
+ (string-equal (buffer-substring 1 (min 10 (point-max))) ";; Emacs:"))))
(put #'tramp-debug-buffer-command-completion-p 'tramp-suppress-trace t)
Michael, what do you think?
Debugger entered--Lisp error: (args-out-of-range #<buffer org-manual.org> 1 10)
tramp-debug-buffer-command-completion-p(tramp-setup-debug-buffer
#<buffer org-manual.org>)
command-completion-default-include-p(tramp-setup-debug-buffer
#<buffer org-manual.org>)
#f(compiled-function (sym) #<bytecode
-0x3e27aaa25208a7d>)(tramp-setup-debug-buffer)
#f(compiled-function (sym) #<bytecode
-0x1e2881bcfce59feb>)(tramp-setup-debug-buffer)
all-completions("" [flymake--backend-state-p--cmacro
magit-section-show-headings vc-src-responsible-p
soap-xs-complex-type-is-group--cmacro tramp-sudoedit-file-name-handler
hydra-message-timer Browse\ URL embark--cache-info--completion-list
python-nav-beginning-of-defun-regexp vc-sccs-log-view-mode-hook
ob-session-async-R-indicator magit-revision-filter-files-on-follow
idlwave-check-abbrev yas-x-prompt news-inews
soap-operation-namespace-tag magit-buffer-lock-functions
magit-xref-insert-button tramp-actions-copy-out-of-band f-ancestor-of?
gnus-demon-idle-has-been-called smiley-directory org-habit-scheduled
transient:magit-diff-refresh:--irreversible-delete
org-journal--open-entry c-make-ml-string-opener-re-function traversed
magit-list-modified-modules winum-mode-hook ada-cd-command
python-syntax--context-compiler-macro gdb-thread-number
org-export-highlight-first-table-line xref--push-markers
vc-bzr-shelve-menu About allout-post-undo-hook
swiper-include-line-number-in-search python-skeleton-available
xesam-engine pages-directory-mode-hook emacs-lock--set-mode
ibuffer-delete-alist org-man-center-block copy-soap-xs-attribute-group
tramp-adb-connection-local-default-shell-variables Noto\ Sans\
Gurmukhi transient:magit-log:--dense bibtex-text-in-string zot ...]
#f(compiled-function (sym) #<bytecode -0x1e2881bcfce59feb>))
complete-with-action(t [flymake--backend-state-p--cmacro
magit-section-show-headings vc-src-responsible-p
soap-xs-complex-type-is-group--cmacro tramp-sudoedit-file-name-handler
hydra-message-timer Browse\ URL embark--cache-info--completion-list
python-nav-beginning-of-defun-regexp vc-sccs-log-view-mode-hook
ob-session-async-R-indicator magit-revision-filter-files-on-follow
idlwave-check-abbrev yas-x-prompt news-inews
soap-operation-namespace-tag magit-buffer-lock-functions
magit-xref-insert-button tramp-actions-copy-out-of-band f-ancestor-of?
gnus-demon-idle-has-been-called smiley-directory org-habit-scheduled
transient:magit-diff-refresh:--irreversible-delete
org-journal--open-entry c-make-ml-string-opener-re-function traversed
magit-list-modified-modules winum-mode-hook ada-cd-command
python-syntax--context-compiler-macro gdb-thread-number
org-export-highlight-first-table-line xref--push-markers
vc-bzr-shelve-menu About allout-post-undo-hook
swiper-include-line-number-in-search python-skeleton-available
xesam-engine pages-directory-mode-hook emacs-lock--set-mode
ibuffer-delete-alist org-man-center-block copy-soap-xs-attribute-group
tramp-adb-connection-local-default-shell-variables Noto\ Sans\
Gurmukhi transient:magit-log:--dense bibtex-text-in-string zot ...] ""
#f(compiled-function (sym) #<bytecode -0x1e2881bcfce59feb>))
#<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_54>(""
#f(compiled-function (sym) #<bytecode -0x3e27aaa25208a7d>) t)
all-completions("" #<subr
F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_54>
#f(compiled-function (sym) #<bytecode -0x3e27aaa25208a7d>))
ivy--reset-state(#s(ivy-state :prompt "M-x " :collection #<subr
F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_54> :predicate
#f(compiled-function (sym) #<bytecode -0x3e27aaa25208a7d>)
:require-match t :initial-input nil :history extended-command-history
:preselect nil :keymap nil :update-fn nil :sort nil :frame #<frame
/home/skangas/wip/org-mode/doc/org-manual.org -- Emacs [Org]
0x55fbd001b9a8> :window #<window 80 on org-manual.org> :buffer
#<buffer org-manual.org> :text nil :action (1 ("o" identity "default")
("i" ivy--action-insert "insert") ("w" ivy--action-copy "copy"))
:unwind nil :re-builder ivy--regex-plus :matcher nil
:dynamic-collection nil :display-transformer-fn nil :directory
"/home/skangas/wip/org-mode/doc/" :caller execute-extended-command
:current nil :def nil :ignore t :multi-action nil :extra-props
(:caller ivy-completing-read)))
ivy-read("M-x " #<subr
F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_54> :predicate
#f(compiled-function (sym) #<bytecode -0x3e27aaa25208a7d>)
:require-match t :initial-input nil :preselect nil :def nil :history
extended-command-history :keymap nil :dynamic-collection nil
:extra-props (:caller ivy-completing-read) :caller
execute-extended-command)
ivy-completing-read("M-x " #<subr
F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_54>
#f(compiled-function (sym) #<bytecode -0x3e27aaa25208a7d>) t nil
extended-command-history nil nil)
read-extended-command-1("M-x " nil)
read-extended-command()
byte-code("\302\30\11\303 \10E)\207"
[execute-extended-command--last-typed current-prefix-arg nil
read-extended-command] 3)
command-execute(execute-extended-command)
In GNU Emacs 29.0.50 (build 16, x86_64-pc-linux-gnu, GTK+ Version
3.24.24, cairo version 1.16.0)
of 2022-06-25 built on joffe
Repository revision: 3d3029353b95360e374fc673339b7c8cd5568db1
Repository branch: bug-56148-recentf-open
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)
Configured using:
'configure --with-native-compilation'
Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB
Important settings:
value of $LC_COLLATE: C
value of $LC_CTYPE: sv_SE.UTF-8
value of $LC_TIME: C
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8-unix
^ permalink raw reply related [flat|nested] 4+ messages in thread
* bug#56225: args-out-of-range error in tramp-debug-buffer-command-completion-p
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
2022-06-28 21:20 ` Stefan Kangas
0 siblings, 1 reply; 4+ messages in thread
From: Michael Albinus @ 2022-06-26 9:04 UTC (permalink / raw)
To: Stefan Kangas; +Cc: 56225
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.
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-06-29 7:56 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2022-06-28 21:20 ` Stefan Kangas
2022-06-29 7:56 ` Michael Albinus
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.