diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2020-07-26 20:14:00 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2020-07-26 20:14:00 -0700 |
commit | c2fd2ea94e70268c5293a0b185a199296c4c55ff (patch) | |
tree | ad8f7488f6eb48927002bd8dc7842231b3a69990 | |
parent | 201a7c4a7d594623d6e6edfdbba5cfe11d79ccb9 (diff) | |
parent | 9d104d4bbbcb37bbc9d9ce762e74d41174683f86 (diff) |
Merge tag 'v0.5.8'
-rw-r--r-- | .travis.yml | 28 | ||||
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | README.md | 22 | ||||
-rw-r--r-- | popup.el | 49 |
4 files changed, 60 insertions, 42 deletions
diff --git a/.travis.yml b/.travis.yml index abed12f..62d1878 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,19 +1,13 @@ -language: emacs-lisp -env: - matrix: - - EMACS=emacs24 - - EMACS=emacs-snapshot - global: - - CASK=$HOME/.cask/bin/cask +language: generic +sudo: false before_install: - - sudo add-apt-repository -y ppa:cassou/emacs - - sudo add-apt-repository -y ppa:ubuntu-elisp/ppa - - sudo apt-get update -qq - - sudo apt-get install -qq $EMACS - - if [ "$EMACS" = 'emacs-snapshot' ]; then - sudo apt-get install -qq emacs-snapshot-el emacs-snapshot-nox; - fi - - curl -fsSkL --max-time 10 --retry 10 --retry-delay 10 - https://raw.github.com/cask/cask/master/go | python + - curl -fsSkL https://gist.github.com/rejeep/ebcd57c3af83b049833b/raw > x.sh && source ./x.sh + - evm install $EVM_EMACS --use --skip + - cask +env: + - EVM_EMACS=emacs-24.3-travis + - EVM_EMACS=emacs-24.4-travis + - EVM_EMACS=emacs-24.5-travis script: - make travis-ci + - emacs --version + - make travis-ci @@ -2,8 +2,7 @@ EMACS ?= emacs CASK ?= cask EMACS23=emacs23 -ELPA_DIR = \ - .cask/$(shell $(EMACS) -Q --batch --eval '(princ emacs-version)')/elpa +ELPA_DIR = $(shell EMACS=$(EMACS) $(CASK) package-directory) .PHONY: test test-nw test-emacs23 test-emacs23-nw travis-ci @@ -28,9 +28,12 @@ Screenshots Installation ------------ -You can install `popup.el` from [MELPA](http://melpa.org/) with package.el. +You can install `popup.el` from [MELPA](https://melpa.org/) with package.el. popwin is tested under GNU Emacs 24 or later. +Alternatively, users of Debian 9 or later or Ubuntu 16.04 or later may +simply `apt-get install elpa-popup`. + Popup Items ----------- @@ -334,11 +337,20 @@ Here is an example: (popup-cascade-menu '(("Top1" "Sub1" "Sub2") "Top2")) + +### Customize Variables + +#### `popup-isearch-regexp-builder-function` + +Function used to construct a regexp from a pattern. You may for instance +provide a function that replaces spaces by '.+' if you like helm or ivy style +of completion. Default value is `#'regexp-quote`. + ---- Copyright (C) 2011-2015 Tomohiro Matsuyama <<m2ym.pub@gmail.com>> -[melpa-link]: http://melpa.org/#/popup -[melpa-stable-link]: http://stable.melpa.org/#/popup -[melpa-badge]: http://melpa.org/packages/popup-badge.svg -[melpa-stable-badge]: http://stable.melpa.org/packages/popup-badge.svg +[melpa-link]: https://melpa.org/#/popup +[melpa-stable-link]: https://stable.melpa.org/#/popup +[melpa-badge]: https://melpa.org/packages/popup-badge.svg +[melpa-stable-badge]: https://stable.melpa.org/packages/popup-badge.svg @@ -4,8 +4,8 @@ ;; Author: Tomohiro Matsuyama <m2ym.pub@gmail.com> ;; Keywords: lisp -;; Version: 0.5.3 -;; Package-Requires: ((cl-lib "0.3")) +;; Version: 0.5.8 +;; Package-Requires: ((cl-lib "0.5")) ;; 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 @@ -22,7 +22,7 @@ ;;; Commentary: -;; popup.el is a visual popup user interface library for Emacs. This +;; popup.el is a visual popup user interface library for Emacs. This ;; provides a basic API and common UI widgets such as popup tooltips ;; and popup menus. ;; See README.markdown for more information. @@ -31,15 +31,15 @@ (require 'cl-lib) -(defconst popup-version "0.5.3") +(defconst popup-version "0.5.8") ;;; Utilities (defun popup-calculate-max-width (max-width) - "Determines whether the width desired is -character or window proportion based, And returns the result." + "Determines whether the width with MAX-WIDTH desired is character or window \ +proportion based, And return the result." (cl-typecase max-width (integer max-width) (float (* (ceiling (/ (round (* max-width (window-width))) 10.0)) 10)))) @@ -61,7 +61,7 @@ If there is a problem, please set it nil.") (when it ,@body))) (defun popup-x-to-string (x) - "Convert any object to string effeciently. + "Convert any object to string efficiently. This is faster than `prin1-to-string' in many cases." (cl-typecase x (string x) @@ -150,6 +150,8 @@ untouched." (defun popup-vertical-motion (column direction) "A portable version of `vertical-motion'." + (when (bound-and-true-p display-line-numbers-mode) + (setq column (- column (line-number-display-width 'columns)))) (if (>= emacs-major-version 23) (vertical-motion (cons column direction)) (vertical-motion direction) @@ -179,7 +181,7 @@ buffer." :prefix "popup-") (defface popup-face - '((t (:background "lightgray" :foreground "black"))) + '((t (:inherit default :background "lightgray" :foreground "black"))) "Face for popup." :group 'popup) @@ -436,7 +438,7 @@ usual." "Return a proper direction when displaying a popup on this window. HEIGHT is the a height of the popup, and ROW is a line number at the point." - (let* ((remaining-rows (- (max 1 (- (window-height) + (let* ((remaining-rows (- (max 1 (- (window-text-height) (if mode-line-format 1 0) (if header-line-format 1 0))) (count-lines (window-start) (point)))) @@ -868,7 +870,7 @@ Pages up through POPUP." ;;; Popup Incremental Search (defface popup-isearch-match - '((t (:background "sky blue"))) + '((t (:inherit default :background "sky blue"))) "Popup isearch match face." :group 'popup) @@ -876,24 +878,31 @@ Pages up through POPUP." (defvar popup-isearch-keymap (let ((map (make-sparse-keymap))) - ;(define-key map "\r" 'popup-isearch-done) + ;;(define-key map "\r" 'popup-isearch-done) (define-key map "\C-g" 'popup-isearch-cancel) (define-key map "\C-b" 'popup-isearch-close) (define-key map [left] 'popup-isearch-close) (define-key map "\C-h" 'popup-isearch-delete) (define-key map (kbd "DEL") 'popup-isearch-delete) + (define-key map (kbd "C-y") 'popup-isearch-yank) map)) (defvar popup-menu-show-quick-help-function 'popup-menu-show-quick-help "Function used for showing quick help by `popup-menu*'.") +(defcustom popup-isearch-regexp-builder-function #'regexp-quote + "Function used to construct a regexp from a pattern. You may for instance + provide a function that replaces spaces by '.+' if you like helm or ivy style + of completion." + :type 'function) + (defsubst popup-isearch-char-p (char) (and (integerp char) (<= 32 char) (<= char 126))) (defun popup-isearch-filter-list (pattern list) - (cl-loop with regexp = (regexp-quote pattern) + (cl-loop with regexp = (funcall popup-isearch-regexp-builder-function pattern) for item in list do (unless (stringp item) @@ -984,6 +993,9 @@ HELP-DELAY is a delay of displaying helps." ((eq binding 'popup-isearch-delete) (if (> (length pattern) 0) (setq pattern (substring pattern 0 (1- (length pattern)))))) + ((eq binding 'popup-isearch-yank) + (popup-isearch-update popup filter (car kill-ring) callback) + (cl-return nil)) (t (setq unread-command-events (append (listify-key-sequence key) unread-command-events)) @@ -1023,8 +1035,9 @@ HELP-DELAY is a delay of displaying helps." prompt &aux tip lines) "Show a tooltip of STRING at POINT. This function is -synchronized unless NOWAIT specified. Almost arguments are same -as `popup-create' except for TRUNCATE, NOWAIT, and PROMPT. +synchronized unless NOWAIT specified. Almost all arguments are +the same as in `popup-create', except for TRUNCATE, NOWAIT, and +PROMPT. If TRUNCATE is non-nil, the tooltip can be truncated. @@ -1093,7 +1106,7 @@ PROMPT is a prompt string when reading events during event loop." :group 'popup) (defface popup-menu-selection-face - '((t (:background "steelblue" :foreground "white"))) + '((t (:inherit default :background "steelblue" :foreground "white"))) "Face for popup menu selection." :group 'popup) @@ -1243,7 +1256,7 @@ PROMPT is a prompt string when reading events during event loop." (popup-menu-show-help menu)) ((eq binding 'popup-isearch) (popup-isearch menu - :filter 'isearch-filter + :filter isearch-filter :cursor-color isearch-cursor-color :keymap isearch-keymap :callback isearch-callback @@ -1319,8 +1332,8 @@ PROMPT is a prompt string when reading events during event loop." initial-index &aux menu event) "Show a popup menu of LIST at POINT. This function returns a -value of the selected item. Almost arguments are same as -`popup-create' except for KEYMAP, FALLBACK, HELP-DELAY, PROMPT, +value of the selected item. Almost all arguments are the same as in +`popup-create', except for KEYMAP, FALLBACK, HELP-DELAY, PROMPT, ISEARCH, ISEARCH-FILTER, ISEARCH-CURSOR-COLOR, ISEARCH-KEYMAP, and ISEARCH-CALLBACK. |