mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-12-27 10:55:04 +00:00
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'.
This commit is contained in:
parent
16ea0364a4
commit
722e0e0c83
@ -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))
|
||||
|
@ -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)))
|
||||
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user