QBobWatson / poporg

Emacs programming tool for editing strings or comments in Org mode or any other text mode
GNU General Public License v3.0
91 stars 9 forks source link

Non uniform comment delimiters #10

Closed csantosb closed 3 years ago

csantosb commented 4 years ago

Hello,

I'm trying to handle this kind of comments

-- * Outshine heading

--! follows doxygen comments
--! @file
--! @brief Example peripheral implementing a simple up counter
--!
--! This example peripheral gives an example of use of a simple counter
--! It initializes four

-- general comment
-- comes here

As you can see, I include standard language comment delimiters (--) along with more specific ones (--!). I wonder if it is possible to include both in the poporg buffer, removing the two delimiters at the same time.

Thanks !

QBobWatson commented 4 years ago

I'm not sure how to implement the suggestion, since when you add new text, it wouldn't be clear what the prefix is supposed to be.

One thing you can do is highlight the --! lines and run popup-dwim; then it'll detect --! as the prefix for that session.

csantosb commented 4 years ago

You mean poporg-dwin, right ? I only see an empty buffer, I'm afraid.

I was thinking in playing with poporg-comment-skip-regexp in such a way that it considers lines starting with both, -- and --!, as comments. This would allow me to insert doxygen doc along with my code using your great package. Unfortunately, I'm unable to do so by now, as I understand poporg expects a uniform comment delimiter. Any ideas ?

QBobWatson commented 4 years ago

Yes, I meant poporg-dwim -- thanks. If the region is active, then poporg just uses the common prefix of all lines in the region. It works ok for me.

Tweaking poporg-comment-skip-regexp to ignore --! won't do what you want -- poporg still takes the largest common prefix as the thing to skip. It has to do this, because if you add new lines in the poporg buffer, then it has to know what to prefix them with when it inserts it back into the main buffer.