From: Philip Kaludercic <philipk@posteo.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 64733@debbugs.gnu.org
Subject: bug#64733: [PATCH] ; Handle string-at-point at end of buffer gracefully
Date: Wed, 19 Jul 2023 19:17:07 +0000 [thread overview]
Message-ID: <87r0p3n230.fsf@posteo.net> (raw)
In-Reply-To: <83cz0n4t6f.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 19 Jul 2023 22:06:48 +0300")
[-- Attachment #1: Type: text/plain, Size: 125 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
> Thanks, but could you rewrite so as not to call char-after more than
> once?
Sure,
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Handle-string-at-point-at-end-of-buffer-gracefully.patch --]
[-- Type: text/x-diff, Size: 1106 bytes --]
From 6fe6b91970a50c5609e81567c4b486b02e4f1a66 Mon Sep 17 00:00:00 2001
From: Philip Kaludercic <philipk@posteo.net>
Date: Wed, 19 Jul 2023 21:14:40 +0200
Subject: [PATCH] ; Handle string-at-point at end of buffer gracefully
* lisp/thingatpt.el (thing-at-point-bounds-of-string-at-point): Check
if 'char-after' returns non-nil before passing it to
'char-syntax'. (Bug#64733)
---
lisp/thingatpt.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el
index 46e700c2091..22a356efa83 100644
--- a/lisp/thingatpt.el
+++ b/lisp/thingatpt.el
@@ -250,7 +250,8 @@ thing-at-point-bounds-of-string-at-point
(goto-char (nth 8 ppss))
(cons (point) (progn (forward-sexp) (point))))
;; At the beginning of the string
- (if (and (char-after) (eq (char-syntax (char-after)) ?\"))
+ (if (let ((ca (char-after)))
+ (and ca (eq (char-syntax ca) ?\")))
(let ((bound (bounds-of-thing-at-point 'sexp)))
(and bound
(<= (car bound) (point)) (< (point) (cdr bound))
--
2.39.2
next prev parent reply other threads:[~2023-07-19 19:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-19 18:51 bug#64733: [PATCH] ; Handle string-at-point at end of buffer gracefully Philip Kaludercic
2023-07-19 19:06 ` Eli Zaretskii
2023-07-19 19:17 ` Philip Kaludercic [this message]
2023-07-20 4:40 ` Eli Zaretskii
2023-07-20 6:57 ` Philip Kaludercic
2023-07-20 7:38 ` Eli Zaretskii
2023-07-20 8:42 ` Philip Kaludercic
2023-07-20 10:21 ` Eli Zaretskii
2023-07-21 14:53 ` Philip Kaludercic
2023-07-21 15:13 ` Eli Zaretskii
2023-07-22 7:21 ` Philip Kaludercic
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=87r0p3n230.fsf@posteo.net \
--to=philipk@posteo.net \
--cc=64733@debbugs.gnu.org \
--cc=eliz@gnu.org \
/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).