all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Andreas Röhler" <andreas.roehler@easy-emacs.de>
To: 20732@debbugs.gnu.org
Subject: bug#20732: in-string-p fails
Date: Thu, 04 Jun 2015 11:27:52 +0200	[thread overview]
Message-ID: <55701A18.6050503@easy-emacs.de> (raw)

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







             reply	other threads:[~2015-06-04  9:27 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-04  9:27 Andreas Röhler [this message]
2015-06-04  9:58 ` bug#20732: in-string-p fails 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

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55701A18.6050503@easy-emacs.de \
    --to=andreas.roehler@easy-emacs.de \
    --cc=20732@debbugs.gnu.org \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.