GNU bug report logs -
#68593
29.1; comment-dwim: Args out of range: "", 0, 1
Previous Next
To reply to this bug, email your comments to 68593 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#68593
; Package
emacs
.
(Fri, 19 Jan 2024 21:17:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Frank Ruben <frankruben27 <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Fri, 19 Jan 2024 21:17:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
In GNU Emacs 29.1 (build 2, x86_64-w64-mingw32) of 2023-08-02 built on
AVALON
Windowing system distributor 'Microsoft Corp.', version 10.0.19045
System Description: Microsoft Windows 10 Pro (v10.0.2009.19045.3930)
Configured using:
'configure --with-modules --without-dbus --with-native-compilation=aot
--without-compress-install --with-tree-sitter CFLAGS=-O2'
Configured features:
ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY
W32NOTIFY PDUMPER PNG RSVG SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS
TREE_SITTER WEBP XPM ZLIB
(NATIVE_COMP present but libgccjit not available)
Important settings:
value of $LANG: ENU
locale-coding-system: utf-8
Major mode: C
Minor modes in effect:
save-place-mode: t
recentf-mode: t
which-function-mode: t
desktop-save-mode: t
key-chord-mode: t
override-global-mode: t
global-auto-revert-mode: t
global-so-long-mode: t
flyspell-mode: t
icomplete-mode: t
fido-mode: t
whitespace-mode: t
electric-pair-mode: t
savehist-mode: t
display-time-mode: t
shell-dirtrack-mode: t
auto-insert-mode: t
delete-selection-mode: t
cua-mode: t
global-eldoc-mode: t
show-paren-mode: t
mouse-wheel-mode: t
prettify-symbols-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
size-indication-mode: t
column-number-mode: 1
line-number-mode: 1
transient-mark-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
auto-save-visited-mode: t
abbrev-mode: t
Load-path shadows:
c:/usr/home/.emacs.d2/src/prolog hides
c:/usr/local/emacs/share/emacs/29.1/lisp/progmodes/prolog
Features:
(shadow sort mail-extr emacsbug message yank-media puny rfc822 mml mml-sec
...)
Memory information:
((conses 16 1328082 122098)
(symbols 48 35374 0)
(strings 32 187080 7259)
(string-bytes 1 5454999)
(vectors 16 81243)
(vector-slots 8 1843247 151854)
(floats 8 515 546)
(intervals 56 162466 825)
(buffers 984 88))
When in c-ts-mode.el and when having '(setq comment-end " ")' and when I
then
then run e.g. 'comment-dwim' or simpler '(comment-normalize-vars)', I'm
getting
'comment-dwim: Args out of range: "", 0, 1'.
The error comes from the two 'substring' calls in this s-sexp - where the
code
already contains my "fix" - both calls to 'substring' have been guarded by
'(if (string-equal ce "") "" ...)'.
There are surely smarter ways to fix that - if one knows what is supposed to
happen here :). But maybe that fix gives you a hint to the appropriate
solution.
(let ((ce (if (string= "" comment-end) "\n"
(comment-string-strip comment-end t t))))
(setq-local comment-end-skip
;; We use [ \t] rather than \s- because we don't want to
;; remove ^L in C mode when uncommenting.
(concat "[ \t]*\\(\\s>" (if comment-quote-nested "" "+")
"\\|" (regexp-quote (if (string-equal ce "") ""
(substring ce 0 1)))
(if (and comment-quote-nested (<= (length ce)
1)) "" "+")
(regexp-quote (if (string-equal ce "") ""
(substring ce 1)))
"\\)")))
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#68593
; Package
emacs
.
(Sat, 20 Jan 2024 06:49:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 68593 <at> debbugs.gnu.org (full text, mbox):
> From: Frank Ruben <frankruben27 <at> gmail.com>
> Date: Fri, 19 Jan 2024 22:16:04 +0100
>
> When in c-ts-mode.el and when having '(setq comment-end " ")' and when I then
> then run e.g. 'comment-dwim' or simpler '(comment-normalize-vars)', I'm getting
> 'comment-dwim: Args out of range: "", 0, 1'.
>
> The error comes from the two 'substring' calls in this s-sexp - where the code
> already contains my "fix" - both calls to 'substring' have been guarded by
> '(if (string-equal ce "") "" ...)'.
Can you tell why do you set comment-end to such a value in c-ts-mode?
What is the purpose of such a strange setting?
This bug report was last modified 1 year and 149 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.