From: npostavs@users.sourceforge.net
To: Kaushal Modi <kaushal.modi@gmail.com>
Cc: 24057@debbugs.gnu.org
Subject: bug#24057: 25.1.50; ffap interprets comments beginning with "//" as file path
Date: Thu, 16 Mar 2017 22:10:37 -0400 [thread overview]
Message-ID: <874lys64bm.fsf@users.sourceforge.net> (raw)
In-Reply-To: <CAFyQvY35YENijaUMJeLFR_6bRuppuaVSzv8WSpmH1gHZNoBZHg@mail.gmail.com> (Kaushal Modi's message of "Mon, 25 Jul 2016 20:18:27 +0000")
Kaushal Modi <kaushal.modi@gmail.com> writes:
> * lisp/ffap.el (ffap-string-at-point): If the point is in a comment,
> ensure that the returned string does not contain the comment start
> characters (especially for major modes that have '//' as comment start
> characters).
>
Why is there a blank line here?
> Otherwise, in a major mode like c-mode, with `ido-mode' enabled and
> `ido-use-filename-at-point' set to `guess', doing "C-x C-f" on a "//foo"
> comment will initiate an attempt to access a path "//foo" (Bug#24057).
> ---
> + ;; (message "ffap-string-at-point dbg: beg = %d end = %d" beg end)
This can be removed.
> + ;; Check if END character is part of a comment.
> + (save-excursion
> + (goto-char end)
> + (nth 4 (syntax-ppss))))
This could be just (nth 4 (syntax-ppss end)).
> + (save-excursion
> + ;; Increment BEG till point at BEG is in a comment too.
> + ;; (nth 4 (syntax-ppss)) will be null for comment start
> + ;; characters (for example, for the "//" characters in
> + ;; `c-mode' line comments).
> + (setq beg (catch 'break
> + (while (< beg-new end)
> + (goto-char beg-new)
> + (if (nth 4 (syntax-ppss)) ; in a comment
> + (throw 'break beg-new)
> + (setq beg-new (1+ beg-new))))
> + end)))) ; Set BEG to END if no throw happens
This could be just
;; Move BEG to beginning of comment (after the comment start
;; characters), or END, whichever comes first.
(let ((state (syntax-ppss beg)))
(unless (nth 4 state)
(parse-partial-sexp beg end nil nil state t)
(setq beg (point))))
> + ;; (message "ffap-string-at-point dbg: beg = %d beg-new = %d"
> + ;; beg beg-new)
> + ;; (message "ffap-string-at-point dbg: ffap-string-at-point = %S"
> + ;; ffap-string-at-point)
These can be removed.
next prev parent reply other threads:[~2017-03-17 2:10 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-22 23:00 bug#24057: 25.1.50; ffap interprets comments beginning with "//" as file path Kaushal Modi
2016-07-22 23:11 ` Kaushal Modi
2016-07-23 1:26 ` npostavs
2016-07-23 7:38 ` Eli Zaretskii
2016-07-23 7:34 ` Eli Zaretskii
2016-07-23 11:56 ` Kaushal Modi
2016-07-23 13:05 ` Eli Zaretskii
2016-07-23 13:23 ` Kaushal Modi
2016-07-23 13:59 ` Eli Zaretskii
2016-07-23 18:02 ` Noam Postavsky
2016-07-23 18:20 ` Eli Zaretskii
2016-07-23 18:22 ` Eli Zaretskii
2016-07-23 21:51 ` Kaushal Modi
2016-07-24 14:16 ` Eli Zaretskii
2016-07-25 2:19 ` Kaushal Modi
2016-07-25 17:02 ` Eli Zaretskii
2016-07-25 17:13 ` Kaushal Modi
2016-07-25 17:24 ` Eli Zaretskii
2016-07-25 18:13 ` Kaushal Modi
2016-07-25 20:18 ` Kaushal Modi
2016-07-26 14:41 ` Eli Zaretskii
2016-07-26 15:11 ` Kaushal Modi
2017-03-17 2:10 ` npostavs [this message]
2017-03-17 2:13 ` npostavs
2017-03-17 22:16 ` Kaushal Modi
2017-03-17 23:30 ` npostavs
2017-03-18 1:28 ` Kaushal Modi
2017-03-18 15:41 ` npostavs
2017-03-23 13:01 ` npostavs
2017-03-23 13:30 ` Kaushal Modi
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=874lys64bm.fsf@users.sourceforge.net \
--to=npostavs@users.sourceforge.net \
--cc=24057@debbugs.gnu.org \
--cc=kaushal.modi@gmail.com \
/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).