Skip to content
This repository

per-instance max-width for popup instances #29

Closed
wants to merge 5 commits into from

5 participants

Yusuke Tsutsumi Takafumi Arakaki Tomohiro Matsuyama Syohei YOSHIDA
Yusuke Tsutsumi

Hi there,

I had a similar request for popup.el as auto-complete/popup-el#28, and I thought I'd contribute the per-instance based max-width, in a separate pull request as indicated. I also thought @laynor's addition to choosing the maximum width as ratio or character based value was cool so I added that in as well.

Yusuke Tsutsumi toumorokoshi referenced this pull request in auto-complete/auto-complete January 13, 2013
Closed

Adding customizable ac-max-width to auto-complete #202

popup.el
@@ -34,6 +34,14 @@
1
Takafumi Arakaki Collaborator
tkf added a note January 13, 2013

Please add popup- prefix. Also, please remove the trailing whitespace in the next line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
popup.el
@@ -471,6 +480,9 @@ number at the point."
1
Takafumi Arakaki Collaborator
tkf added a note January 13, 2013

Please do M-q to make the docstring narrower. If you look around the docstring in the code, it's about < 70 always.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
popup.el
@@ -501,7 +513,8 @@ KEYMAP is a keymap that will be put on the popup contents."
1
Takafumi Arakaki Collaborator
tkf added a note January 13, 2013

Super minor point, but let's use when instead of if, when we are not using the else clause.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Takafumi Arakaki
Collaborator
tkf commented January 13, 2013

Other than the minor points I mentioned on the source code:

  • Why not add max-width also to popup-tip and popup-menu*?

  • This pull request also breaks "multiple of 10" restriction. If we remove this restriction in #28, we can pull this request as-is.

Yusuke Tsutsumi

Thanks for the tips! I'm not super knowledgeable about the elisp world so it's helpful to get comments.

I've added a couple commits that add max-width to popup-tip and popup-menu* as well as fixing those points made in the comments.

I made a separate commit for the rounding depending on whether you want the "multiple of 10" restriction or not. I thought it would make sense to enforce that when choosing a width based off of the window, but not for specific character lengths, so I left the latter case alone.

Tomohiro Matsuyama

s/max-width/width/ ?

Tomohiro Matsuyama
Owner

Great work but I'm skeptical about the ratio option of max-width. Is it really useful rather than just specifying max-width like :max-width (* 0.3 (window-body-widht)) at the client side? Is it sure there is no corner case?

By the way, I've added few comments on your commits. Please take a look.

Yusuke Tsutsumi

Thanks for catching that typo, I have no idea how that worked before! I've committed a fix.

I suppose the scaling max-width is not necessary, people can just set it like you stated. I think it would be useful though. I mainly wanted this ability because I ran into issues with auto-complete and found that a large summary fills the whole screen with no space for tips:

Screenshot from 2013-01-21 21:42:55

I personally want to set the max-width to a value relative to the buffer size, so I can see the tooltip regardless of how wide the buffer is:

Screenshot from 2013-01-12 23:06:51

I think most people want popups to scale relative to buffer width, not to a limited number of characters. Although I could be wrong.

Only corner case I can think of is the difference between 1 (1 character) and 1.0 (full width of buffer). I thought the distinction could be made clear by choosing an int or float.

I agree with @toumorokoshi: it would be good to have popups that scale with the buffer width. I'm not that good in elisp (i.e. I just know it exists :-P) but I'd be glad to contribute in whatever way I can.

petrux referenced this pull request in jorgenschaefer/elpy November 28, 2013
Open

Document popup size and content #166

Yusuke Tsutsumi

@tkf @m2ym can we get this merged in? If the max-width being a proportion is a problem I can change it, I see the advantage to just having users set it explicitly.

Syohei YOSHIDA syohex referenced this pull request from a commit January 23, 2014
Syohei YOSHIDA Support max-width for popup instance
Patch of pull request #29 cannot be merged now. I fix it for
current popup.el.
69d5bf9
Syohei YOSHIDA syohex closed this January 24, 2014
Syohei YOSHIDA
Collaborator

@toumorokoshi I have merged max-width feature. Please report us if you have problems.
And sorry for too late reply.

Thanks for good changes.

Yusuke Tsutsumi

@syohex Thanks so much for merging this! I appreciate it, especially making a new request to make the merge easier :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 19 additions and 1 deletion. Show diff stats Hide diff stats

  1. 20  popup.el
20  popup.el
@@ -34,6 +34,14 @@
@@ -455,6 +463,7 @@ number at the point."
@@ -471,6 +480,10 @@ number at the point."
@@ -501,7 +514,8 @@ KEYMAP is a keymap that will be put on the popup contents."
@@ -947,6 +961,7 @@ HELP-DELAY is a delay of displaying helps."
@@ -982,6 +997,7 @@ PROMPT is a prompt string when reading events during event loop."
@@ -1174,6 +1190,7 @@ PROMPT is a prompt string when reading events during event loop."
@@ -1233,6 +1250,7 @@ isearch canceled. The arguments is whole filtered list of items."
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.