Commit a4330a88 authored by Lev Lamberov's avatar Lev Lamberov

New upstream version 0.2.1

parents
*-autoloads.el
*.elc
*~
env:
matrix:
- EMACS=emacs24
- EMACS=emacs-snapshot
matrix:
allow_failures:
- env: EMACS=emacs-snapshot
before_install:
- git submodule --quiet update --init --recursive
install:
- if [ "$EMACS" = 'emacs24' ]; then
sudo add-apt-repository -y ppa:cassou/emacs &&
sudo apt-get -qq update &&
sudo apt-get -qq -f install &&
sudo apt-get -qq install emacs24 emacs24-el;
fi
- if [ "$EMACS" = 'emacs-snapshot' ]; then
sudo add-apt-repository -y ppa:ubuntu-elisp/ppa &&
sudo apt-get -qq update &&
sudo apt-get -qq -f install &&
sudo apt-get -qq install emacs-snapshot &&
sudo apt-get -qq install emacs-snapshot-el;
fi
- curl -fsSkL https://raw.github.com/cask/cask/master/go | python
- export PATH="/home/travis/.cask/bin:$PATH"
- cask install
script:
- cask build
notifications:
email: false
(source gnu)
(source melpa)
(package-file "ace-popup-menu.el")
(development
(depends-on "avy-menu"))
# Ace Popup Menu
[![License GPL 3](https://img.shields.io/badge/license-GPL_3-green.svg)](http://www.gnu.org/licenses/gpl-3.0.txt)
[![MELPA](https://melpa.org/packages/ace-popup-menu-badge.svg)](https://melpa.org/#/ace-popup-menu)
[![Build Status](https://travis-ci.org/mrkkrp/ace-popup-menu.svg?branch=master)](https://travis-ci.org/mrkkrp/ace-popup-menu)
![Ace Popup Menu](https://raw.githubusercontent.com/mrkkrp/ace-popup-menu/gh-pages/ace-popup-menu.png)
This package allows to replace the GUI popup menu (created by `x-popup-menu`
by default) with a little temporary window (like the one in which Dired
shows you files you want to copy). In this window, menu items are displayed
and labeled with one or two letters. You press a key corresponding to
desired choice (or <kbd>C-g</kbd> if you wish to cancel the operation) and
you are done.
## Installation
Download this package and place it somewhere, so Emacs can see it. Then put
`(require 'ace-popup-menu)` into your configuration file. Done!
It's available via MELPA, so you can just <kbd>M-x package-install RET
ace-popup-menu RET</kbd>.
## Usage
In order to replace the standard behavior of `x-popup-menu`, activate
`ace-popup-menu-mode` in your configuration file, like this:
```emacs-lisp
(ace-popup-menu-mode 1)
```
You can toggle/activate it either interactively or via Lisp. The mode
follows all usual Emacs Lisp conventions for minor modes, except it's always
global (because it doesn't make any sense to replace behavior of
`x-popup-menu` only in a specific buffer). See the documentation for
`ace-popup-menu-mode` for more information.
You can use the enhanced menu directly via `ace-popup-menu` too. To use it
you don't need to enable the minor mode. See documentation of the function
for detailed information.
## Customization
You can ask Ace Popup Menu to show headers of individual panes (they are not
shown in the original GUI popup menu):
```emacs-lisp
(setq ace-popup-menu-show-pane-header t)
```
This variable can be changed via the “customize” interface as well.
This package is built on top
of [`avy-menu`](https://github.com/mrkkrp/avy-menu), see its customization
settings if you wish to change appearance of the menu itself.
## Limitations
Here is something you may want to know:
* The original `x-popup-menu` can take `menu` argument in the form of a
keymap or list of keymaps. This is currently not supported. If you run
into a situation when this breaks something,
please [open an issue](https://github.com/mrkkrp/ace-popup-menu/issues).
Describe how to reproduce your problem and I'll try to fix it.
* Some packages, such as `flyspell`, may test if they work under X-window
system and refuse to call `x-popup-menu` if they think it's unavailable.
There is nothing I can do about it, so it may be hard to use Ace Popup
Menu in terminal, even though it's perfectly capable of functioning there.
* Currently only horizontal format of menu items is available. This is
because it's much easier to implement. This should not be a problem,
though.
## License
Copyright © 2015–2017 Mark Karpov
Distributed under GNU GPL, version 3.
;;; ace-popup-menu.el --- Replace GUI popup menu with something more efficient -*- lexical-binding: t; -*-
;;
;; Copyright © 2015–2017 Mark Karpov <markkarpov92@gmail.com>
;;
;; Author: Mark Karpov <markkarpov92@gmail.com>
;; URL: https://github.com/mrkkrp/ace-popup-menu
;; Version: 0.2.1
;; Package-Requires: ((emacs "24.3") (avy-menu "0.1"))
;; Keywords: convenience, popup, menu
;;
;; This file is not part of GNU Emacs.
;;
;; This program is free software: you can redistribute it and/or modify it
;; under the terms of the GNU General Public License as published by the
;; Free Software Foundation, either version 3 of the License, or (at your
;; option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
;; Public License for more details.
;;
;; You should have received a copy of the GNU General Public License along
;; with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; This package allows to replace the GUI popup menu (created by
;; `x-popup-menu' by default) with a little temporary window (like that in
;; which Dired shows you files you want to copy). In this window, menu
;; items are displayed and labeled with one or two letters. You press a key
;; corresponding to desired choice (or C-g if you wish to cancel the
;; operation) and you are done.
;;; Code:
(require 'avy-menu)
(require 'cl-lib)
(defgroup ace-popup-menu nil
"Replace GUI popup menu with something more efficient."
:group 'convenience
:tag "Ace Popup Menu"
:prefix "ace-popup-menu-"
:link '(url-link :tag "GitHub" "https://github.com/mrkkrp/ace-popup-menu"))
(defcustom ace-popup-menu-show-pane-header nil
"Whether to print headers of individual panes in Ace Popup Menu."
:tag "Show Pane Header"
:type 'boolean)
;;;###autoload
(define-minor-mode ace-popup-menu-mode
"Toggle the `ace-popup-menu-mode' minor mode.
With a prefix argument ARG, enable `ace-popup-menu-mode' if ARG
is positive, and disable it otherwise. If called from Lisp,
enable the mode if ARG is omitted or NIL, and toggle it if ARG is
`toggle'.
This minor mode is global. When it's active any call to
`x-popup-menu' will result in call of `ace-popup-menu'
instead. This function in turn implements a more efficient
interface to select an option from a list. Emacs Lisp code can
also use `ace-popup-menu' directly, in this case it will work OK
even if the mode is disabled."
:global t
(if ace-popup-menu-mode
(advice-add 'x-popup-menu :override #'ace-popup-menu)
(advice-remove 'x-popup-menu #'ace-popup-menu)))
;;;###autoload
(defun ace-popup-menu (position menu)
"Pop up a menu in a temporary window and return user's selection.
Argument POSITION is taken for compatibility and ignored unless
it's NIL, in which case this function has no effect. For meaning
of MENU argument see documentation for `x-popup-menu'.
Every selectable item in the menu is labeled with a letter (or
two). User can press a key corresponding to desired menu item
and he/she is done."
(when position
(avy-menu "*ace-popup-menu*"
menu
ace-popup-menu-show-pane-header)))
(provide 'ace-popup-menu)
;;; ace-popup-menu.el ends here
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment