0

I am documenting Code a lot. For exporting purposes I often have to add a '~' infront and after an Expression. For Example "Adc_Cfg.c" needs to get "~Adc_Cfg.c~". That way the Export to PDF via latex is not making some indexes out of it. Now I have to do it manually. Often its about 100 to 200 Expressions Thats consuming a lot of Time. What I want ist something like this

'!' is the point:

Set Mark => '!'Adc_Cfg.c  => Move forward => Adc_Cfg.c'!' => Press some shortcut and get => ~Adc_Cfg.c~ 

Is there already a functionality for that, if not can someone help me with an elisp function?

In Addition: Is there anything like that for bold, italic...

Thank you

1

If I understand well, you want to surround an expression with a given character (~).

Maybe emacs-surround will satisfy your needs.

If you use evil, there is also evil-surround that I use and confirm you I can select a word and surround it with ~ by pressing S-s ~

| improve this answer | |
  • Thank you that was exactly what I was searching for – 7ie7an Jul 18 '19 at 9:00
0

An alternative is smartparens (https://smartparens.readthedocs.io/en/latest/).

| improve this answer | |
0

Org Mode has a function for this, as you might expect. Mark a region and run org-emphasize (bound by default to C-c C-x C-f in Org buffers), it will prompt you for an emphasis marker (one of */=~+) and will then wrap the region with that character. If the region is already wrapped in a different one of those characters, the function replaces it with the one you type. If you use the function without marking a region, it inserts two copies of the character and places the cursor between them.

I find it very useful and bind to something shorter (I use C-').

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.