Feature Requests: Browse | Submit New | Admin

[#8158] Using 'minibuffer completion' for selection

Date:
2007-01-25 23:35
Priority:
3
Submitted By:
Nobody
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
Using 'minibuffer completion' for selection

Detailed description
Hi,

Could You add selecting of controllers/layouts/scripts etc. by reading from the minibuffer with completion. Just like
'find-file' function  works.



Here is a prototype code:

-------------- 8< ---------------------
(defun rails-core:menu-read-from-minibuffer (menu)
  "Select a menu item using minibuffer completion"
  (let* ((map (rest (second menu)))
	 (prompt (format "%s :"   (first menu)))
	 (res  (completing-read   prompt  map nil t ""))
	 (item (assoc res map)))
    (when item
      (second item))))

(setq rails-always-use-text-menus t)

;; taken from rails-core.el
(defun rails-core:menu (menu)
  "Show a menu."
  (let ((result
   (if (rails-use-text-menu)
       (rails-core:menu-read-from-minibuffer menu) ;;; <- 
     (x-popup-menu (list (if (functionp 'posn-at-point) ; mouse position at point
                             (destructuring-bind (x . y)
                                 (nth 2 (posn-at-point)) (list x y))
                           '(200 100))
                         (selected-window))
                   menu))))
    (if (listp result)
        (first result)
      result)))
-------------- 8< --------------------- 


--
Rafal Strzalinski
me(at)nablaone.net

Add A Comment: Notepad

Please login


Followup

No Followups Have Been Posted

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item