How to call a macro from within another macro in Notepad++? - macros

Does anybody know how to call a macro from within another macro in Notepad++?

Use the following process:
Record the first macro
Save it
Create a shortcut key to the first macro
Record the second macro
Press the shortcut key for the first macro
Save the second macro
References
Notepad++ Docs: Macros (http://docs.notepad-plus-plus.org/index.php/Macros)

Related

is it possible to bind a keyboard shortcut a template (or snippet) in Eclipse?

is there a way to bind a shortcut key (except ctrl + space) to a template?
Example:
ctrl + k => System.out.println()
With out-of-the-box Eclipse, I'm not aware of any way to do this.
However, if you install the "Emacs+" Eclipse plugin from the marketplace, you will have access to the following functions:
kbd-macro-bind-to-key: Offer to bind last macro to a key when not defining or executing a macro
kbd-macro-call: Call the most recent Kbd Macro
kbd-macro-cycle-ring-next: Rotate the keyboard macro ring to the next macro (defined earlier)
kbd-macro-cycle-ring-previous: Rotate the keyboard macro ring to the previous macro (defined later)
kbd-macro-end: End the definition of a Kbd Macro
kbd-macro-end-or-call: End the definition of a Kbd Macro, or execute the most recent Kbd Macro
kbd-macro-start: Start the definition of a Kbd Macro
load-kbd-macro: Load a saved Kbd Macro into this session
name-last-kbd-macro: Give a command name (for the duration of the Eclipse session) to the most recently defined keyboard macro
save-kbd-macro: Save a Kbd Macro to a file
view-kbd-macro: View Kbd Macro
However, although I've used Emacs+ for many years, I've never really used the macro feature. I know it exists, and I just briefly experimented with it to verify it works.

Notepad++ Macro to open specific file

How can I create a macro in Notepad++ to open a specific file (for example C:\Users\ega\all.txt) ?
Instead of a Macro I used 'Run' and browsed the file and added a shortcut.
the question has sense: perhaps one would need firstly to open a specific file, then to operate with it and save operations in a single macro

emacs quail input method - how to complete a key sequence

I'm using a specialized input method (from M-x set-input-method), and quail is showing me the completion of a key sequence on the minibuffer. There happens to be only one single way to complete the sequence. Is there a way to tell emacs/quail to auto-complete at this point?

Is there a standard action that inserts text, that can be used in a key binding?

I am fairly new to eclipse as far as it regards programming. After reading docs and faqs the whole day, I learned that key sequences can be bound to commands, which in turn can invoke actions (or was it the other way around?). Anyway, I miss a list of "standard actions", surely, inserting a character in response to a key stroke must be standard? But I din't find it.
In an editor I want to bind key sequences to actions like "insert character x", where x is one of a set of characters not on every keyboard (like §°€µöß´, greek letters, etc.).
How do I do this in eclipse?
Do I really have to write a separate command (and or action?) for every character I need? Moreover, if possible I want it to have configurable, of course. But, first things first.
In conventional editors like UltraEdit or jEdit, I would record a macro and bind a key sequence that invokes that. It's done in 1 minute. In jEdit, such a macro results in one line of bsh code that looks like:
insertText("§");
You can try the Eclipse plugin Practically Macro. It allows you to record macros but also to define it by hand.
To create a short key that inserts "§" in your editor you must do the following steps:
Go into "Preferences/Practically Macro Options/Editor Macro Definitions" and create a new macro. Add the command "Insert String" and type § in the text field. Then give the macro a name and an id, e.g., "testmacro".
Go to "Preferences/General/Keys" and search for your newly created "testmacro". You can now bind an arbitrary key combination to it.

How can I modify emacs' Search and Replace to perform a more complicated task?

total Emacs noob here. So right now I'm working on a fairly big LaTeX project in Emacs in which there are couple of places where I need to index some words, using the makeidx package. Because I also wanted indexed words to be bold, I created my own command \ind{} which would make the argument go bold and indexed. But right now I'm dissatisifed with this command so I'd like to change every instance of \ind{whatever} in my text by \textbf{whatever}\index{whatever by default}.
The thing is I know exactly what I want :
Go through the text, look for any instance of \ind{ and replace by \textbf{ using search-and-replace
Save the argument of \ind ("whatever" in this case) in memory
Ask me the user what should the argument of \index be. By default (by striking enter), it should be the first argument, but I can also change my mind and enter something different ("whatever by default" in this case). If there's no input (only a space " " for example) stop the program.
Write down \index{, the new argument and }.
Go to next occurance in the text.
But, alas!, I know not how to achieve this, so I need someone's help. If it should take too much time to explain how to do such a thing, would you please send me some tutorial about writing my own functions?
I hope I'm being clear, and thanks for your patience!
This approach seems vaguely unorthodox to me, but it works and seems sufficient for a one-off job...
In the replacement text for replace-regexp and query-replace-regexp (C-M-%), one newer escape sequence is \,(...), where ... can be any Lisp expression. There's a Lisp function read-from-minibuffer which reads arbitrary text typed by the user, with an optional default. Therefore:
C-M-%: Start query-replace-regexp.
\\ind{\([^}]+?\)}: The pattern to search for.
\\textbf{\1}\\index{\,(read-from-minibuffer "index content? " \1)}: The replacement text. The user will be prompted for the text to put in the braces following the \index{} element, using the original text between the braces following the \ind{} element as a default.
Note that when using query-replace-regexp, you'll have to confirm each choice by typing y after each. Use M-x replace-regexp if you want to avoid this step.
Vlad give you the LaTeX answer to your problem. An Emacs solution is the key-macro: start with
C-x (
to define a new macro, then do one step of your change, say:
C-s \ind{
<left>ex
Then copy and paste the argument in the \textbf macro... You have to be careful to move in a way that will be repeatable. Once the standard modification is done, you let the cursor after the whatever by default and end the definition by
C-x )
now C-x e will call the macro you just define, letting your cursor at the correct place to change the part you want to change You can also repeat the e to call the macro several time at once.
Why not just redefine the \ind so that it can get an optional argument?
For example:
\newcommand{\ind}[2][]{%
\def\first{#1}%
\ifx\first\empty
\textbf{#2}\index{#2}%
\else
\textbf{#2}\index{#1}%
\fi
}
This way you can use \ind{whatever} or \ind[whatever-else]{whatever}.