Wrapping variable width text in Emacs Lisp - emacs

I am hacking up a tagging application for emacs. I have got a tag cloud/weighted list successfully displaying on a buffer, but i am running into a snag. I need to be able to properly word-wrap the buffer, but I haven't a clue where to start.
The font I am using is a variable width font. On top of that, each tag is going to be in a different size, depending on how many times it shows up on the buffer. Finally, the window that displays the tagcloud could be in a window that is 200 pixels wide, or the full screen width.
I really have no idea where to start. I tried longlines mode on the tagcloud buffer, but that didn't work.
Source code is at: http://emacswiki.org/cgi-bin/emacs/free-tagging.el

You probably want to track posn-at-point and posn-at-x-y as you put the tags in the buffer.

Can you use (fill-paragraph) or (fill-region) or similar? They wrap at a column, so don't have variable width font smarts, but if the fill column is low they might work for next to no effort. At least until you get a pixel-perfect solution sorted out :-) (maybe YAGNI...)

Related

Display larger indentation for files that are indented with just two spaces

I'm working on a project that is using 2 spaces as indentation.
I have a hard time reading code with such small indentation, so my question is:
Question: Can I make vscode show the two spaces as if they were wider (for example double the width)?
(I could of course solve it in a hackish way, by converting each file on checkout, and convert it back before i commit it, but that would be very tedious and error prone. I could also try to convince the project to convert the whole project to tabs, so that everyone can use their own preferred indentation. But I don't want to go into that discussion for every project I work on :) )
I have written the extension Indent Whitespace that decorates each space used in indentation with additional spaces (cursor will skip the decoration).
The decorated spaces are colored with a very transparent red.
With a setting you can change the number of spaces to add, default 1.
If you delete spaces with Delete it looks funny because the selection does not change, use the Arrow keys to update the decorations.
In a later version I will make the decoration color a setting, and also only update the decoration when the file changes (only important for large files, and fix the delete-update rendering).
I think you can't.
There is no such setting in VS Code. As of version 1.13, you can change the kerning, but this changes the spacing between all characters. You cannot do this only for a single character (or a set of characters).
The space width is a property of the font. Microsoft has a guideline that defines what is the ideal space size for a font. But this does not mean you cannot change it yourself when designing one. So I created a version of Roboto Mono which space character is 4x the original one.
This works on Notepad and MS Word, we can see the space is quite big. However, using the exact same font in VS Code, the space is still small, independently of the font being monospaced or not.
Illustration
Somehow, it looks like VS Code ignores space size in the font and decides by itself what is the best value.

Fillable Pdf multi-line, Allow rich text formatting in Acrobat Pro DC: but it ignores line spacing/leading set in More

I'm on Win10, using Acrobat Pro DC 2021.011... to edit and Reader DC (same version) to test.
From experience and from reading forums etc, forms in these apps are maddening... but I have not been able to find any discussion (or solutions) to the following behavior...
The form I'm building for other employees' use has a large edit text box set to Multi-line and Allow Rich Text Formatting. It is set to a default font, Calibri and size 50pt. For most situations this will work for them; provides 2-3 lines for a short product description. But occasionally they want a smaller font and more lines... They know how to get the ctrl+e properties bar. But in my testing of this alternative situation they'll need sometimes, I'm finding it's impossible to get the smaller font size and more lines to work. Here's my process.
tab into text box. Ctrl+E for properties bar.
before typing I set the font size to 24
then I type in my 4 lines of text
then I tab to my next form field...
and kaboom... the field I just filled...it's line height is so large it's pushed some of the content invisible. I assume this is coming from the field's default font size, 50
And if I try to adjust the line height, by selecting all the text and then choosing in More...>Form Field Text Properties>Paragraph>Line Spacing
If I set it to Single and click Close/click into another field I get the very large leading (presumably for 50pt font (same as pic above after point 5)
If I choose Exactly and set to point size slightly larger, click Close/out of field, I get another ridiculous result where the 2/3 line have the height I set, but the space between the 1 & 2 second line is way too much and the space between the last line and 3rd line is way too small...
before tabbing or clicking out of field to another field
Good lord.. what is that! 3 different leading values in the same field; just after applying 1 value to all lines, all text in the field...
It makes no sense... it doesn't look like it regards your input at all, and just comes up with it's own random leading... I've fiddled with Space before/after and combinations of Line Height and nothing comes close to what we need... At this point I'm convinced the Acrobat tools for a stylizing text in a multi-line, allow formatting text field are useless. I'd be better off with my employees they can't format anything, ever. Just type one line and hit Tab or Enter...
What is going on! I'm trying to make a simple fillable form for other employees to use, but this kind of behavior makes that impossible (It's enough of a stretch to teach them to use the ctrl+E and do some styling of their text but this is bonkers and completely unteachable... there's not rhyme or pattern to teach!)
Hope someone can help or has seen this behavior too.

How to stop word wrapping in emacs

I was playing around with word wrapping yesterday and now I am getting an annoying behavior in my emacs (23.1). When typing in my latex documents the paragraphs are automatically wrapping. As an example, if I open a finished tex document and want to add a space in the middle of a paragraph the entire paragraph gets resized from covering the entire width of the screen to only covering approximately 1/4 of the screen (lines are wrapping around 68-72 columns wide).
Prior to changing anything I saved my original .emacs file, and I have restored the original .emacs to no benefit. I suspect I may have screwed something up in my AucTex configuration, but I cannot find anything to fix this. Any pointers on places to check will be appreciated.

increase 'buffer' column width in buffer list view

I am working with rather longish file names and when viewing the buffer list, the width of the Buffer column is too short for my purposes.
How can I increase that width (at the expense of, say, the width of the Mode or the File columns).
Width I am trying to increase marked with yellow in the screenshot below:
In Emacs 24.3 and later, this is controlled by the variable Buffer-menu-name-width, which defaults to 19 on my system. Something like
(setq Buffer-menu-name-width 40)
should help. Alternatively, you can use something like M-x customize-variable to change it.
In older Emacs versions, Buffer-menu-buffer+size-width should be modified instead. Thanks to the OP for his edit pointing this out.
It looks like the File column fills up whatever space is left over, so this change should take space away from it. If you prefer to take space from the Mode column, you could also modify the Buffer-menu-mode-width variable to something smaller.

Difference between ERT and LyX' custom knitr insets

What's the difference, if any, in terms of control, between using ERTs, as in the minimal example, and using, instead, LyX' own Custom Insets (Chunk, S/R expression, Sweave options) for knitr?
I've replicated the "minimal" examples, using also the Options inset inside a Chunk inset, and I can see no differences. (I am still ignorant on how to use the Sweave options inset.)
There are currently only small differences. Using the chunk inset takes a bit more time, unless you set up shortcuts, because you have to insert the inset, then insert the options. The main advantages are simply that it is marked as a chunk, and you do not have to manually enter "<<>>=" and "#". Sometimes I forget whether it is "<>=" and sometimes I forget the equals sign so this is nice for my bad memory. If you want to get fancy, you can customize the font size and color within the chunk inset (you could do this for ERT also but that would apply for all ERTs, not just knitr chunks). If interested, see Help > Customization in LyX.
We hope to implement some features that might enhance the use of chunk insets over ERT. For example, it would be nice to navigate chunk insets in the outline pane. This is http://www.lyx.org/trac/ticket/7790
It would also be nice to ensure that knitr chunks start and end with newlines. This would prevent some not-so-rare problems. This is http://www.lyx.org/trac/ticket/8875
It comes down to a matter of preference. I prefer the chunk inset, but note that the author of knitr prefers ERT.