unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* dropdown-list.el
@ 2011-05-21  2:00 Chong Yidong
  2011-05-21  9:38 ` dropdown-list.el Lennart Borgman
  2011-05-22  6:13 ` dropdown-list.el SAKURAI Masashi
  0 siblings, 2 replies; 6+ messages in thread
From: Chong Yidong @ 2011-05-21  2:00 UTC (permalink / raw)
  To: emacs-devel

We just received the copyright assignment for dropdown-list.el.  This is
a library that simulates "dropdown list" GUI elements by means of
overlay strings.

(This code was originally based on company-mode, which also has an
assignment and is on elpa.gnu.org; we got the assignment for
dropdown-list.el itself since it's used by YASnippet, which is also
going to be on elpa.gnu.org.)

It might be worth putting dropdown-list.el in Emacs core.  The code is
not up to Emacs standards, but it is a relatively small library, and so
should not be hard to clean up.  Has anyone taken a look at this before?
Opinions welcome.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: dropdown-list.el
  2011-05-21  2:00 dropdown-list.el Chong Yidong
@ 2011-05-21  9:38 ` Lennart Borgman
  2011-05-22  6:13 ` dropdown-list.el SAKURAI Masashi
  1 sibling, 0 replies; 6+ messages in thread
From: Lennart Borgman @ 2011-05-21  9:38 UTC (permalink / raw)
  To: Chong Yidong; +Cc: emacs-devel

On Sat, May 21, 2011 at 4:00 AM, Chong Yidong <cyd@stupidchicken.com> wrote:
> We just received the copyright assignment for dropdown-list.el.  This is
> a library that simulates "dropdown list" GUI elements by means of
> overlay strings.
>
> (This code was originally based on company-mode, which also has an
> assignment and is on elpa.gnu.org; we got the assignment for
> dropdown-list.el itself since it's used by YASnippet, which is also
> going to be on elpa.gnu.org.)
>
> It might be worth putting dropdown-list.el in Emacs core.  The code is
> not up to Emacs standards, but it is a relatively small library, and so
> should not be hard to clean up.  Has anyone taken a look at this before?
> Opinions welcome.

It is a rather nice idea, but it would be much better with support for
real drop down lists.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: dropdown-list.el
  2011-05-21  2:00 dropdown-list.el Chong Yidong
  2011-05-21  9:38 ` dropdown-list.el Lennart Borgman
@ 2011-05-22  6:13 ` SAKURAI Masashi
  2011-05-22 11:48   ` dropdown-list.el Lennart Borgman
  1 sibling, 1 reply; 6+ messages in thread
From: SAKURAI Masashi @ 2011-05-22  6:13 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1923 bytes --]

At Fri, 20 May 2011 22:00:50 -0400,
Chong Yidong wrote:
> :
> It might be worth putting dropdown-list.el in Emacs core.  The code is
> not up to Emacs standards, but it is a relatively small library, and so
> should not be hard to clean up.  Has anyone taken a look at this before?
> Opinions welcome.

How about popup.el?
It was posted to gnu-emacs-sources on 7 March 2011 by Matsuyama san.
https://github.com/m2ym/popup-el/tree/v0.4

I compared three functions:
- dropdown-list (dropdown-list.el)
- popup-menu    (mouse.el)
- popup-menu*   (popup.el).

I attached the sample code in which the menus select from a string
list and insert a string.


* dropdown-list (dropdown-list.el)

The code is very short (about 260 lines) and easy to use.  Because the menu is drawn by
overlay texts, one can use this function in the terminal.

I think the library is too simple for general purposes. 
Particularly, this library can not treat many items well.

* popup-menu (mouse.el)

This function is included in the current Emacs. The menu is drawn by
the GUI menu, so one can not use in the terminal. The construction of
menu items is the same as the usual menu keymaps. But I think it is
little difficult to use for the quick selecting for transient menu
items.

* popup-menu* (popup.el)

The menu is also drawn by overlay texts, so one can use it in the terminal.
The code is not short (about 1000 lines), but it has many functions
and customization points for the general purposes.
It has following functions:

- one can scroll the menu in the case of many items
- incremental search and narrowing
- one can construct a cascading menu
- a menu item can display the summary and documentation 
  like completion menus in the Eclipse and Visual Studio.

The library popup.el is used by auto-complete (http://cx4a.org/software/auto-complete/).



I hope this article is helpful for discussion.

--
SAKURAI, Masashi (family, given)


[-- Attachment #2: popup-test.el --]
[-- Type: application/octet-stream, Size: 1384 bytes --]

;;; Simple popup menu comparing

(require 'dropdown-list)
(require 'popup)

(defvar ddtest-list 
  '("Dictaphone"
    "Dictaphone's"
    "dicta"
    "dicta's"
    "dictate"
    "dictated"
    "dictates"
    "dictating"
    "dictation"
    "dictation's"
    "dictations"
    "dictator"
    "dictator's"
    "dictatorial"
    "dictators"
    "dictatorship"
    "dictatorship's"
    "dictatorships"
    "diction"
    "diction's"
    "dictionaries"
    "dictionary"
    "dictionary's"
    "dictum"
    "dictum's"
    "dictums"))

(defun ddtest-show-dropdown-list ()
  (interactive)
  (let ((num (dropdown-list ddtest-list)))
    (and num (insert (nth num ddtest-list)))))

(defun ddtest-show-x-popup-menu ()
  (interactive)
  (let* ((menu-map (make-sparse-keymap "Popup Test")) val)
    (mapc (lambda (x) 
            (lexical-let ((x x))
              (define-key menu-map 
                (vector (intern x))
                (cons x (lambda () (interactive) (insert x))))))
          ddtest-list)
    (popup-menu menu-map)))

(defun ddtest-show-popup-menu ()
  (interactive)
  (let ((val (popup-menu*
              (mapcar (lambda (x) 
                        (popup-make-item x :value x))
                      ddtest-list)
              :scroll-bar t)))
    (and val (insert val))))

;; Do it.

;; (ddtest-show-dropdown-list)
;; (ddtest-show-x-popup-menu)
;; (ddtest-show-popup-menu)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: dropdown-list.el
  2011-05-22  6:13 ` dropdown-list.el SAKURAI Masashi
@ 2011-05-22 11:48   ` Lennart Borgman
  2011-05-22 12:28     ` dropdown-list.el Leo
  0 siblings, 1 reply; 6+ messages in thread
From: Lennart Borgman @ 2011-05-22 11:48 UTC (permalink / raw)
  To: SAKURAI Masashi; +Cc: emacs-devel

On Sun, May 22, 2011 at 8:13 AM, SAKURAI Masashi <m.sakurai@kiwanami.net> wrote:
>
> * popup-menu* (popup.el)
>
> The menu is also drawn by overlay texts, so one can use it in the terminal.
> The code is not short (about 1000 lines), but it has many functions
> and customization points for the general purposes.
> It has following functions:
>
> - one can scroll the menu in the case of many items
> - incremental search and narrowing
> - one can construct a cascading menu
> - a menu item can display the summary and documentation
>  like completion menus in the Eclipse and Visual Studio.
>
> The library popup.el is used by auto-complete (http://cx4a.org/software/auto-complete/).

Since it uses overlays it can not extend outside of Emacs windows.
This is often quite awful.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: dropdown-list.el
  2011-05-22 11:48   ` dropdown-list.el Lennart Borgman
@ 2011-05-22 12:28     ` Leo
  2011-05-22 13:39       ` dropdown-list.el Lennart Borgman
  0 siblings, 1 reply; 6+ messages in thread
From: Leo @ 2011-05-22 12:28 UTC (permalink / raw)
  To: emacs-devel

On 2011-05-22 19:48 +0800, Lennart Borgman wrote:
> Since it uses overlays it can not extend outside of Emacs windows.
> This is often quite awful.

I found the ability to make a frame without any decorations: no title
bar, no border and scroll bar, no minibuffer etc. very useful. For
example, one can use it to build a notification system that is even more
powerful than the popular choice growl on OSX. I suspect it can also be
used to draw dropdown menus.

Leo




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: dropdown-list.el
  2011-05-22 12:28     ` dropdown-list.el Leo
@ 2011-05-22 13:39       ` Lennart Borgman
  0 siblings, 0 replies; 6+ messages in thread
From: Lennart Borgman @ 2011-05-22 13:39 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

On Sun, May 22, 2011 at 2:28 PM, Leo <sdl.web@gmail.com> wrote:
> On 2011-05-22 19:48 +0800, Lennart Borgman wrote:
>> Since it uses overlays it can not extend outside of Emacs windows.
>> This is often quite awful.
>
> I found the ability to make a frame without any decorations: no title
> bar, no border and scroll bar, no minibuffer etc. very useful. For
> example, one can use it to build a notification system that is even more
> powerful than the popular choice growl on OSX. I suspect it can also be
> used to draw dropdown menus.

Some things are missing in Emacs currently to make this useful. I
think we have discussed this earlier (or didn't I suggest some
enhancements then?).



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-05-22 13:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-21  2:00 dropdown-list.el Chong Yidong
2011-05-21  9:38 ` dropdown-list.el Lennart Borgman
2011-05-22  6:13 ` dropdown-list.el SAKURAI Masashi
2011-05-22 11:48   ` dropdown-list.el Lennart Borgman
2011-05-22 12:28     ` dropdown-list.el Leo
2011-05-22 13:39       ` dropdown-list.el Lennart Borgman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).