all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Proposed patch for Bug#24627
@ 2016-10-27  9:26 Tino Calancha
  2016-11-03 11:48 ` Tino Calancha
  2016-11-03 11:48 ` bug#24627: " Tino Calancha
  0 siblings, 2 replies; 3+ messages in thread
From: Tino Calancha @ 2016-10-27  9:26 UTC (permalink / raw)
  To: Emacs developers; +Cc: Tino Calancha


Dear all,

if no further comments in ~1 week, then i will push following fix
into master branch.

Thank you.
Tino
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
From 2539012f0e3966874b5645d440ec9e23b7b528b5 Mon Sep 17 00:00:00 2001
From: Tino Calancha <tino.calancha@gmail.com>
Date: Thu, 27 Oct 2016 18:18:45 +0900
Subject: [PATCH] (thing-at-point 'list) return nil if no list at point

* lisp/thingatpt.el (thing-at-point-bounds-of-list-at-point):
Check first if we are at the beginning of a top-level sexp (Bug#24627).
If point is inside a comment or string, look for a list out of the
comment/string.
Escape '[' in doc string.
* test/lisp/thingatpt-tests.el (thing-at-point-bug24627): Update
expected test result as pass.
---
  lisp/thingatpt.el            | 25 ++++++++++---------------
  test/lisp/thingatpt-tests.el |  1 -
  2 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el
index 6d1014b..e423630 100644
--- a/lisp/thingatpt.el
+++ b/lisp/thingatpt.el
@@ -219,22 +219,17 @@ 'beginning-of-sexp

  (defun thing-at-point-bounds-of-list-at-point ()
    "Return the bounds of the list at point.
-[Internal function used by `bounds-of-thing-at-point'.]"
+\[Internal function used by `bounds-of-thing-at-point'.]"
    (save-excursion
-    (let ((opoint (point))
-	  (beg (ignore-errors
-		 (up-list -1)
-		 (point))))
-      (ignore-errors
-	(if beg
-	    (progn (forward-sexp)
-		   (cons beg (point)))
-	  ;; Are we are at the beginning of a top-level sexp?
-	  (forward-sexp)
-	  (let ((end (point)))
-	    (backward-sexp)
-	    (if (>= opoint (point))
-		(cons opoint end))))))))
+    (let* ((st (parse-partial-sexp (point-min) (point)))
+           (beg (or (and (eq 4 (car (syntax-after (point))))
+                         (not (nth 8 st))
+                         (point))
+                    (nth 1 st))))
+      (when beg
+        (goto-char beg)
+        (forward-sexp)
+        (cons beg (point))))))

  ;; Defuns

diff --git a/test/lisp/thingatpt-tests.el b/test/lisp/thingatpt-tests.el
index 71d2c88..9d72db4 100644
--- a/test/lisp/thingatpt-tests.el
+++ b/test/lisp/thingatpt-tests.el
@@ -88,7 +88,6 @@ thing-at-point-test-data
  ;; `thing-at-point-bounds-of-list-at-point'.
  (ert-deftest thing-at-point-bug24627 ()
    "Test for http://debbugs.gnu.org/24627 ."
-  :expected-result :failed
    (let ((string-result '(("(a \"b\" c)" . (a "b" c))
                           (";(a \"b\" c)")
                           ("(a \"b\" c\n)" . (a "b" c))
-- 
2.9.3

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

In GNU Emacs 26.0.50.8 (x86_64-pc-linux-gnu, GTK+ Version 3.22.1)
  of 2016-10-27
Repository revision: 0465bf511521ea780a61f1a0eb67731280e689a5



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

* bug#24627: Proposed patch for Bug#24627
  2016-10-27  9:26 Proposed patch for Bug#24627 Tino Calancha
  2016-11-03 11:48 ` Tino Calancha
@ 2016-11-03 11:48 ` Tino Calancha
  1 sibling, 0 replies; 3+ messages in thread
From: Tino Calancha @ 2016-11-03 11:48 UTC (permalink / raw)
  To: 24627-done; +Cc: Emacs developers, Tino Calancha



On Thu, 27 Oct 2016, Tino Calancha wrote:

>
> Dear all,
>
> if no further comments in ~1 week, then i will push following fix
> into master branch.
Pushed to master branch as commit 76e297c1





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

* Re: Proposed patch for Bug#24627
  2016-10-27  9:26 Proposed patch for Bug#24627 Tino Calancha
@ 2016-11-03 11:48 ` Tino Calancha
  2016-11-03 11:48 ` bug#24627: " Tino Calancha
  1 sibling, 0 replies; 3+ messages in thread
From: Tino Calancha @ 2016-11-03 11:48 UTC (permalink / raw)
  To: 24627-done; +Cc: Tino Calancha, Emacs developers



On Thu, 27 Oct 2016, Tino Calancha wrote:

>
> Dear all,
>
> if no further comments in ~1 week, then i will push following fix
> into master branch.
Pushed to master branch as commit 76e297c1



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

end of thread, other threads:[~2016-11-03 11:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-27  9:26 Proposed patch for Bug#24627 Tino Calancha
2016-11-03 11:48 ` Tino Calancha
2016-11-03 11:48 ` bug#24627: " Tino Calancha

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.