all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* improving debug output of get-buffer
@ 2023-11-01 18:06 StrawberryTea
  2023-11-01 19:38 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: StrawberryTea @ 2023-11-01 18:06 UTC (permalink / raw)
  To: emacs-devel

Hello.

Following our PR discussion in
https://github.com/akreisher/eshell-syntax-highlighting/pull/15, I was
wondering if anyone thinks it's a good idea to modify the get-buffer C
code so that it returns an error like "(wrong-type-argument
string-or-buffer-p nil)" instead of "(wrong-type-argument stringp nil)".

Sincerely,
StrawberryTea




^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: improving debug output of get-buffer
@ 2023-11-02 15:11 Rahguzar
  2023-11-02 16:44 ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Rahguzar @ 2023-11-02 15:11 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: StrawberryTea, emacs-devel

Hi Eli,
I was the other participant in the original discussion that led to this
thread.

Eli Zaretskii <eliz@gnu.org> writes:

>> That makes sense. But basically, we were using with-current-buffer, which uses
>> set-buffer and it took time to realize the “(wrong-type-argument stringp nil)”
>> error was from that with-current-buffer.
>
> And the backtrace didn't tell you the error was from set-buffer?

No backtrace stopped before `set-buffer`.

The backtrace was

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  eshell-syntax-highlighting--highlight-elisp(113 120)
  eshell-syntax-highlighting--parse-and-highlight(command 120)
  #<subr eshell-syntax-highlighting--enable-highlighting>()
  apply(#<subr eshell-syntax-highlighting--enable-highlighting> nil)
  (condition-case err (apply func args) ((debug error) (signal (car err) (cdr err))))
  cae-debug-reraise-error(#<subr eshell-syntax-highlighting--enable-highlighting>)
  apply(cae-debug-reraise-error #<subr eshell-syntax-highlighting--enable-highlighting> nil)
  eshell-syntax-highlighting--enable-highlighting()

where the function `eshell-syntax-highlighting--highlight-elisp` uses
the `with-current-buffer`.

I have been flummoxed by similar problems a few times before. Usually it
is `(with-current-buffer var body)` where `var` is a variable whose value
is I expect to be a buffer but which actually in nil. The
`(wrong-type-argument stringp nil)` makes me go looking for nil strings
in the body rather than realizing that the problem is with var
especially since `set-buffer` tends not to popup in the backtrace.

> In any case, your original question was about get-buffer, not about
> set-buffer.  Are you actually asking about set-buffer?

`set-buffer` is more relevant yes.

Thanks,
Rahguzar



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-11-04  8:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-01 18:06 improving debug output of get-buffer StrawberryTea
2023-11-01 19:38 ` Eli Zaretskii
2023-11-01 20:02   ` StrawberryTea
2023-11-02  6:00     ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2023-11-02 15:11 Rahguzar
2023-11-02 16:44 ` Eli Zaretskii
2023-11-02 16:57   ` Rahguzar
2023-11-04  8:45     ` Eli Zaretskii

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.