emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 43a501a 103/177: remove yas--x-pretty-prompt-templates


From: João Távora
Subject: [elpa] master 43a501a 103/177: remove yas--x-pretty-prompt-templates
Date: Sat, 28 Mar 2015 15:41:14 +0000

branch: master
commit 43a501aa567d5507e9797c30ab7dc98a13565d4e
Author: Noam Postavsky <address@hidden>
Commit: Noam Postavsky <address@hidden>

    remove yas--x-pretty-prompt-templates
---
 yasnippet.el |   51 +++++++--------------------------------------------
 1 files changed, 7 insertions(+), 44 deletions(-)

diff --git a/yasnippet.el b/yasnippet.el
index 62a1d8f..1a87e39 100644
--- a/yasnippet.el
+++ b/yasnippet.el
@@ -1489,10 +1489,6 @@ Here's a list of currently recognized directives:
 
 ;;; Popping up for keys and templates
 
-(defvar yas--x-pretty-prompt-templates nil
-  "If non-nil, attempt to prompt for templates like TextMate.")
-
-
 (defun yas--prompt-for-template (templates &optional prompt)
   "Interactively choose a template from the list TEMPLATES.
 
@@ -1504,13 +1500,11 @@ Optional PROMPT sets the prompt to use."
           (sort templates #'(lambda (t1 t2)
                               (< (length (yas--template-name t1))
                                  (length (yas--template-name t2))))))
-    (if yas--x-pretty-prompt-templates
-        (yas--x-pretty-prompt-templates "Choose a snippet" templates)
-      (some #'(lambda (fn)
-                (funcall fn (or prompt "Choose a snippet: ")
-                         templates
-                         #'yas--template-name))
-            yas-prompt-functions))))
+    (some #'(lambda (fn)
+              (funcall fn (or prompt "Choose a snippet: ")
+                       templates
+                       #'yas--template-name))
+          yas-prompt-functions)))
 
 (defun yas--prompt-for-keys (keys &optional prompt)
   "Interactively choose a template key from the list KEYS.
@@ -1556,37 +1550,6 @@ Optional PROMPT sets the prompt to use."
                             (if display-fn (mapcar display-fn choices) 
choices)))))
      (keyboard-quit))))
 
-(defun yas--x-pretty-prompt-templates (prompt templates)
-  "Display TEMPLATES, grouping neatly by table name."
-  (let ((organized (make-hash-table :test #'equal))
-        menu
-        more-than-one-table
-        prefix)
-    (dolist (tl templates)
-      (puthash (yas--template-table tl)
-               (cons tl
-                     (gethash (yas--template-table tl) organized))
-               organized))
-    (setq more-than-one-table (> (hash-table-count organized) 1))
-    (setq prefix (if more-than-one-table
-                     "   " ""))
-    (if more-than-one-table
-        (maphash #'(lambda (table templates)
-                     (push (yas--table-name table) menu)
-                     (dolist (tl templates)
-                       (push (cons (concat prefix (yas--template-name tl)) tl) 
menu))) organized)
-      (setq menu (mapcar #'(lambda (tl) (cons (concat prefix 
(yas--template-name tl)) tl)) templates)))
-
-    (setq menu (nreverse menu))
-    (or (x-popup-menu (if (fboundp 'posn-at-point)
-                          (let ((x-y (posn-x-y (posn-at-point (point)))))
-                            (list (list (+ (car x-y) 10)
-                                        (+ (cdr x-y) 20))
-                                  (selected-window)))
-                        t)
-                      (list prompt (push "title" menu)))
-        (keyboard-quit))))
-
 (defun yas-ido-prompt (prompt choices &optional display-fn)
   (when (and (fboundp 'ido-completing-read)
             (or (>= emacs-major-version 24)
@@ -2224,8 +2187,8 @@ Prompt the user if TEMPLATES has more than one element, 
else
 expand immediately.  Common gateway for
 `yas-expand-from-trigger-key' and `yas-expand-from-keymap'."
   (let ((yas--current-template (or (and (rest templates) ;; more than one
-                                       (yas--prompt-for-template (mapcar #'cdr 
templates)))
-                                  (cdar templates))))
+                                        (yas--prompt-for-template (mapcar 
#'cdr templates)))
+                                   (cdar templates))))
     (when yas--current-template
       (yas-expand-snippet (yas--template-content yas--current-template)
                           start



reply via email to

[Prev in Thread] Current Thread [Next in Thread]