From ccfea3d8e58402d9c10197d7eb9b489dc139b561 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sun, 3 Mar 2019 23:46:32 +0100 Subject: [PATCH] Move `org-fill-template' into "org-macs.el" * lisp/org.el (org-fill-template): Move function * lisp/org-macs.el: ...there. --- lisp/ob-exp.el | 1 - lisp/ob-sqlite.el | 1 - lisp/ob-tangle.el | 1 - lisp/org-macs.el | 10 ++++++++++ lisp/org.el | 11 ----------- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/lisp/ob-exp.el b/lisp/ob-exp.el index 1a4c49458..cd93ff23d 100644 --- a/lisp/ob-exp.el +++ b/lisp/ob-exp.el @@ -32,7 +32,6 @@ (declare-function org-element-type "org-element" (element)) (declare-function org-escape-code-in-string "org-src" (s)) (declare-function org-export-copy-buffer "ox" ()) -(declare-function org-fill-template "org" (template alist)) (declare-function org-in-commented-heading-p "org" (&optional no-inheritance)) (defvar org-src-preserve-indentation) diff --git a/lisp/ob-sqlite.el b/lisp/ob-sqlite.el index 04bf4fe23..7522c8361 100644 --- a/lisp/ob-sqlite.el +++ b/lisp/ob-sqlite.el @@ -28,7 +28,6 @@ ;;; Code: (require 'ob) -(declare-function org-fill-template "org" (template alist)) (declare-function org-table-convert-region "org-table" (beg0 end0 &optional separator)) (declare-function orgtbl-to-csv "org-table" (table params)) diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el index fa5ba80cf..59fb2e8e8 100644 --- a/lisp/ob-tangle.el +++ b/lisp/ob-tangle.el @@ -38,7 +38,6 @@ (declare-function org-before-first-heading-p "org" ()) (declare-function org-element-at-point "org-element" ()) (declare-function org-element-type "org-element" (element)) -(declare-function org-fill-template "org" (template alist)) (declare-function org-heading-components "org" ()) (declare-function org-id-find "org-id" (id &optional markerp)) (declare-function org-in-commented-heading-p "org" (&optional no-inheritance)) diff --git a/lisp/org-macs.el b/lisp/org-macs.el index eaf65a7d6..7978ca624 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -1000,6 +1000,16 @@ as-is if removal failed." (insert code) (if (org-do-remove-indentation n) (buffer-string) code))) +(defun org-fill-template (template alist) + "Find each %key of ALIST in TEMPLATE and replace it." + (let ((case-fold-search nil)) + (dolist (entry (sort (copy-sequence alist) + (lambda (a b) (< (length (car a)) (length (car b)))))) + (setq template + (replace-regexp-in-string + (concat "%" (regexp-quote (car entry))) + (or (cdr entry) "") template t t))) + template)) ;;; Text properties diff --git a/lisp/org.el b/lisp/org.el index 0fdfe49b8..23659758f 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -18818,17 +18818,6 @@ With prefix arg UNCOMPILED, load the uncompiled versions." (interactive "p") (self-insert-command N)) -(defun org-fill-template (template alist) - "Find each %key of ALIST in TEMPLATE and replace it." - (let ((case-fold-search nil)) - (dolist (entry (sort (copy-sequence alist) - (lambda (a b) (< (length (car a)) (length (car b)))))) - (setq template - (replace-regexp-in-string - (concat "%" (regexp-quote (car entry))) - (or (cdr entry) "") template t t))) - template)) - (defun org-quote-vert (s) "Replace \"|\" with \"\\vert\"." (while (string-match "|" s)