emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Julien Danjou <julien@danjou.info>
To: emacs-orgmode@gnu.org
Cc: Julien Danjou <julien@danjou.info>
Subject: [PATCH] org-plist-delete rewrite
Date: Fri, 24 Dec 2010 17:46:47 +0100	[thread overview]
Message-ID: <1293209207-25615-1-git-send-email-julien@danjou.info> (raw)

* org-macs.el (org-plist-delete): Rewrite faster.

* org.el (org-plist-delete): Remove duplicate from org-macs.el.

Signed-off-by: Julien Danjou <julien@danjou.info>
---
 lisp/org-macs.el |   16 +++++++---------
 lisp/org.el      |   10 ----------
 2 files changed, 7 insertions(+), 19 deletions(-)

diff --git a/lisp/org-macs.el b/lisp/org-macs.el
index 97a8fdc..608c0d7 100644
--- a/lisp/org-macs.el
+++ b/lisp/org-macs.el
@@ -289,15 +289,13 @@ we turn off invisibility temporarily.  Use this in a `let' form."
     (goto-char (point-at-bol))
     (looking-at re)))
 
-(defun org-plist-delete (plist property)
-  "Delete PROPERTY from PLIST.
-This is in contrast to merely setting it to 0."
-  (let (p)
-    (while plist
-      (if (not (eq property (car plist)))
-	  (setq p (plist-put p (car plist) (nth 1 plist))))
-      (setq plist (cddr plist)))
-    p))
+(defun org-plist-delete (plist prop)
+    "Delete PROPERTY from PLIST."
+  (let ((p (memq prop plist)))
+    (if (not p)
+        plist
+      (setcdr p (cddr p))
+      (delq prop plist))))
 
 (defun org-replace-match-keep-properties (newtext &optional fixedcase
 						  literal string)
diff --git a/lisp/org.el b/lisp/org.el
index 5fb2ba4..dd18189 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -17995,16 +17995,6 @@ With prefix arg UNCOMPILED, load the uncompiled versions."
       (concat "\"" (mapconcat 'identity (split-string s "\"") "\"\"") "\"")
     s))
 
-(defun org-plist-delete (plist property)
-  "Delete PROPERTY from PLIST.
-This is in contrast to merely setting it to 0."
-  (let (p)
-    (while plist
-      (if (not (eq property (car plist)))
-	  (setq p (plist-put p (car plist) (nth 1 plist))))
-      (setq plist (cddr plist)))
-    p))
-
 (defun org-force-self-insert (N)
   "Needed to enforce self-insert under remapping."
   (interactive "p")
-- 
1.7.2.3

             reply	other threads:[~2010-12-24 16:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-24 16:46 Julien Danjou [this message]
2010-12-24 17:58 ` [PATCH] org-plist-delete rewrite Julien Danjou
2011-01-03 12:22 ` Carsten Dominik

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

  List information: https://www.orgmode.org/

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

  git send-email \
    --in-reply-to=1293209207-25615-1-git-send-email-julien@danjou.info \
    --to=julien@danjou.info \
    --cc=emacs-orgmode@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 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).