GNU bug report logs -
#24057
25.1.50; ffap interprets comments beginning with "//" as file path
Previous Next
Reported by: Kaushal Modi <kaushal.modi <at> gmail.com>
Date: Fri, 22 Jul 2016 23:01:01 UTC
Severity: minor
Tags: fixed, patch
Merged with 7229,
8990
Found in versions 23.1, 23.3, 25.1.50
Fixed in version 26.1
Done: npostavs <at> users.sourceforge.net
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Kaushal Modi <kaushal.modi <at> 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.
This bug report was last modified 8 years and 119 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.