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

python string literals (not docstrings) #11

Closed indigoviolet closed 3 years ago

indigoviolet commented 4 years ago

Thank you for this great library!

(In a python-mode buffer with poporg-mode enabled) I find that poporg works as expected for docstrings, but not for string literals. This would be useful for the case of SQL statements in Python string literals. Do you have any suggestions on how I can make this work? If not please consider this a feature request.

QBobWatson commented 4 years ago

Poporg will edit a string if it is preceded only by whitespace on its line. Try this:

query = \
    'DELETE * FROM my_table'
indigoviolet commented 4 years ago

Thanks for the quick response! That does work. Is that a hard requirement or can I customize it somehow?

QBobWatson commented 4 years ago

The code uses the whitespace before the string/comment to determine the common prefix when re-inserting into the buffer -- otherwise it doesn't know how much you want the string indented when you add new lines. This could be a configurable; pull requests are welcome!