emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#20732: closed (in-string-p fails)


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#20732: closed (in-string-p fails)
Date: Thu, 04 Jun 2015 21:07:01 +0000

Your message dated Fri, 5 Jun 2015 00:06:16 +0300
with message-id <address@hidden>
and subject line Re: bug#20732: in-string-p fails
has caused the debbugs.gnu.org bug report #20732,
regarding in-string-p fails
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
20732: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=20732
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: in-string-p fails Date: Thu, 04 Jun 2015 11:27:52 +0200 User-agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.4.0
Cursor at 4th line before sdsd:

"asdf

(defun foo1 (&optional beg end)
  sdsd "

;;;

(in-string-p) returns falsely nil, because it scans from "(defun "

This would do it

(defun ar-in-string-p ()
  "Return delimiters start position, if inside, otherwise return nil. "
  (interactive)
  (save-restriction
    (widen)
    (let* ((erg (nth 8 (parse-partial-sexp (point-min) (point))))
       (la (unless erg (when (looking-at "\\s\"")
                 (match-beginning 0)))))
      (setq erg (or erg la))
      (when (interactive-p) (message "%s" erg))
      erg)))

Introduced "widen" - IMO there is no reliability without.

It also returns t if at the first char of a string-delimiter.

Source:

http://bazaar.launchpad.net/~a-roehler/s-x-emacs-werkstatt/trunk/view/head:/misc-utils.el





--- End Message ---
--- Begin Message --- Subject: Re: bug#20732: in-string-p fails Date: Fri, 5 Jun 2015 00:06:16 +0300 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0
On 06/04/2015 02:50 PM, Andreas Röhler wrote:

In question slow is better than false.

Then (setq open-paren-in-column-0-is-defun-start nil) in your Emacs config.

There is no way to know reliably if inside a string than scanning the
whole buffer. All other is woodoo.

There's a whole package dedicated to doing is faster and in easier fashion: lisp/emacs-lisp/syntax.el.

You're welcome to suggest improvements that don't sacrifice performance to this extent.

In result, it needs to consider these requests with care, re-use the
result rather then salting la code with in-string-p calls. :)

What is "it"?


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]