Am 05.06.2015 um 12:34 schrieb Andreas Röhler:
Am 05.06.2015 um 08:01 schrieb Andreas Röhler:
Meanwhile think calling "widen" here is a mistake. Rather accept
narrowing might change the buffers state WRT in-string-p
Here the corrected forms:
(defun ar-in-string-p ()
"Return position, if inside or at opening delimiter.
Otherwise return nil. "
(interactive)
(let* ((pps (parse-partial-sexp (point-min) (point)))
(erg (and (nth 3 pps) (nth 8 pps)))
(la (unless erg (when (eq (char-syntax (char-after)) 34)
(point)))))
(setq erg (or erg la))
(when (interactive-p) (message "%s" erg))
erg))
(defun ar-in-string-p-fast ()
"Returns start position if inside, nil otherwise. "
(ignore-errors (nth 8 (parse-partial-sexp (point-min) (point)))))
Sorry, nth 8 would be not enough:
(defun ar-in-string-p-fast ()
"Returns start position if inside, nil otherwise. "
(ignore-errors (nth 3 (parse-partial-sexp (point-min) (point)))))