diff options
author | Bastien Guerry <bzg@altern.org> | 2012-08-15 09:35:21 +0200 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2012-08-15 09:35:21 +0200 |
commit | 722e0e0c83df32fbf0c858beb07d108a48a7c4ce (patch) | |
tree | b493acd5fe9695f7fe4e9c8bd1ec8ca470e2b2c1 | |
parent | 16ea0364a4e1c561a9f166586e484b5c1235683c (diff) | |
download | org-mode-722e0e0c83df32fbf0c858beb07d108a48a7c4ce.tar.gz |
Remove `org-substring-no-properties' and some redundant code
* org-macs.el (org-no-properties): Allow a new parameter
`restricted' to restrict the properties removal to those in
`org-rm-props'. The default is now to remove all properties.
* org-compat.el (org-substring-no-properties): Remove unused
defun.
* org-remember.el (org-remember-apply-template): Remove
redundant removal of text properties.
(org-remember-apply-template): Use `org-no-properties'.
* org-capture.el (org-capture-fill-template): Remove redundant
removal of text properties.
(org-capture-fill-template): Use `org-no-properties'.
* org-gnus.el (org-gnus-open, org-gnus-follow-link): Use
`org-no-properties'.
-rw-r--r-- | lisp/org-capture.el | 7 | ||||
-rw-r--r-- | lisp/org-compat.el | 5 | ||||
-rw-r--r-- | lisp/org-gnus.el | 8 | ||||
-rw-r--r-- | lisp/org-macs.el | 9 | ||||
-rw-r--r-- | lisp/org-remember.el | 7 |
5 files changed, 17 insertions, 19 deletions
diff --git a/lisp/org-capture.el b/lisp/org-capture.el index e8ce699..a59d9ee 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -1299,8 +1299,7 @@ Lisp programs can force the template by setting KEYS to a string." The template may still contain \"%?\" for cursor positioning." (setq template (or template (org-capture-get :template))) (when (stringp initial) - (setq initial (org-no-properties initial)) - (remove-text-properties 0 (length initial) '(read-only t) initial)) + (setq initial (org-no-properties initial))) (let* ((buffer (org-capture-get :buffer)) (file (buffer-file-name (or (buffer-base-buffer buffer) buffer))) (ct (org-capture-get :default-time)) @@ -1344,7 +1343,7 @@ The template may still contain \"%?\" for cursor positioning." v-a)) (v-n user-full-name) (v-k (if (marker-buffer org-clock-marker) - (org-substring-no-properties org-clock-heading))) + (org-no-properties org-clock-heading))) (v-K (if (marker-buffer org-clock-marker) (org-make-link-string (buffer-file-name (marker-buffer org-clock-marker)) @@ -1477,7 +1476,7 @@ The template may still contain \"%?\" for cursor positioning." '(clipboards . 1) (car clipboards)))))) ((equal char "p") - (org-set-property (org-substring-no-properties prompt) nil)) + (org-set-property (org-no-properties prompt) nil)) (char ;; These are the date/time related ones (setq org-time-was-given (equal (upcase char) char)) diff --git a/lisp/org-compat.el b/lisp/org-compat.el index 7003558..1473c24 100644 --- a/lisp/org-compat.el +++ b/lisp/org-compat.el @@ -331,11 +331,6 @@ Works on both Emacs and XEmacs." string) (apply 'propertize string properties))) -(defun org-substring-no-properties (string &optional from to) - (if (featurep 'xemacs) - (org-no-properties (substring string (or from 0) to)) - (substring-no-properties string from to))) - (defmacro org-find-library-dir (library) `(file-name-directory (locate-library ,library))) diff --git a/lisp/org-gnus.el b/lisp/org-gnus.el index 86c58e1..de8a00f 100644 --- a/lisp/org-gnus.el +++ b/lisp/org-gnus.el @@ -233,9 +233,9 @@ If `org-store-link' was called with a prefix arg the meaning of (setq group (match-string 1 path) article (match-string 3 path)) (when group - (setq group (org-substring-no-properties group))) + (setq group (org-no-properties group))) (when article - (setq article (org-substring-no-properties article))) + (setq article (org-no-properties article))) (org-gnus-follow-link group article))) (defun org-gnus-follow-link (&optional group article) @@ -244,9 +244,9 @@ If `org-store-link' was called with a prefix arg the meaning of (funcall (cdr (assq 'gnus org-link-frame-setup))) (if gnus-other-frame-object (select-frame gnus-other-frame-object)) (when group - (setq group (org-substring-no-properties group))) + (setq group (org-no-properties group))) (when article - (setq article (org-substring-no-properties article))) + (setq article (org-no-properties article))) (cond ((and group article) (gnus-activate-group group) (condition-case nil diff --git a/lisp/org-macs.el b/lisp/org-macs.el index 75c4013..e999917 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -239,10 +239,15 @@ We use a macro so that the test can happen at compilation time." s) (match-string-no-properties num string))) -(defsubst org-no-properties (s) +(defsubst org-no-properties (s &optional restricted) + "Remove all text properties from string S. +When RESTRICTED is non-nil, only remove the properties listed +in `org-rm-props'." (if (fboundp 'set-text-properties) (set-text-properties 0 (length s) nil s) - (remove-text-properties 0 (length s) org-rm-props s)) + (if restricted + (remove-text-properties 0 (length s) org-rm-props s) + (set-text-properties 0 (length s) nil s))) s) (defsubst org-get-alist-option (option key) diff --git a/lisp/org-remember.el b/lisp/org-remember.el index 0cc152f..7a1eb77 100644 --- a/lisp/org-remember.el +++ b/lisp/org-remember.el @@ -398,8 +398,7 @@ RET at beg-of-buf -> Append to file as level 2 headline This function should be placed into `remember-mode-hook' and in fact requires to be run from that hook to function properly." (when (and (boundp 'initial) (stringp initial)) - (setq initial (org-no-properties initial)) - (remove-text-properties 0 (length initial) '(read-only t) initial)) + (setq initial (org-no-properties initial))) (if org-remember-templates (let* ((entry (org-select-remember-template use-char)) (ct (or org-overriding-default-time (org-current-time))) @@ -446,7 +445,7 @@ to be run from that hook to function properly." v-a)) (v-n user-full-name) (v-k (if (marker-buffer org-clock-marker) - (org-substring-no-properties org-clock-heading))) + (org-no-properties org-clock-heading))) (v-K (if (marker-buffer org-clock-marker) (org-make-link-string (buffer-file-name (marker-buffer org-clock-marker)) @@ -598,7 +597,7 @@ to be run from that hook to function properly." (car clipboards)))))) ((equal char "p") (let* - ((prop (org-substring-no-properties prompt)) + ((prop (org-no-properties prompt)) (pall (concat prop "_ALL")) (allowed (with-current-buffer |