unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#20732: in-string-p fails
@ 2015-06-04  9:27 Andreas Röhler
  2015-06-04  9:58 ` Dmitry Gutov
  2015-06-04 16:00 ` Stefan Monnier
  0 siblings, 2 replies; 22+ messages in thread
From: Andreas Röhler @ 2015-06-04  9:27 UTC (permalink / raw)
  To: 20732

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







^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2015-06-06 18:41 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-04  9:27 bug#20732: in-string-p fails Andreas Röhler
2015-06-04  9:58 ` Dmitry Gutov
2015-06-04 11:50   ` Andreas Röhler
2015-06-04 21:06     ` Dmitry Gutov
2015-06-05  5:41       ` Andreas Röhler
2015-06-05  6:01       ` Andreas Röhler
2015-06-05  8:36         ` Dmitry Gutov
2015-06-05  8:58           ` Andreas Röhler
2015-06-05 11:17             ` Dmitry Gutov
2015-06-05 10:34         ` Andreas Röhler
2015-06-05 11:53           ` Andreas Röhler
2015-06-05 12:52             ` Andreas Röhler
2015-06-05 15:18         ` Stefan Monnier
2015-06-05 20:06           ` Dmitry Gutov
2015-06-04 16:00 ` Stefan Monnier
2015-06-04 20:59   ` Dmitry Gutov
2015-06-04 22:29     ` Stefan Monnier
2015-06-05 12:17       ` Dmitry Gutov
2015-06-05 15:19         ` Stefan Monnier
2015-06-06  9:59           ` Dmitry Gutov
2015-06-06 18:37             ` Drew Adams
2015-06-06 18:41               ` Dmitry Gutov

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).