UltiSnips: How to make placeholder optional - option-type

I have to create something that looks like this:
\begin{frame}[fragile]{frame title}
lorem ipsum ...
\end{frame}
Note that the portion [fragile] is optional. That is, if I enter some text in the $1 placeholder, it should include the brackets. If I don't enter text in the $1 placeholder, I don't want the brackets at all.
I'm not sure how to make the $1 placeholder optional. So far I've created this snippet, which does everything except the optional part.
snippet frame "frame environment" b
\begin{frame}[$1]{${2:frame title}}
${0:${VISUAL}}
\end{frame}
endsnippet
How can I make an optional placeholder that disappears when no text is given?

Here is a very simple snippet that I think will explain the optional placeholder:
snippet \dc "Document Class" b
\documentclass${1:[${2:options}]}{${3:class}}
$0
endsnippet
Here is how it works:
Type \dc and press <tab>.
The \documentclass[options]{class} text will appear with [options] highlighted.
At this time you can either press <backspace> and delete the whole [options] part (including the square brackets) and press <C-j> (forward trigger keymap) to continue to the {class} placeholder and so on...
Or you can press <C-j> and proceed to change the [options] placeholder inside the square brackets. Then press <C-j> again to jump to the {class} placeholder and so on.

Related

How to sort emails data using its color codes in emeditor

I have this little challenge.
I want to ask, how do i sort the emails using the color code (light green) as stated in this picture here
I have tried to remove the non emails by scrolling through, but i need a solution that can make it a one click through sorting.
I will appreciate your kind response.
Open the Replace dialog box and enter the following regex in the Find field:
^((.*#[^\.]*)|([^#]+))$\n
Change the radio button to Regular Expressions. This regex pattern finds any line without a dot after # or any line without a #. Note that you need the last line of the document to be empty as shown in line 7 of your document.
Since we are deleting those lines, the "Replace with" field is blank. Now click Replace All.

How to move from Title box to Content box without mouse?

I create a new slide (Ctrl+m).
The layout by default is Title + Content.
I edit the title slide and now want to move to the content textbox.
How can I do this without my mouse?
Nutshell answer:
Hit ESC, then TAB key.
Short answer:
After typing your text into the Title placeholder, hit ESC to exit editing.
Then hit the TAB key to move to the next object. (If that is not the Content placeholder, continue hitting TAB until the desired object is selected.)
Start typing to enter your text.
Extended answer:
Hit Ctrl+m to create a new slide that uses the same Layout as the current one.
Hit the TAB key to go to the first object on the slide. (This is the back-most object on your slide; the one on the bottom in the Selection Pane list. If the designer of the Layout did a good job, this is the Title placeholder. If not, keep hitting TAB until the desired object is selected.)
Start typing your text. (If you edit an existing slide and there is already text contained in the shape, simply starting to type will append text at the end. If you want to replace the existing text, hit the return/enter key before starting to type. That will select all contained text, so it will be overwritten when you start typing.)
When finished entering your text, hit the ESC button (to exit edit mode and have the actual shape selected), and hit the TAB key to go to the next object – i.e. the second-lowest one. (Again, if the designer did a good job, this will be your Content placeholder. If not, continue hitting TAB.)
Go to step 3 to continue with the next object.
After typing the title text, press CTRL + M to put the cursor in the content placeholder.

In Emacs, what's the opposite of invisible text?

You can't see invisible text in the buffer, but if you save the file, it'll be there. I want the oppsoite -- something to display, but if I save the file it won't be written to disk.
In particular I want to display an ellipsis (the "..." symbol) where I have hidden text.
In case it's relevant, here's the code where I'd like to do that. The "fold" function hides text, and the "unfold" function shows it again. The region folded or unfolded is every line just below the current one with more leading space than the current one.
If you set the invisible property to a custom symbol my-fold:
(put-text-property startRegion endRegion 'invisible
(if toHide 'my-fold nil))
You can say that my-fold invisibility should use an ellipsis:
;; Cause use of ellipses for invisible text.
(add-to-invisibility-spec '(my-fold . t))
Further reading:
C-hig (elisp)Invisible Text
C-hig (elisp)Replacing Specs

InDesign data merge—"remove blank lines" resulting in extra characters

I'm using data merge to import two variables per line, and have checked the "Remove blank lines for empty fields" box. The result is a wealth of extra characters that I can't remove using find-and-replace. Of the 24 lines of variables, typically only three contain text, so the other 21 should be empty lines and be deleted by the "Remove blank lines" option.
Attempting to paste these characters into the "find and replace" field, I see
^|^|^|^|^|^|^|^|^|^|^|^|^|^|
Any suggestions? Thanks
Try doing a regular text find/change.
In the Find What field, type < FEFF > (but delete the spaces before and after those angle brackets – the Stack Overflow editor seems to delete this if there are no spaces).
In the Change To, leave blank, and click change all.

How can I put multiple lines of text in an NSMenuItem?

I would like to create an NSMenuItem with more than one line of text in it, and I'd also like an icon to appear next to both lines of text. I can't use a custom view, because then it wouldn't highlight correctly, and I can't just put a newline in the menu item's title, because the newline gets turned into a space. What should I do?
It turns out that although you can't put a newline in the title property of a menu item, you can put a newline in the attributedTitle. Something like this will work:
item.attributedTitle = [[NSAttributedString alloc] initWithString:#"line 1\nline 2"];

Resources