emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug (regression) in org-replace-disputed-keys. Bisected.
@ 2014-09-09 11:42 Teika Kazura
  2014-09-28 20:07 ` Nicolas Goaziou
  0 siblings, 1 reply; 10+ messages in thread
From: Teika Kazura @ 2014-09-09 11:42 UTC (permalink / raw)
  To: emacs-orgmode

Hello, org-world. I experience a regression in org-replace-disputed-keys, and I git-bisected it.

* Symptom: org-replace-disputed-keys doesn't work for me.
Emacs version: GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.0.12)

* How to reproduce it:
1. Put the org to "/tmp/org-mode"
2. Save the following lisp to "foo.el"
-----------------------------------------------------------------------
(progn
  (setq org-replace-disputed-keys t)
  (setq org-disputed-keys
	'(([(shift up)] . [(ctrl up)])
	  ([(shift down)] . [(ctrl down)])
	  ([(shift left)] . [(ctrl left)])
	  ([(shift right)] . [(ctrl right)])
	  ([(shift meta right)] . [(shift control right)])
	  ([(shift meta left)] . [(shift control left)])
	  ([(shift meta up)] . [(shift control up)])
	  ([(shift meta down)] . [(shift control down)])
	  ([(shift control right)] . [(shift meta right)])
	  ([(shift control left)] . [(shift meta left)]))
	)
  (add-to-list 'load-path (expand-file-name "/tmp/org-mode/lisp"))
  (pop-to-buffer "*scratch*")
  (insert "* " (org-version) " (" (org-git-version) ")\n ")
  (require 'org)
  (org-mode))
------------------------------------------------------------------------
3. Run emacs with 
  $ emacs -Q -l foo.el
4. M-x org-schedule, and press ctrl+<cursor>.

It should replace shift+<cursor>, but it doesn't. `describe-key' for C-down says:

"<C-down> runs the command forward-paragraph, which is an interactive
compiled Lisp function in `paragraphs.el'"

* The bad commit
The exact bad commit can't be tracked (org fails to initialize), but I narrowed it down to 6 commits. It was done between 9a0e84fbd7b0e25cf49613e787d572f3c71723dc and 8ad6f534f9b24f273b7699199df34c0f44f9059f .
I here show the diff for "org.el" in that period. The last 2 hunks looks relevant:
------------------------------------------------------------------------
diff --git a/lisp/org.el b/lisp/org.el
index aebf58f..7f0717e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6897,7 +6897,7 @@ of the first headline in the buffer.  This is important, because if the
 first headline is not level one, then (hide-sublevels 1) gives confusing
 results."
   (interactive)
-  (let ((l (org-current-line))
+  (let ((pos (point))
 	(level (save-excursion
 		 (goto-char (point-min))
 		 (if (re-search-forward (concat "^" outline-regexp) nil t)
@@ -6906,7 +6906,7 @@ results."
 		       (funcall outline-level))))))
     (and level (hide-sublevels level))
     (recenter '(4))
-    (org-goto-line l)))
+    (goto-char pos)))
 
 (defun org-content (&optional arg)
   "Show all headlines in the buffer, like a table of contents.
@@ -14050,10 +14050,19 @@ See also `org-scan-tags'.
 	minus tag mm
 	tagsmatch todomatch tagsmatcher todomatcher kwd matcher
 	orterms term orlist re-p str-p level-p level-op time-p
-	prop-p pn pv po gv rest)
+	prop-p pn pv po gv rest (start 0) (ss 0))
     ;; Expand group tags
     (setq match (org-tags-expand match))
-    (if (string-match "/+" match)
+
+    ;; Check if there is a TODO part of this match, which would be the
+    ;; part after a "/".  TO make sure that this slash is not part of
+    ;; a property value to be matched against, we also check that there
+    ;; is no " after that slash.
+    ;; First, find the last slash
+    (while (string-match "/+" match ss)
+      (setq start (match-beginning 0) ss (match-end 0)))
+    (if (and (string-match "/+" match start)
+	     (not (save-match-data (string-match "\"" match start))))
 	;; match contains also a todo-matching request
 	(progn
 	  (setq tagsmatch (substring match 0 (match-beginning 0))
@@ -16126,7 +16135,8 @@ So these are more for recording a certain time/date."
 (defvar org-read-date-inactive)
 
 (defvar org-read-date-minibuffer-local-map
-  (let ((map (make-sparse-keymap)))
+  (let* ((org-replace-disputed-keys nil)
+	 (map (make-sparse-keymap)))
     (set-keymap-parent map minibuffer-local-map)
     (org-defkey map (kbd ".")
                 (lambda () (interactive)
@@ -16286,7 +16296,6 @@ user."
 					  (calendar-current-date))))
 		(org-eval-in-calendar nil t)
 		(let* ((old-map (current-local-map))
-		       (org-replace-disputed-keys nil)
 		       (map (copy-keymap calendar-mode-map))
 		       (minibuffer-local-map
 			(copy-keymap org-read-date-minibuffer-local-map)))
------------------------------------------------------------------------

Thank you very much for developing org-mode.

Kind regards,
Teika (Teika kazura)

# Hey, it was almost exacly a year ago. Only few use this feature? ;]

^ permalink raw reply related	[flat|nested] 10+ messages in thread
* Bug (regression) in org-replace-disputed-keys. Bisected.
@ 2014-09-17  8:42 Teika Kazura
  0 siblings, 0 replies; 10+ messages in thread
From: Teika Kazura @ 2014-09-17  8:42 UTC (permalink / raw)
  To: emacs-orgmode

Hello, org-list. I experience a regression in org-replace-disputed-keys, and I git-bisect'ed it.

* Symptom: org-replace-disputed-keys doesn't work for me.
Emacs version: GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.0.12)

* How to reproduce it:
1. Put the org to "/tmp/org-mode"
2. Save the following lisp to "minimal-org.el"
-----------------------------------------------------------------------
(progn
  (setq org-replace-disputed-keys t)
  (setq org-disputed-keys
	'(([(shift up)] . [(ctrl up)])
	  ([(shift down)] . [(ctrl down)])
	  ([(shift left)] . [(ctrl left)])
	  ([(shift right)] . [(ctrl right)])
	  ([(shift meta right)] . [(shift control right)])
	  ([(shift meta left)] . [(shift control left)])
	  ([(shift meta up)] . [(shift control up)])
	  ([(shift meta down)] . [(shift control down)])
	  ([(shift control right)] . [(shift meta right)])
	  ([(shift control left)] . [(shift meta left)]))
	)
  (add-to-list 'load-path (expand-file-name "/tmp/org-mode/lisp"))
  (pop-to-buffer "*scratch*")
  (insert "* " (org-version) " (" (org-git-version) ")\n ")
  (require 'org)
  (org-mode))
------------------------------------------------------------------------
3. Run emacs with 
  $ emacs -Q -l minimal-org.el
4. M-x org-schedule, and press ctrl+<cursor>.

Shift+<cursor> should be replaced with ctrl+<cursor>, but they aren't. For example `describe-key' for C-down says:

"<C-down> runs the command forward-paragraph, which is an interactive
compiled Lisp function in `paragraphs.el'"

* The bad commit
The exact bad commit can't be tracked (org fails to initialize), but I narrowed it down to 6 commits. It was done between 9a0e84fbd7b0e25cf49613e787d572f3c71723dc and 8ad6f534f9b24f273b7699199df34c0f44f9059f .
I here show the diff for "org.el" in that period. The last 2 hunks looks relevant:
------------------------------------------------------------------------
diff --git a/lisp/org.el b/lisp/org.el
index aebf58f..7f0717e 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6897,7 +6897,7 @@ of the first headline in the buffer.  This is important, because if the
 first headline is not level one, then (hide-sublevels 1) gives confusing
 results."
   (interactive)
-  (let ((l (org-current-line))
+  (let ((pos (point))
 	(level (save-excursion
 		 (goto-char (point-min))
 		 (if (re-search-forward (concat "^" outline-regexp) nil t)
@@ -6906,7 +6906,7 @@ results."
 		       (funcall outline-level))))))
     (and level (hide-sublevels level))
     (recenter '(4))
-    (org-goto-line l)))
+    (goto-char pos)))
 
 (defun org-content (&optional arg)
   "Show all headlines in the buffer, like a table of contents.
@@ -14050,10 +14050,19 @@ See also `org-scan-tags'.
 	minus tag mm
 	tagsmatch todomatch tagsmatcher todomatcher kwd matcher
 	orterms term orlist re-p str-p level-p level-op time-p
-	prop-p pn pv po gv rest)
+	prop-p pn pv po gv rest (start 0) (ss 0))
     ;; Expand group tags
     (setq match (org-tags-expand match))
-    (if (string-match "/+" match)
+
+    ;; Check if there is a TODO part of this match, which would be the
+    ;; part after a "/".  TO make sure that this slash is not part of
+    ;; a property value to be matched against, we also check that there
+    ;; is no " after that slash.
+    ;; First, find the last slash
+    (while (string-match "/+" match ss)
+      (setq start (match-beginning 0) ss (match-end 0)))
+    (if (and (string-match "/+" match start)
+	     (not (save-match-data (string-match "\"" match start))))
 	;; match contains also a todo-matching request
 	(progn
 	  (setq tagsmatch (substring match 0 (match-beginning 0))
@@ -16126,7 +16135,8 @@ So these are more for recording a certain time/date."
 (defvar org-read-date-inactive)
 
 (defvar org-read-date-minibuffer-local-map
-  (let ((map (make-sparse-keymap)))
+  (let* ((org-replace-disputed-keys nil)
+	 (map (make-sparse-keymap)))
     (set-keymap-parent map minibuffer-local-map)
     (org-defkey map (kbd ".")
                 (lambda () (interactive)
@@ -16286,7 +16296,6 @@ user."
 					  (calendar-current-date))))
 		(org-eval-in-calendar nil t)
 		(let* ((old-map (current-local-map))
-		       (org-replace-disputed-keys nil)
 		       (map (copy-keymap calendar-mode-map))
 		       (minibuffer-local-map
 			(copy-keymap org-read-date-minibuffer-local-map)))
------------------------------------------------------------------------

Thank you very much for developing org-mode.

Kind regards,
Teika (Teika kazura)

# Hey, it was almost exacly a year ago. Only few use this feature? ;]

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

end of thread, other threads:[~2014-11-19  9:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-09 11:42 Bug (regression) in org-replace-disputed-keys. Bisected Teika Kazura
2014-09-28 20:07 ` Nicolas Goaziou
2014-10-01  1:22   ` Teika Kazura
2014-11-03 20:54     ` Nicolas Goaziou
2014-11-12 11:49       ` [patch] " Teika Kazura
2014-11-13 22:32         ` Nicolas Goaziou
2014-11-14 22:29       ` Miro Bezjak
2014-11-18 21:32         ` Nicolas Goaziou
2014-11-19  9:50           ` Miro Bezjak
  -- strict thread matches above, loose matches on Subject: below --
2014-09-17  8:42 Teika Kazura

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).