Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

editcmacro - Edit C macro in a separate buffer

Author: Anders Lindgren
Version: 0.0.1
URL: https://github.com/Lindydancer/editcmacro

This package lets you edit a C macro in a separate buffer, without end of line backslashes.

In C, macros are defined using the #define construct. Technically, a C macro expand to a single line of tokens. However, for readability, a macro definition can be split into multiple lines by using end of line backslashes. For example:

#define FOREVER      \
  for (;;)           \
  {                  \
  }

Unfortunately, the backslashes makes the code hard to edit. This package lets you edit a macro, without the end of line backslashes, in a separate buffer. When done, the macro is written back to the original buffer, with backslashes.

If you are familiar with source block editing in Org mode, you will feel right at home with this package.

Keys

Press C-c ' to edit a C macro in a separate buffer, without the backslashes. When done editing, you can press C-c ' again to write the macro back into the original buffer, with backslashes.

You can discard your changes and kill the temporary buffer by pressing C-c C-k.

Installation

Enable the minor mode editcmacro-mode in C-like buffers. Typically, you can add the following to an appropriate init file:

    (add-hook 'c-mode-hook   #'editcmacro-mode)
    (add-hook 'c++-mode-hook #'editcmacro-mode)

Converted from editcmacro.el by el2markdown.

About

Edit multiline C macro in separate buffer

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages