]> git.eshelyaron.com Git - emacs.git/commitdiff
Some more flatten-tree aliases
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 17 Dec 2018 18:19:23 +0000 (10:19 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 17 Dec 2018 18:26:15 +0000 (10:26 -0800)
* lisp/allout.el (allout-flatten):
* lisp/progmodes/hideif.el (hif-flatten):
Now an obsolete alias for flatten-tree.  All callers changed.
* lisp/org/org-protocol.el (org-protocol-flatten):
Make it an alias for flatten-tree if available.
* lisp/progmodes/js.el (js--flatten-list):
Remove alias.  We shouldn’t need obsolete function aliases for
private functions.

lisp/allout.el
lisp/org/org-protocol.el
lisp/progmodes/hideif.el
lisp/progmodes/js.el

index a123ece9b957187c5ca88df73af7ed7b63fcbfba..242b1f2c87f1bc0e3ca0c855f1e09bf3555d2e84 100644 (file)
@@ -4351,7 +4351,7 @@ subtopics into siblings of the item."
             (let ((children-chart (allout-chart-subtree 1)))
               (if (listp (car children-chart))
                   ;; whoops:
-                  (setq children-chart (allout-flatten children-chart)))
+                  (setq children-chart (flatten-tree children-chart)))
               (save-excursion
                 (dolist (child-point children-chart)
                   (goto-char child-point)
@@ -6547,14 +6547,7 @@ If BEG is bigger than END we return 0."
   (apply 'concat
          (mapcar (lambda (char) (if (= char ?%) "%%" (char-to-string char)))
                  string)))
-;;;_  : lists
-;;;_   > allout-flatten (list)
-(defun allout-flatten (list)
-  "Return a list of all atoms in list."
-  ;; classic.
-  (cond ((null list) nil)
-        ((atom (car list)) (cons (car list) (allout-flatten (cdr list))))
-        (t (append (allout-flatten (car list)) (allout-flatten (cdr list))))))
+(define-obsolete-function-alias 'allout-flatten #'flatten-tree "27.1")
 ;;;_  : Compatibility:
 ;;;_   : xemacs undo-in-progress provision:
 (unless (boundp 'undo-in-progress)
index 33957ee32698a9f17f379537607a7eb9645cff38..bb88c2fe1fdfb974db171b81971bc8312e3bbf70 100644 (file)
@@ -349,17 +349,20 @@ returned list."
          ret)
       l)))
 
-(defun org-protocol-flatten (list)
-  "Transform LIST into a flat list.
+(if (fboundp 'flatten-tree)
+    (defalias 'org-protocol-flatten 'flatten-tree)
+  (defun org-protocol-flatten (list)
+    "Transform LIST into a flat list.
 
 Greedy handlers might receive a list like this from emacsclient:
 \((\"/dir/org-protocol:/greedy:/~/path1\" (23 . 12)) (\"/dir/param\"))
 where \"/dir/\" is the absolute path to emacsclients working directory.
 This function transforms it into a flat list."
-  (if (null list) ()
-    (if (listp list)
-       (append (org-protocol-flatten (car list)) (org-protocol-flatten (cdr list)))
-      (list list))))
+    (if (null list) ()
+      (if (listp list)
+         (append (org-protocol-flatten (car list))
+                  (org-protocol-flatten (cdr list)))
+        (list list)))))
 
 (defun org-protocol-parse-parameters (info &optional new-style default-order)
   "Return a property list of parameters from INFO.
index 62e8c45338965a24e5211030f8185af65c3378ae..84cbb6e6d17f6e52e9b31b63a63337e1111555d5 100644 (file)
@@ -672,12 +672,7 @@ that form should be displayed.")
        result))
     (nreverse result)))
 
-(defun hif-flatten (l)
-  "Flatten a tree."
-  (apply #'nconc
-         (mapcar (lambda (x) (if (listp x)
-                                 (hif-flatten x)
-                               (list x))) l)))
+(define-obsolete-function-alias 'hif-flatten #'flatten-tree "27.1")
 
 (defun hif-expand-token-list (tokens &optional macroname expand_list)
   "Perform expansion on TOKENS till everything expanded.
@@ -748,7 +743,7 @@ detecting self-reference."
 
          expanded))
 
-      (hif-flatten (nreverse expanded)))))
+      (flatten-tree (nreverse expanded)))))
 
 (defun hif-parse-exp (token-list &optional macroname)
   "Parse the TOKEN-LIST.
@@ -1166,7 +1161,7 @@ preprocessing token"
         (setq actual-parms (cdr actual-parms)))
 
       ;; Replacement completed, flatten the whole token list
-      (setq macro-body (hif-flatten macro-body))
+      (setq macro-body (flatten-tree macro-body))
 
       ;; Stringification and token concatenation happens here
       (hif-token-concatenation (hif-token-stringification macro-body)))))
index ddba7636b4a94e6c0f5238952b873dab12d95a58..11ccb5fc527ed4c6c0e60588ee3f255c5c836363 100644 (file)
@@ -623,8 +623,6 @@ then the \".\"s will be lined up:
   "Parse state at `js--last-parse-pos'.")
 (make-variable-buffer-local 'js--state-at-last-parse-pos)
 
-(define-obsolete-function-alias 'js--flatten-list #'flatten-tree "27.1")
-
 (defun js--maybe-join (prefix separator suffix &rest list)
   "Helper function for `js--update-quick-match-re'.
 If LIST contains any element that is not nil, return its non-nil