Giter VIP home page Giter VIP logo

popup-el's Introduction

License: GPL v3 melpa badge melpa stable badge

popup.el

CI

Overview

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.

Screenshots

Tooltip Popup Menu Popup Cascade Menu

Installation

You can install popup.el from MELPA 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

Elements of popup-list have to be popup items. A popup item is substantially a string but it may involve some text-properties. There are two ways to make popup items. One is just using strings. Another is to use the popup-make-item function, which just returns the string after adding text-properties of its keywords. Effective text-properties are:

  • value -- This represents the real value of the item. This will be used when returning the value but not the item (or string) from some synchronous functions such as popup-menu*.
  • face -- The background face of the item. The value of popup-face will be overridden.
  • selection-face -- The selection face of the item. The value of popup-selection-face will be overridden.
  • document -- The documentation string or function of the item.
  • summary -- The summary string of the item. This will be shown inline with the item.
  • symbol -- The symbol character of the item.
  • sublist -- The sublist of the item. This is effective only with popup-cascade-menu.

All of properties can be accessed by popup-item-<property> utility function.

Function: popup-item-propertize

popup-item-propertize item &rest properties => item

Same as propertize except that this avoids overriding existed value with nil property.

Function: popup-make-item

popup-make-item name &key value popup-face selection-face sublist
document symbol summary => item

The utility function of popup-item-propertize.

Popups

This section describes the basic data structures and operations of popups.

Struct: popup

Any instance of popup structure has the following fields (some unimportant fields are not listed):

  • point
  • row -- The line number.
  • column
  • width -- Max width of popup instance.
  • height -- Max height of popup instance.
  • min-height
  • current-height
  • direction -- Positive number means forward, negative number means backward.
  • parent -- The parent of popup instance.
  • face -- The background face.
  • selection-face
  • margin-left
  • margin-right
  • scroll-bar -- Non-nil means popup instance has a scroll bar.
  • symbol -- Non-nil means popup instance has a space for displaying symbols of item.
  • cursor -- The current position of list.
  • scroll-top -- The offset of scrolling.
  • list -- The contents of popup instance in a list of items (strings).
  • original-list -- Same as list except that this is not filtered.

All of these fields can be accessed by popup-<field> function.

Function: popup-create

popup-create point width height &key min-height max-width around face
selection-face scroll-bar margin-left margin-right symbol parent
parent-offset => popup

Create a popup instance at POINT with WIDTH and HEIGHT.

MIN-HEIGHT is the minimal height of the popup. The default value is 0.

MAX-WIDTH is the maximum width of the popup. The default value is nil (no limit). If a floating point, the value refers to the ratio of the window. If an integer, limit is in characters.

If AROUND is non-nil, the popup will be displayed around the point but not at the point.

FACE is the background face of the popup. The default value is popup-face.

SELECTION-FACE is the foreground (selection) face of the popup The default value is popup-face.

If SCROLL-BAR is non-nil, the popup will have a scroll bar at the right.

If MARGIN-LEFT is non-nil, the popup will have a margin at the left.

If MARGIN-RIGHT is non-nil, the popup will have a margin at the right.

SYMBOL is a single character which indicates the kind of the item.

PARENT is the parent popup instance. If PARENT is omitted, the popup will be a root instance.

PARENT-OFFSET is a row offset from the parent popup.

Here is an example:

(setq popup (popup-create (point) 10 10))
(popup-set-list popup '("Foo" "Bar" "Baz"))
(popup-draw popup)
;; do something here
(popup-delete popup)

Function: popup-delete

popup-delete popup

Delete the POPUP.

Function: popup-live-p

popup-live-p popup => boolean

Function: popup-set-list

popup-set-list popup list

Set the contents of the POPUP. LIST has to be popup items.

Function: popup-draw

popup-draw popup

Draw the contents of the POPUP.

Function: popup-hide

popup-hide popup

Hide the POPUP. To show again, call popup-draw.

Function: popup-hidden-p

popup-hidden-p popup

Return non-nil if the POPUP is hidden.

Function: popup-select

    popup-select popup index

Select the item of INDEX of the POPUP.

Function: popup-selected-item

popup-selected-item popup => item

Return the selected item of the POPUP.

Return non-nil if the POPUP is still alive.

Function: popup-next

popup-next popup

Select the next item of the POPUP.

Function: popup-previous

popup-previous popup

Select the next item of the POPUP.

Function: popup-scroll-down

popup-scroll-down popup n

Scroll down N items of the POPUP. This won't wrap.

Function: popup-scroll-up

popup-scroll-up popup n

Scroll up N items of the POPUP. This won't wrap.

Function: popup-isearch

popup-isearch popup &key cursor-color keymap callback help-delay
=> boolean

Enter incremental search event loop of POPUP.

Tooltips

A tooltip is an useful visual UI widget for displaying information something about what cursor points to.

Function: popup-tip

popup-tip string &key point around width height min-height max-width
truncate margin margin-left margin-right scroll-bar parent
parent-offset nowait nostrip prompt

Show a tooltip with message STRING at POINT. This function is synchronized unless NOWAIT specified. Almost all arguments are same as popup-create except for TRUNCATE, NOWAIT, NOSTRIP and PROMPT.

If TRUNCATE is non-nil, the tooltip can be truncated.

If NOWAIT is non-nil, this function immediately returns the tooltip instance without entering event loop.

If NOSTRIP is non-nil, STRING properties are not stripped.

PROMPT is a prompt string used when reading events during the event loop.

Here is an example:

(popup-tip "Hello, World!")
;; reach here after the tooltip disappeared

Popup Menus

Popup menu is an useful visual UI widget for prompting users to select an item of a list.

Function: popup-menu*

popup-menu* list &key point around width height margin margin-left
margin-right scroll-bar symbol parent parent-offset keymap
fallback help-delay nowait prompt isearch isearch-filter isearch-cursor-color
isearch-keymap isearch-callback initial-index => selected-value

Show a popup menu of LIST at POINT. This function returns the value of the selected item. Almost all arguments are same as popup-create except for KEYMAP, FALLBACK, HELP-DELAY, PROMPT, ISEARCH, ISEARCH-FILTER, ISEARCH-CURSOR-COLOR, ISEARCH-KEYMAP and ISEARCH-CALLBACK.

If KEYMAP is provided, it is a keymap which is used when processing events during event loop.

If FALLBACK is provided, it is a function taking two arguments; a key and a command. FALLBACK is called when no special operation is found on the key. The default value is popup-menu-fallback, which does nothing.

HELP-DELAY is a delay of displaying helps.

If NOWAIT is non-nil, this function immediately returns the menu instance without entering event loop.

PROMPT is a prompt string when reading events during event loop.

If ISEARCH is non-nil, do isearch as soon as displaying the popup menu.

ISEARCH-FILTER is a filtering function taking two arguments: search pattern and list of items. Returns a list of matching items.

ISEARCH-CURSOR-COLOR is a cursor color during isearch. The default value is `popup-isearch-cursor-color'.

ISEARCH-KEYMAP is a keymap which is used when processing events during event loop. The default value is popup-isearch-keymap.

ISEARCH-CALLBACK is a function taking one argument. popup-menu calls ISEARCH-CALLBACK, if specified, after isearch finished or isearch canceled. The arguments is whole filtered list of items.

If INITIAL-INDEX is non-nil, this is an initial index value for popup-select. Only positive integer is valid.

Here is an example:

(popup-menu* '("Foo" "Bar" "Baz"))
;; => "Baz" if you select Baz
(popup-menu* (list (popup-make-item "Yes" :value t)
                   (popup-make-item "No" :value nil)))
;; => t if you select Yes

Function: popup-cascade-menu

Same as popup-menu except that an element of LIST can be also a sub-menu if the element is a cons cell formed (ITEM . SUBLIST) where ITEM is an usual item and SUBLIST is a list of the sub menu.

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 <[email protected]>
Copyright (C) 2020-2022 Jen-Chieh Shen <[email protected]>

popup-el's People

Contributors

aki2o avatar ancane avatar dependabot[bot] avatar drvink avatar edwardbetts avatar froydnj avatar gcv avatar jcs090218 avatar kenbeese avatar kiyoka avatar konubinix avatar kostafey avatar lemonbreezes avatar m2ym avatar markus1189 avatar phst avatar ramnes avatar ryantm avatar sdwolfz avatar spwhitton avatar syohex avatar tarsius avatar tkf avatar tumashu avatar uk-ar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

popup-el's Issues

Can't clone popup-el

Just tried doing an el-get update on auto-complete, died trying to clone the popup submodule with the following error:

fatal: remote error: access denied or repository not exported: /c/nw/cc/ce/b2/1410546/1410546.git

Trying to do a git clone git://github.com/auto-complete/popup-el gives the same error

Popup is disrupted when using scroll-bar with margin in right end.

Popup is disrupted in the following test code.

(ert-deftest popup-test-scroll-bar-right ()
  (popup-test-with-temp-buffer
    (insert (make-string (- (window-width) 1) ? ))
    (let* ((popup-scroll-bar-foreground-char
            (propertize "f" 'face 'popup-scroll-bar-foreground-face))
           (popup-scroll-bar-background-char
            (propertize "b" 'face 'popup-scroll-bar-background-face))
           (popup (popup-tip "Foo\nBar\nBaz\nFez\nOz"
                             :nowait t :height 3 :scroll-bar t :margin t)))
      (with-current-buffer (popup-test-helper-get-overlays-buffer)
        (let ((points (popup-test-helper-match-points
                       '("Foof" "Barb" "Bazb"))))
          (should (equal (popup-test-helper-same-all-p
                          (popup-test-helper-points-to-columns points))
                         (- (window-width) 5)))
          (should (eq (line-number-at-pos (car points)) 2))
          )))))

new release tag

Good day. Is it possible to put new release tag, so that new features like popup-menu* :initial-index deployed to melpa-stable?
Thanks in advance.

PopUp close

I'm using popup.el but I'm not able to close or open the popup help
I'm using the code

(require 'popup)
(define-key popup-menu-keymap [esc] 'popup-close)
(popup-menu* '("hello" "word"))

But using left or esc have no effect and the popup remain opened until I select an element

something wrong with :max-width

popup-create: Keyword argument :max-width not one of (:min-height :around :face :mouse-face :selection-face :scroll-bar :margin-left :margin-right :symbol :parent :parent-offset :keymap)

Create "in-snippet" predicate

Create a predicate that allows user to see whether or not they are currently in a snippet. This would help with configuring other modes to disable themselves (or enable themselves) in the event that the user is currently inside of a snippet.

My primary motivation would be something like the following:

(defadvice ac-expand (before advice-for-ac-expand activate)
  (when (yas-in-snippet-p)
    (ac-stop))```

Which would allow you to disable autocompletion if inside a snippet.

popup for auto-complete breaks in buffer's last lines

Hi, here is the issue description:

(defvar issue
  '(:env '((os "Debian wheezy/sid")
           (:name "emacs"         :from "debian apt-get"     :version "GNU Emacs 23.4.1")
           (:name "popup"         :from "m2ym/popup-el"      :version "master")
           (:name "fuzzy"         :from "m2ym/fuzzy-el"      :version "master")
           (:name "auto-complete" :from "m2ym/auto-complete" :version "master"))

         :issue-detail
         '((:in "(nth-line -1)" :symptom "ac-quick-help keeps in dropdown list's last line")
           (:in "(nth-line -2)" :symptom "ac-quick-help keeps in dropdown list's last line")
           (:in "(nth-line -3)" :symptom
                "ac-quick-help keeps in dropdown list's first line, but:
               lines from 2 to 9 (= ac-menu-height 10) are all empty, and
               all the rest help string are in the last line."))

         :solve-it
         '(replace-string "(when (eobp)
        (popup-save-buffer-state
          (let ((begin (point)))
            (insert \" \")
            (setq padding (make-overlay begin (point)))
            (overlay-put padding 'evaporate t))))"
                          "(let ((newlines (max 0 (+ (- height (count-lines point (point-max))) (if around 1 0)))))
        (when (> newlines 0)
          (popup-save-buffer-state
            (goto-char (point-max))
            (let ((begin (point)))
              (insert (make-string newlines ?\n))
              (setq padding (make-overlay begin (point)))
              (overlay-put padding 'evaporate t)))))")))

Popup can't show candidates without selecting.

This is based on conversation with @supermomonga.

In some cases, for example, using autocomplete.el, we want to show candidates without selecting one of them. By default, auto-complete.el force to select the first candidate and pressing Enter key expands the candidate.

What we really want is:

Enter and Tab: expand candidate if selected, otherwise self insert.
(Optional) Tab: always expand. If nothing selected, expand first one.

AFAIU, popup.el doesn't admit this. I think we'll easily implement the above (optional) feature to auto-complete.el if popup.el admits it. (We may need some additional APIs.) However the modification for it on popup.el is not straightforward, I guess.

What do you think of it?

popup-isearch blocks test execution.

popup-isearch blocks test execution in the following test code.

(ert-deftest popup-test-isearch ()
  (popup-test-with-common-setup
    (popup-set-list popup '("foo" "bar" "baz"))
    (popup-draw popup)
    (popup-test-helper-input ?a)
    (popup-isearch popup)
    (should (equal (popup-list popup) '("bar" "baz")))
    (should (every #'identity
                   (popup-test-helper-match-points '("bar" "baz"))))
    ))

Is it possible to change popup-isearch spec to use overriding-terminal-local-map as isearch-mode do?

flycheck popup is messed up

For some reason flycheck compilation error popup can't be displayed over text so it chooses to add each line of compilation error popup at the end of existing line:

Disabling fci-mode fixes issue, would be great to make popup-el to work properly with fci-mode tho.

How do I capture keys in a popup-tip?

I was looking at enhancing git-messenger to copy the commit for a given commit to the kill-ring if a certain key was pressed. It seems hard to do this with the popup-tip and using the menu machinery seems excessive given I don't want to loose the info in the tip. Any tips?

word-wrap in popup-tip

Hi,

Is there a variable that I configure to turn on the word-wrap feature in popup-tip function?

`make test`: use `--batch`?

There might be an advantage I'm not aware of, but wouldn't it be better to run the tests with --batch? That would it possible for non-interactive test/builds since we wouldn't have to close the buffer of test results.

Variable-width default font breaks menu alignment

My default font is `:family "Lucida Sans"' - variable width. Popup renders menus in variable-width-face-buffers unaligned:

image

Perhaps there are calls to string length, which should be changed to string width?

In any case I can live with it, it just doesn't look as good as it could.

popup-tip ignores margin when beginning of line,and popup is disrupted when end of line.

popup-tip ignore margin when beginning of line,and popup is disrupted when end of line.
Here is the test code.

(ert-deftest popup-test-margin-at-left ()
  (popup-test-with-temp-buffer
    (let ((popup (popup-tip "Margin?" :nowait t :margin t)))
      (with-current-buffer (popup-test-helper-get-overlays-buffer)
        (let ((points (popup-test-helper-match-points '(" Margin? "))))
          (should (every #'identity points))
          (should (equal (car (popup-test-helper-points-to-columns points))
                         0))
          )))))

(ert-deftest popup-test-margin-at-right ()
  (popup-test-with-temp-buffer
    (insert (make-string (- (window-width) 1) ? ))
    (let ((popup (popup-tip "Margin?" :nowait t :margin t)))
      (with-current-buffer (popup-test-helper-get-overlays-buffer)
        (let ((points (popup-test-helper-match-points '(" Margin? "))))
          (should (every #'identity points))
          (should (equal (car (popup-test-helper-points-to-columns points))
                         (- (window-width) 9)))
          )))))

popup-complete

I found a brilliantly useful function called popup-complete here http://www.emacswiki.org/emacs/PopUp which references your project.

But I can't find it here. Assuming you have something to do with it, where is popup-complete distributed? It would be really fantastic if it were available on MELPA.

Add to GNU ELPA?

Many third-party projects consider this as a de-facto popup library. It would be good to be able to use it everywhere, including Company, if only to spare the users from having to set up the same faces when different popups are used.

In order to do that, all non-trivial contributors would have to sign copyright assignments to FSF. Is that feasible?

If this goes through, I'll try to take care of the current display bugs. You have several long-standing ones, and I believe most (all?) of them are fixed in Company's popup now.

x-popup-menu as alternative backend?

Reading open issues, it seems most of the problems are from overlays from other modules and non-uniform text size (e.g., proportional font). I guess these problems are difficult to solve, probably impossible for the later case. Alternatively I think we can use x-popup-menu as the "backend" and then these problems won't show up with it. I am just raising the idea and wondering if there is somebody already tried.

For those who are curious, you can try x-popup-menu easily by:

(x-popup-menu
 t
 '("Title"
   ("Title 1" ("Item 1-1" . 11) ("Item 1-2" . 12))
   ("Title 2" ("Item 2-1" . 21) ("Item 2-2" . 22))))

Keymap not used

I can't seem to get popup to use the keymap I'm giving it. Here's a snippet of how I'm declaring the keymap and creating the actual popup:

(defvar om-menu-keymap
  (let ((map (make-sparse-keymap)))
    (define-key map "\M-n"    'om-menu-next)
    (define-key map "\M-p"    'om-menu-previous)
    map))
(setq om-menu (popup-create (point) 15 10 ;om-menu-width om-menu-height
                                :around t
                                :face 'om-candidate-face
                                :mouse-face 'om-candidate-mouse-face
                                :selection-face 'om-selection-face
                                :symbol t
                                :scroll-bar t
                                :margin-left 0
                                :keymap om-menu-map)))
  (popup-set-list om-menu om-autocomplete-candidates)
  (popup-draw om-menu)

Why is popup not accepting the keymap I'm passing to popup-create?

FR: Filtering isearch candidates

This is a feature request for the following use case:

The user has a popup, with a lot of elements in it. He/she would like
to match a part of them at a time, each time filtering the remaining
candidates with a new search.

Example:

The user has these words in his/her popup:

  • schtroumpfed
  • squirrelled
  • broughammed
  • schmaltzed
  • squirreled
  • scrootched
  • scroonched
  • scraunched
  • strengthed

to match words starting with "sc" the user can isearch for "sc".
Then the user would like to match words with "led" in them, so the
user performs another search for "led".
The remaining match is "scrolled".

The words were taken from:

https://en.wikipedia.org/wiki/List_of_the_longest_English_words_with_one_syllable

posn-at-point returns unexpected list

In common cases (posn-at-point) returns structure like:
(#<window 12 on TAGS<idid>> 90 (0 . 100) 0 nil 90 (0 . 5) nil (0 . 0) (10 . 20))

In rare cases (posn-at-point) returns:
(#<frame : 0x1149ad8> nil (0 . 0) 0)

E.g. after ^L char in TAGS buffers.

This leads to error on popup-create call:

Debugger entered--Lisp error: (wrong-type-argument windowp #<frame : /home/kostafey/.emacs.d/elpa/popup-20150116.1223/popup.el 0x1149ad8>)
  window-buffer(#<frame : /home/kostafey/.emacs.d/elpa/popup-20150116.1223/popup.el 0x1149ad8>)
  posn-col-row((#<frame : /home/kostafey/.emacs.d/elpa/popup-20150116.1223/popup.el 0x1149ad8> nil (0 . 0) 0))
  popup-create(640 50 15 :max-width nil :around nil :face popup-menu-face :mouse-face popup-menu-mouse-face :selection-face popup-menu-selection-face :summary-face popup-menu-summary-face :margin-left 1 :margin-right 0 :scroll-bar t :symbol nil :parent nil :parent-offset nil)
  popup-menu*(("popup.el<popup-20150116.1223>" "TAGS<idid>" "*scratch*" "*Messages*" "*Compile-Log*" "*Quail Completions*" "popup.el<popup-el>" "profiles.clj" "keyboard.c" "subr.el.gz" "popup-switcher.el" "speed.clj" "report.html" "wservice.clj" "clojure-conf.el" "cider-interaction.el" "key-bindings.org" "clomacs.el" "core.clj" "plot.sh" "helpers.clj" "form-init916177696597684299.clj" "project.clj" "form-init5549897678859169329.clj" "handler.clj" "launch.txt" "form-init5785223491863655970.clj" "plotting_data1.dat" "org-loaddefs.el<org-plus-contrib-20150223>" "org-loaddefs.el<org-20150223>" "stat.h") :point 640 :height 15 :scroll-bar t :margin-left 1 :margin-right 1 :around nil :isearch t)
  psw-popup-menu(("popup.el<popup-20150116.1223>" "TAGS<idid>" "*scratch*" "*Messages*" "*Compile-Log*" "*Quail Completions*" "popup.el<popup-el>" "profiles.clj" "keyboard.c" "subr.el.gz" "popup-switcher.el" "speed.clj" "report.html" "wservice.clj" "clojure-conf.el" "cider-interaction.el" "key-bindings.org" "clomacs.el" "core.clj" "plot.sh" "helpers.clj" "form-init916177696597684299.clj" "project.clj" "form-init5549897678859169329.clj" "handler.clj" "launch.txt" "form-init5785223491863655970.clj" "plotting_data1.dat" "org-loaddefs.el<org-plus-contrib-20150223>" "org-loaddefs.el<org-20150223>" "stat.h"))
  psw-switcher(:items-list (#<buffer popup.el<popup-20150116.1223>> #<buffer TAGS<idid>> #<buffer TAGS<idid>> #<buffer *scratch*> #<buffer *Messages*> #<buffer *Compile-Log*> #<buffer *Quail Completions*> #<buffer popup.el<popup-el>> #<buffer profiles.clj> #<buffer keyboard.c> #<buffer subr.el.gz> #<buffer popup-switcher.el> #<buffer speed.clj> #<buffer report.html> #<buffer wservice.clj> #<buffer clojure-conf.el> #<buffer cider-interaction.el> #<buffer key-bindings.org> #<buffer clomacs.el> #<buffer core.clj> #<buffer plot.sh> #<buffer helpers.clj> #<buffer form-init916177696597684299.clj> #<buffer project.clj> #<buffer form-init5549897678859169329.clj> #<buffer handler.clj> #<buffer launch.txt> #<buffer form-init5785223491863655970.clj> #<buffer plotting_data1.dat> #<buffer org-loaddefs.el<org-plus-contrib-20150223>> #<buffer org-loaddefs.el<org-20150223>> #<buffer stat.h>) :item-name-getter #[257 "r\211q\210�\203�\301 \203�\302 \204�\303 \304P\202�\303 )\207" [psw-mark-modified-buffers buffer-modified-p psw-is-temp-buffer buffer-name " *"] 3 "\n\n(fn BUFFER)"] :switcher switch-to-buffer)
  psw-switch-buffer()
  call-interactively(psw-switch-buffer nil nil)
  command-execute(psw-switch-buffer)

The early used (popup-current-physical-column) (see: kenbeese@c02ec73#diff-99b97c0478ea73bf04732050d7160dc4L539)
don't have such problems.

Is it possible to return previous (popup-current-physical-column) usage or any other solutions to get current point position correctly in all cases?

Line feeds can be ignored in `popup-tip`

Line feeds can be ignored in popup-tip because fill-region ignores them.
Here is an example:

ELISP> (popup-fill-string "line 1\nline 2" 12)
(11 "line 1 line" "2")

I wonder if this is expected behavior.
FYI, we can avoid it by setting use-hard-newlines to non-nil.

ELISP> (defadvice fill-region (before my-fill-region activate)
         (setq use-hard-newlines t))
fill-region
ELISP> (popup-fill-string (format "line 1%sline 2" (propertize "\n" 'hard t)) 12)
(6 "line 1" "line 2")

Popup alignment in php-mode inexplicably broken for me.

I'm having the strangest problem all of a sudden with alignment of popup menus in auto-complete when using php-mode. This is what it looks like:

image

To try to diagnose whether this was just an issue with my config, I tried:

  1. Rolling back my .emacs by several weeks (it's in git, of course).
  2. Deleting my entire ~/.emacs.d/elpa directory and re-downloading/re-compiling all packages.

Neither of these helped. This problem doesn't seem to affect text-mode or lisp-interaction-mode, though, as shown here:

image

image

I've also opened an issue with php-mode, but they haven't been able to reproduce it. I have attempted to debug what is going on in popup.el, but admittedly my Lisp isn't very strong and I can't figure out how the placement of the left edge of the popup is computed.

Any help or direction on how to figure this out would be greatly appreciated.

Fuzzy matching to isearch

Are you plannig to add fuzzy matching to isearch on popup-menu?
Will you accept such idea to popup-el?

Add tag 0.5

Please add a 0.5 tag, so that the new version is included into melpa-stable

Otherwise auto-complete is uninstallable there, since it depends on popup 0.5

Thanks for your great work

With Jedi: Docstrings won't overlap other code

(Previously posted as Jedi-issue #174.)

Docstrings in auto-complete list all of a sudden shows some weird behavior in my emacs setup, as shown in the picture below.

To ensure that the docstrings will show when the dot is close to the right margin, I have the following in my .emacs file:

(setq jedi:complete-on-dot)
(add-hook 'python-mode-hook 'jedi:setup)
; preventing unwanted behavior of the doc strings
(defun my/jedi-mode-hook ()
  (setq-local ac-max-width 0.5))
(add-hook 'jedi-mode-hook 'my/jedi-mode-hook)

All help would be greatly appreciated.

How to scroll in a popup-tip?

Hi, I have created a popup-tip with :scroll-bar t, and now I don't know hot to scroll it down. I have seen the popup-menu-keymap in the source, but that doesn't seem to be tied to popup-tip.

popups don't play nicely with allout mode

Hey,

I've noticed that popups get corrupted by hidden text in modes like allout mode (and likely outline mode, etc).

For example, if we want an autocomplete popup near these hidden sections:

Corruption happens at exactly the lines that were hidden:

Here is a file with allout structure: http://git.savannah.gnu.org/cgit/emacs.git/plain/lisp/allout.el

When viewing this file, M-x allout-mode, M-x allout-hide-bodies, and try opening a popup (maybe through autocomplete) near hidden text.

When popup-tip. the letter I typed went unreadable.

On OSX terminal, I tried to type Japanese letter while showing popup-tip but the letter went unreadable.
I’m not using Japanese input method on emacs but using system wide Japanese input method.
the gif shows what I did.

untitled2

popup-tip convert faces

Hi, I am trying to display some text with popup-tip. The text may contain italics or bold, but I want it to display with the tooltip face as the base, rather than the buffer's default.

(popup-tip  #("foo bar" 0 3 (face bold) 3 4 nil 4 7 (face italic)) :nostrip t)

Can popup-tip do this conversion or do I have to do the conversion myself?

Overlays Break Popup

I think this issue might be related to issue #3. Here is the screenshot from the org-mode buffer. Couple headers are closed and their overlay breaks the popup

2013-11-20_10-09-25

variable pitch mode

when using popup.el in a buffer with variable-pitch-mode the popup looks distorted.

popup

Popup is disrupted when already exists popup-tip

Popup is disrupted in the following test code.

(ert-deftest popup-test-two-tip ()
  (popup-test-with-temp-buffer
   (popup-tip "Foo\nBar" :nowait t)
   (save-excursion (insert "\n"))
   (popup-tip "Baz\nQux" :nowait t)
   (with-current-buffer (popup-test-helper-get-overlays-buffer)
     (let ((points1 (popup-test-helper-match-points '("Foo" "Bar")))
           (points2 (popup-test-helper-match-points '("Baz" "Qux"))))
       (should (popup-test-helper-same-all-p
                (popup-test-helper-points-to-columns points1)))
       (should (popup-test-helper-same-all-p
                (popup-test-helper-points-to-columns points2)))
       (should (eq (line-number-at-pos (car points2)) 2))
       (should (eq (line-number-at-pos (car points1)) 3))
       ))))

Intermittent error

From time to time I get an error looking like the below. Most of the time everything works fine, and I haven't been able to determine exactly what triggers the error. The error arises when using auto-complete with nREPL 0.1.8-preview and ac-nrepl 20130420.929.

Debugger entered--Lisp error: (args-out-of-range 1 143)
count-lines(143 1)
popup-create(143 69 20 :min-height 0 :around t :margin-left nil :margin-right nil :scroll-bar nil :face popup-tip-face :parent nil :parent-offset nil)
popup-tip("clojure.core/take\n([n coll])\nReturns a lazy sequence of the first n items in coll, or all items if\nthere are fewer than n.\n" :point 143 :height 20 :min-height 0 :around t :parent nil :parent-offset nil :point 143 :height 20 :nowait t)
apply(popup-tip "clojure.core/take\n([n coll])\nReturns a lazy sequence of the first n items in coll, or all items if\nthere are fewer than n.\n" :point 143 :height 20 :min-height 0 :around t :parent nil :parent-offset nil (:point 143 :height 20 :nowait t))
popup-menu-show-quick-help([cl-struct-popup 143 8 0 10 10 nil 1 # # # # # # # # # # (mouse-4 . ac-mouse-4) (down-mouse-1 . ac-ignore) (mouse-1 . ac-mouse-1) (19 . ac-isearch) (16 . ac-previous) (14 . ac-next) keymap (C-up . ac-quick-help-scroll-up) (C-down . ac-quick-help-scroll-down) (67108927 . ac-help) (M-f1 . ac-persist-help) (f1 . ac-help) (up . ac-previous) (down . ac-next) (27 keymap (57 . ac-complete-9) (56 . ac-complete-8) (55 . ac-complete-7) (54 . ac-complete-6) (53 . ac-complete-5) (52 . ac-complete-4) (51 . ac-complete-3) (50 . ac-complete-2) (49 . ac-complete-1) (16 . ac-quick-help-scroll-up) (14 . ac-quick-help-scroll-down) (67108927 . ac-persist-help) (112 . ac-previous) (110 . ac-next) (9 . auto-complete)) (return) (13) (tab . ac-expand) (9 . ac-expand)) nil 0 ac-candidate-face ac-candidate-mouse-face ac-selection-face popup-summary-face 1 0 nil t t 0 0 0 0 (#("take" 0 4 (selection-face ac-nrepl-selection-face popup-face ac-nrepl-candidate-face document ac-nrepl-documentation symbol "v")) #("take-nth" 0 8 (selection-face ac-nrepl-selection-face popup-face ac-nrepl-candidate-face document ac-nrepl-documentation symbol "v")) #("take-last" 0 9 (selection-face ac-nrepl-selection-face popup-face ac-nrepl-candidate-face document ac-nrepl-documentation symbol "v")) #("take-while" 0 10 (selection-face ac-nrepl-selection-face popup-face ac-nrepl-candidate-face document ac-nrepl-documentation symbol "v"))) 9 nil (#("take" 0 4 (selection-face ac-nrepl-selection-face popup-face ac-nrepl-candidate-face document ac-nrepl-documentation symbol "v")) #("take-nth" 0 8 (selection-face ac-nrepl-selection-face popup-face ac-nrepl-candidate-face document ac-nrepl-documentation symbol "v")) #("take-last" 0 9 (selection-face ac-nrepl-selection-face popup-face ac-nrepl-candidate-face document ac-nrepl-documentation symbol "v")) #("take-while" 0 10 (selection-face ac-nrepl-selection-face popup-face ac-nrepl-candidate-face document ac-nrepl-documentation symbol "v")))] nil :point 143 :height 20 :nowait t)
ac-quick-help()
apply(ac-quick-help nil)
byte-code("r\301\302H\303H\"\210)\301\207" [timer apply 5 6] 4)
timer-event-handler([t 0 0 500000 0.5 ac-quick-help nil idle 0])
accept-process-output(nil 0.005)
nrepl-send-request-sync(("ns" "com.jayway.rps.core" "op" "eval" "session" "c6135125-2940-4693-bdaa-741f1e075b90" "code" "(require 'complete.core) (filter #(.startsWith % \"ta\")(complete.core/namespaces ns))"))
nrepl-send-string-sync("(require 'complete.core) (filter #(.startsWith % \"ta\")(complete.core/namespaces ns))" "com.jayway.rps.core" "c6135125-2940-4693-bdaa-741f1e075b90")
ac-nrepl-sync-eval("(require 'complete.core) (filter #(.startsWith % \"ta\")(complete.core/namespaces ns))")
ac-nrepl-candidates*("(filter #(.startsWith % \"ta\")(complete.core/namespaces ns))")
ac-nrepl-candidates-ns()
ac-candidates-1(((candidates . ac-nrepl-candidates-ns) (symbol . "n") (available . ac-nrepl-available-p) (candidate-face . ac-nrepl-candidate-face) (selection-face . ac-nrepl-selection-face) (prefix . ac-nrepl-symbol-start-pos) (document . ac-nrepl-documentation)))
ac-candidates()
ac-update(t)
ac-show-menu()
apply(ac-show-menu nil)
byte-code("r\301\302H\303H\"\210)\301\207" [timer apply 5 6] 4)
timer-event-handler([t 0 0 400000 0.4 ac-show-menu nil idle 0])

creating a popup w/ an empty string leaves blank lines behind

While I was debugging jorgenschaefer/elpy#182, I dived deep into auto-complete.el and popup.el to find the cause for the "permanently" added empty lines I was seeing w/ elpy.

In the case of elpy, auto-complete queried for a documentation string and got an empty string which it used to create a quick tip (ac-quick-help -> popup-menu-show-quick-help -> popup-tip -> popup-create).

Most likely, a popup w/ width 0 is created, which will cause trouble in some conditional blocks. I haven't had the time to debug this even further, I am afraid. But if a helping hand is needed, I'll gladly lend one or two. :)

Besides that, the bug could be seen as twofold: Neither should auto-complete.el try to create a popup w/ no contents, nor should popup.el get in an undefined state if someone tries something like that.

Popup fails to align correctly in Emacs Lisp mode

It works incorrectly in elisp mode. Different lines in the function list (the left dialogue) seem have different length, so do the associated dialogue (the right one) for more details. The problem is illustrated as
screen shot 2015-06-08 at 16 33 08
Maybe due to the upgrade of packages one month ago. It showed correctly before.
However, it still works well in cc-mode or python-mode, shown as
screen shot 2015-06-08 at 16 41 04


One more question:
Could we stop the blank in the left dialogue due to the line wrapping in the right dialogue by adding some configurations, as shown in the above figures or the figure below in python mode? (when I use "wrap at window edge" or "word wrap"; appearing in any modes) .
screen shot 2015-06-08 at 16 57 45
When I use "truncate long line", it doesn't have this problem, but not satisfactory to be a solution due to the large length of most functions.

screen shot 2015-06-08 at 16 53 06

version:
emacs: 24.4.1
ac-complete: 20150408.1132
popup: 20150315.612

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.