From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.bugs Subject: bug#24057: 25.1.50; ffap interprets comments beginning with "//" as file path Date: Mon, 25 Jul 2016 20:18:27 +0000 Message-ID: References: <83lh0sx0yf.fsf@gnu.org> <83shv0v716.fsf@gnu.org> <83poq4v4jk.fsf@gnu.org> <83wpkbt92i.fsf@gnu.org> <83mvl5tzv7.fsf@gnu.org> <83invttyv7.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a1134fc8c4dae9a05387b7d8e X-Trace: ger.gmane.org 1469477971 21001 80.91.229.3 (25 Jul 2016 20:19:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 25 Jul 2016 20:19:31 +0000 (UTC) Cc: 24057@debbugs.gnu.org, npostavs@users.sourceforge.net To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jul 25 22:19:19 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1bRmLO-0002Sl-PH for geb-bug-gnu-emacs@m.gmane.org; Mon, 25 Jul 2016 22:19:19 +0200 Original-Received: from localhost ([::1]:34873 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRmLN-0006Zv-PH for geb-bug-gnu-emacs@m.gmane.org; Mon, 25 Jul 2016 16:19:17 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53783) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRmLC-0006Sa-SK for bug-gnu-emacs@gnu.org; Mon, 25 Jul 2016 16:19:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bRmL8-00081E-Db for bug-gnu-emacs@gnu.org; Mon, 25 Jul 2016 16:19:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53115) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bRmL8-00081A-9P for bug-gnu-emacs@gnu.org; Mon, 25 Jul 2016 16:19:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bRmL8-0001In-5d for bug-gnu-emacs@gnu.org; Mon, 25 Jul 2016 16:19:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Kaushal Modi Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 25 Jul 2016 20:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24057 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24057-submit@debbugs.gnu.org id=B24057.14694779254982 (code B ref 24057); Mon, 25 Jul 2016 20:19:02 +0000 Original-Received: (at 24057) by debbugs.gnu.org; 25 Jul 2016 20:18:45 +0000 Original-Received: from localhost ([127.0.0.1]:37219 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bRmKr-0001II-7X for submit@debbugs.gnu.org; Mon, 25 Jul 2016 16:18:45 -0400 Original-Received: from mail-it0-f54.google.com ([209.85.214.54]:37860) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bRmKp-0001I6-Iz for 24057@debbugs.gnu.org; Mon, 25 Jul 2016 16:18:44 -0400 Original-Received: by mail-it0-f54.google.com with SMTP id f6so116466023ith.0 for <24057@debbugs.gnu.org>; Mon, 25 Jul 2016 13:18:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+/9IxKc8EyuUuCP3tNP3FS27ieNxgooHHiE8Awi/YD8=; b=Yim1YwdxTexwE3UcKrrwTLszokrydWodAWq1CW+jZleA2I6XNjyttAMs84+u8oqvqU UcKwb16ZrL0NHoq6uA9KrJoW9gnKKQwYzu49PXTkHBVVkOcidV07I5NvIGWz6p7fhcsM CFy73mCKYYWbsNddslmNLxnUTE7e7GsLuAuIMbo978Mp7czTA5fkEBh9AFsfQ3SOHYqp gpjRf5g0D1BI66vKw8TLAOPpkk9JDO5k6hZmPqigLIODVfLFnRaYyY9ud+HNRyutuJyb L26ugISyhBQGvFGSgzgdyG/3k1BXijLfR/Hf45wptLPX5DPtIHx6alv0/MCjsC8Qo0d3 mzDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+/9IxKc8EyuUuCP3tNP3FS27ieNxgooHHiE8Awi/YD8=; b=Sy6OyiMjeSmoPFPub1v0rxiq5NZzYb2Y+zUwMDZqlPqhgFNxGQQ/PHDnBEMtFzERW6 Lqtjnpt7JV8WfrViXg8cfWVzUENsJJPrAlLabaLOaYSC+1c0tlRReVs2zkD8xwc1D+TW XNN1Mcx5H7D5oUO/6LdY3VzhiYnQhpue1Sj9/YRTB1Dvz43cVO29BkdH20gqGlf6IIu9 do4+OWYvb++H2O0gPL8LjGNlnVU0rBhCrnkN+LS1DKY4SscMI46L7w63kU2wtfwvKsCa EQJ+Pa5R3AWcoIuJSQicVd4T0/NrFHuBmGMBCOthfDBJIdpNnldUiXbLqGfIiNYxjuqh u67A== X-Gm-Message-State: AEkoouvLDjS2yYVbrpaMV1Hr7ct0KBOT2fSX0UaOzsIwGs4+GOD1Pd03CEHwiZaL944+PWH/kICWsGd6aNJyhA== X-Received: by 10.202.199.149 with SMTP id x143mr10925563oif.50.1469477917927; Mon, 25 Jul 2016 13:18:37 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:121533 Archived-At: --001a1134fc8c4dae9a05387b7d8e Content-Type: text/plain; charset=UTF-8 Here a git formatted patch .. it's an optimized, generic version of the snippet in my previous email. It's now "/" agnostic. Here's the new table of expected values of ffap-string-at-point: (x indicates the (point)) |-----------------------------------+---------------------------------| | Example string in `c-mode' buffer | Returned `ffap-string-at-point' | |-----------------------------------+---------------------------------| | x//tmp | "tmp" | | //xtmp | "tmp" | | x///tmp | "/tmp" | | //x/tmp | "/tmp" | | x////tmp | "//tmp" | | ////xtmp | "//tmp" | | x// //tmp | "" | | // x/tmp | "/tmp" | | // x//tmp | "//tmp" | |-----------------------------------+---------------------------------| ===== Patch follows >From 5e000cebb993a8cdccdf5e67f6b0eb66b4a267d8 Mon Sep 17 00:00:00 2001 From: Kaushal Modi Date: Mon, 25 Jul 2016 16:08:50 -0400 Subject: [PATCH] Do not include comment start chars in ffap string * 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). 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). --- lisp/ffap.el | 87 +++++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 65 insertions(+), 22 deletions(-) diff --git a/lisp/ffap.el b/lisp/ffap.el index 7013e6e..8708a17 100644 --- a/lisp/ffap.el +++ b/lisp/ffap.el @@ -1097,33 +1097,76 @@ ffap-string-at-point (defun ffap-string-at-point (&optional mode) "Return a string of characters from around point. + MODE (defaults to value of `major-mode') is a symbol used to look up string syntax parameters in `ffap-string-at-point-mode-alist'. + If MODE is not found, we use `file' instead of MODE. -If the region is active, return a string from the region. -Sets the variable `ffap-string-at-point' and the variable -`ffap-string-at-point-region'." + +If the region is active,return a string from the region. + +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). + +Sets variables `ffap-string-at-point' and `ffap-string-at-point-region'. " (let* ((args - (cdr - (or (assq (or mode major-mode) ffap-string-at-point-mode-alist) - (assq 'file ffap-string-at-point-mode-alist)))) - (pt (point)) - (beg (if (use-region-p) - (region-beginning) - (save-excursion - (skip-chars-backward (car args)) - (skip-chars-forward (nth 1 args) pt) - (point)))) - (end (if (use-region-p) - (region-end) - (save-excursion - (skip-chars-forward (car args)) - (skip-chars-backward (nth 2 args) pt) - (point))))) + (cdr + (or (assq (or mode major-mode) ffap-string-at-point-mode-alist) + (assq 'file ffap-string-at-point-mode-alist)))) + (region-selected (use-region-p)) + (pt (point)) + (beg (if region-selected + (region-beginning) + (save-excursion + (skip-chars-backward (car args)) + (skip-chars-forward (nth 1 args) pt) + (point)))) + (end (if region-selected + (region-end) + (save-excursion + (skip-chars-forward (car args)) + (skip-chars-backward (nth 2 args) pt) + (point)))) + (beg-new beg)) + ;; (message "ffap-string-at-point dbg: beg = %d end = %d" beg end) + ;; If the initial characters of the to-be-returned string are the + ;; current major mode's comment starter characters, *and* are not + ;; part of a comment, remove those from the returned string + ;; (Bug#24057). + ;; Example comments in `c-mode' (which considers lines beginning + ;; with "//" as comments): + ;; //tmp - This is a comment. It does not contain any path reference. + ;; ///tmp - This is a comment. The "/tmp" portion in that is a path. + ;; ////tmp - This is a comment. The "//tmp" portion in that is a path. + (when (and + ;; Proceed if no region is selected by the user. + (null region-selected) + ;; Check if END character is part of a comment. + (save-excursion + (goto-char end) + (nth 4 (syntax-ppss)))) + (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 + ;; (message "ffap-string-at-point dbg: beg = %d beg-new = %d" + ;; beg beg-new) (setq ffap-string-at-point - (buffer-substring-no-properties - (setcar ffap-string-at-point-region beg) - (setcar (cdr ffap-string-at-point-region) end))))) + (buffer-substring-no-properties + (setcar ffap-string-at-point-region beg) + (setcar (cdr ffap-string-at-point-region) end))) + ;; (message "ffap-string-at-point dbg: ffap-string-at-point = %S" + ;; ffap-string-at-point) + ffap-string-at-point)) (defun ffap-string-around () ;; Sometimes useful to decide how to treat a string. -- 2.9.2 -- Kaushal Modi --001a1134fc8c4dae9a05387b7d8e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Here a git formatted patch .. it's an optimized, gener= ic version of the snippet in my previous email. It's now "/" = agnostic.

Here's the new table of expected values of= ffap-string-at-point:
(x indicates the (point))

|-----------------------------------= +---------------------------------|
| Example string in `c-mode' buffer | Returned `ffap-string-at-point= ' |
|------------------------= -----------+---------------------------------|
| x//tmp =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| "tmp" =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 |
| //xtmp =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0| "tmp" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |
| x///tmp =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 | "/tmp" =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0|
| //x/tmp =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 | "/tmp" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|
| x////tmp =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| "//tmp" =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |
| ////xtmp =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| "//tmp&qu= ot; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 |
| x// //tmp =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 | "" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0|
| // x/tmp =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| "/tmp" =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0|
| // x//tmp =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 | "//tmp" =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 |
|-----------------------------------+---------------------------------|=

=3D=3D=3D=3D=3D Patch follows
<= div>
From 5e000cebb993a8cdccdf5e67f6b0eb66b4a267d8 Mon S= ep 17 00:00:00 2001
From: Kaushal Modi <kaushal.modi@gmail.com>
Date: Mon, 25 = Jul 2016 16:08:50 -0400
Subject: [PATCH] Do not include comment s= tart chars in ffap string

* lisp/ffap.el (ffap-str= ing-at-point): If the point is in a comment,
ensure that the retu= rned string does not contain the comment start
characters (especi= ally for major modes that have '//' as comment start
char= acters).

Otherwise, in a major mode like c-mode, w= ith `ido-mode' enabled and
`ido-use-filename-at-point' se= t to `guess', doing "C-x C-f" on a "//foo"
comment will initiate an attempt to access a path "//foo" (Bug#= 24057).
---
=C2=A0lisp/ffap.el | 87 +++++++++++++++++++= ++++++++++++++++++++++++++---------------
=C2=A01 file changed, 6= 5 insertions(+), 22 deletions(-)

diff --git a/lisp= /ffap.el b/lisp/ffap.el
index 7013e6e..8708a17 100644
-= -- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -1097,33 +1097,= 76 @@ ffap-string-at-point
=C2=A0
=C2=A0(defun ffap-str= ing-at-point (&optional mode)
=C2=A0 =C2=A0"Return a str= ing of characters from around point.
+
=C2=A0MODE (defa= ults to value of `major-mode') is a symbol used to look up
= =C2=A0string syntax parameters in `ffap-string-at-point-mode-alist'.
+
=C2=A0If MODE is not found, we use `file' instead o= f MODE.
-If the region is active, return a string from the region= .
-Sets the variable `ffap-string-at-point' and the variable<= /div>
-`ffap-string-at-point-region'."
+
+= If the region is active,return a string from the region.
+
<= div>+If the point is in a comment, ensure that the returned string does not= contain
+the comment start characters (especially for major mode= s that have '//' as
+comment start characters).
+
+Sets variables `ffap-string-at-point' and `ffap-string-at= -point-region'. "
=C2=A0 =C2=A0(let* ((args
-<= span class=3D"Apple-tab-span" style=3D"white-space:pre"> =C2=A0(cdr=
- =C2=A0 (or (assq (or mode major-mode) ffap-string-at-point-mode-alist)
- = =C2=A0 =C2=A0 =C2=A0 (assq 'file ffap-string-at-point-mode-alist))))
- = (pt (point))
- (beg (if (use-region-p)
- =C2=A0(region-beginning)
- (save= -excursion
- =C2=A0(skip-chars-backward (car args))
- =C2=A0(skip-chars-f= orward (nth 1 args) pt)
- =C2=A0(point))))
- (end (if (use-region-p)
=
- = =C2=A0(region-end)
- (save-excursion
- =C2=A0(skip-chars-forward (car args= ))
- =C2=A0(skip-chars-backward (nth 2 args) pt)
- =C2=A0(point)))))
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(cdr
+ =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 (or (assq (or mode major-mode) ffap-string-at-point-mo= de-alist)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (ass= q 'file ffap-string-at-point-mode-alist))))
+ =C2=A0 =C2=A0 = =C2=A0 =C2=A0 (region-selected (use-region-p))
+ =C2=A0 =C2=A0 = =C2=A0 =C2=A0 (pt (point))
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 (beg (if= region-selected
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0(region-beginning)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0(save-excursion
+ =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(skip-chars-backward (car args= ))
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(skip-chars-forward (nth 1 args) pt)
+ =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(point))))
+ =C2=A0 =C2= =A0 =C2=A0 =C2=A0 (end (if region-selected
+ =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(region-end)
+ =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(save-excursion
+= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(skip-chars-= forward (car args))
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0(skip-chars-backward (nth 2 args) pt)
+ =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(point))))
=
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 (beg-new beg))
+ =C2=A0 =C2=A0= ;; (message "ffap-string-at-point dbg: beg =3D %d end =3D %d" beg= end)
+ =C2=A0 =C2=A0;; If the initial characters of the to-be-re= turned string are the
+ =C2=A0 =C2=A0;; current major mode's = comment starter characters, *and* are not
+ =C2=A0 =C2=A0;; part = of a comment, remove those from the returned string
+ =C2=A0 =C2= =A0;; (Bug#24057).
+ =C2=A0 =C2=A0;; Example comments in `c-mode&= #39; (which considers lines beginning
+ =C2=A0 =C2=A0;; with &quo= t;//" as comments):
+ =C2=A0 =C2=A0;; =C2=A0//tmp - This is = a comment. It does not contain any path reference.
+ =C2=A0 =C2= =A0;; =C2=A0///tmp - This is a comment. The "/tmp" portion in tha= t is a path.
+ =C2=A0 =C2=A0;; =C2=A0////tmp - This is a comment.= The "//tmp" portion in that is a path.
+ =C2=A0 =C2=A0= (when (and
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;; Proceed if no = region is selected by the user.
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 (null region-selected)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ;= ; Check if END character is part of a comment.
+ =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 (save-excursion
+ =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 (goto-char end)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 (nth 4 (syntax-ppss))))
+ =C2=A0 =C2=A0 =C2=A0(save= -excursion
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0;; Increment BEG till poi= nt at BEG is in a comment too.
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0;; (n= th 4 (syntax-ppss)) will be null for comment start
+ =C2=A0 =C2= =A0 =C2=A0 =C2=A0;; characters (for example, for the "//" charact= ers in
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0;; `c-mode' line comments= ).
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq beg (catch 'break
=
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(while (< beg-new end)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(goto-char beg-new)
+ = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0(if (nth 4 (syntax-ppss)) ; in a comment
+ =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(t= hrow 'break beg-new)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(setq beg-new (1+ beg-new))))<= /div>
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0end)))) ; Set BEG to END if no throw happens
+ =C2=A0 =C2= =A0;; (message "ffap-string-at-point dbg: beg =3D %d beg-new =3D %d&qu= ot;
+ =C2=A0 =C2=A0;; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0beg beg-n= ew)
=C2=A0 =C2=A0 =C2=A0(setq ffap-string-at-point
- =C2=A0(buffe= r-substring-no-properties
- =C2=A0 (setcar ffap-string-at-point-region be= g)
- =C2=A0 (setcar (cdr ffap-string-at-point-region) end)))))
+ = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(buffer-substring-no-properties
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (setcar ffap-string-at-point-region b= eg)
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (setcar (cdr ffap-string= -at-point-region) end)))
+ =C2=A0 =C2=A0;; (message "ffap-st= ring-at-point dbg: ffap-string-at-point =3D %S"
+ =C2=A0 =C2= =A0;; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ffap-string-at-point)
+ = =C2=A0 =C2=A0ffap-string-at-point))
=C2=A0
=C2=A0(defun= ffap-string-around ()
=C2=A0 =C2=A0;; Sometimes useful to decide= how to treat a string.
--=C2=A0
2.9.2

--

Kaushal Modi

--001a1134fc8c4dae9a05387b7d8e--