Hmm... I realize I should have thought some more about this before
posting the original patch.

I have second thoughts:

I think the behavior to take property under cursor as the one intended
to change when editing properties feels forcing and may be confusing.

Therefore I suggest two alternatives:

make it default alternative

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d6a0f76..425be41 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,13 @@
 2010-03-11  Mikael Fornius  <m...@abc.se>
 
+	* org.el (org-set-property, org-delete-property)
+	(org-delete-property-globally): Suggest property at cursor as
+	initial input in completing-read instead of taking it as chosen.
+	For a more natural behavior. (Initial input does not work with
+	iswtichb.)
+
+2010-03-11  Mikael Fornius  <m...@abc.se>
+
 	* org.el (org-at-property-p): Check if we are inside a property
 	drawer not just any drawer.
 	(org-set-property, org-delete-property): When cursor is on a
diff --git a/lisp/org.el b/lisp/org.el
index a4932a2..0ba61fe 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12986,8 +12986,8 @@ in the current file."
   (interactive
    (let* ((completion-ignore-case t)
 	  (keys (org-buffer-property-keys nil t t))
-	  (prop0 (or (when (org-at-property-p) (org-match-string-no-properties 2))
-		     (org-icompleting-read "Property: " (mapcar 'list keys))))
+	  (prop0 (org-icompleting-read "Property: " (mapcar 'list keys) nil nil
+				       (when (org-at-property-p) (org-match-string-no-properties 2))))
 	  (prop (if (member prop0 keys)
 		    prop0
 		  (or (cdr (assoc (downcase prop0)
@@ -13014,9 +13014,8 @@ in the current file."
   "In the current entry, delete PROPERTY."
   (interactive
    (let* ((completion-ignore-case t)
-	  (prop (or (when (org-at-property-p) (org-match-string-no-properties 2))
-		    (org-icompleting-read
-		     "Property: " (org-entry-properties nil 'standard)))))
+	  (prop (org-icompleting-read "Property: " (org-entry-properties nil 'standard) nil nil
+				      (when (org-at-property-p) (org-match-string-no-properties 2)))))
      (list prop)))
   (message "Property %s %s" property
 	   (if (org-entry-delete nil property)
@@ -13027,9 +13026,9 @@ in the current file."
   "Remove PROPERTY globally, from all entries."
   (interactive
    (let* ((completion-ignore-case t)
-	  (prop (org-icompleting-read
-		 "Globally remove property: "
-		 (mapcar 'list (org-buffer-property-keys)))))
+	  (prop (org-icompleting-read "Globally remove property: "
+				      (mapcar 'list (org-buffer-property-keys))  nil nil
+				      (when (org-at-property-p) (org-match-string-no-properties 2)))))
      (list prop)))
   (save-excursion
     (save-restriction
or always prompt (like before)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index d6a0f76..4c4aac7 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,10 @@
 2010-03-11  Mikael Fornius  <m...@abc.se>
 
+	* org.el (org-set-property, org-delete-property): Reverted to old
+	behaviour: do not use property at cursor but prompt always.
+
+2010-03-11  Mikael Fornius  <m...@abc.se>
+
 	* org.el (org-at-property-p): Check if we are inside a property
 	drawer not just any drawer.
 	(org-set-property, org-delete-property): When cursor is on a
diff --git a/lisp/org.el b/lisp/org.el
index a4932a2..72dfa9d 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -12986,8 +12986,7 @@ in the current file."
   (interactive
    (let* ((completion-ignore-case t)
 	  (keys (org-buffer-property-keys nil t t))
-	  (prop0 (or (when (org-at-property-p) (org-match-string-no-properties 2))
-		     (org-icompleting-read "Property: " (mapcar 'list keys))))
+	  (prop0 (org-icompleting-read "Property: " (mapcar 'list keys)))
 	  (prop (if (member prop0 keys)
 		    prop0
 		  (or (cdr (assoc (downcase prop0)
@@ -13014,9 +13013,7 @@ in the current file."
   "In the current entry, delete PROPERTY."
   (interactive
    (let* ((completion-ignore-case t)
-	  (prop (or (when (org-at-property-p) (org-match-string-no-properties 2))
-		    (org-icompleting-read
-		     "Property: " (org-entry-properties nil 'standard)))))
+	  (prop (org-icompleting-read "Property: " (org-entry-properties nil 'standard))))
      (list prop)))
   (message "Property %s %s" property
 	   (if (org-entry-delete nil property)
For me they feels the same but I think the "always prompt" alternative
is better because it is simpler.

Simple is always good.

Sorry for spamming the change-log.

-- 
Mikael Fornius
_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to