bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#31656: 26.1; `fill-paragraph' malformats in emacs-lisp-mode


From: Noam Postavsky
Subject: bug#31656: 26.1; `fill-paragraph' malformats in emacs-lisp-mode
Date: Sat, 02 Jun 2018 09:34:21 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

martin rudalics <rudalics@gmx.at> writes:

>>> Are there no use cases where we would want M-q outside of syntactic
>>> strings?
>>
>> Okay, I can think of one possibility: if you've pasted a long single
>> line consisting of a quoted list of symbols, then M-q could be a
>> convenient way of breaking it up into multiple lines.  With M-q disabled
>> in Lisp code, you would need to copy the data to a temp non-lisp-mode
>> buffer in order to do that, so a bit more inconvenient.
>
> Don't we want to fill comments as well?

Yes, we lost a bit of context there; comment filling is taken care of at
the top of lisp-fill-paragraph, I wasn't proposing to disable that.

    (defun lisp-fill-paragraph (&optional justify)
      [...]
      (or (fill-comment-paragraph justify)
          ;; Since fill-comment-paragraph returned nil, that means we're not in
          ;; a comment: Point is on a program line; we are interested
          ;; particularly in docstring lines.
          ;; [...] This setting has the consequence of inhibiting
          ;; filling many program lines that are not docstrings, which is 
sensible,
          ;; because the user probably asked to fill program lines by accident, 
or
          ;; expecting indentation (perhaps we should try to do indenting in 
that
          ;; case).[...]
+      (when (nth 3 (syntax-ppss))       ; Only fill inside strings.
          (let ((paragraph-start
                 (concat paragraph-start
                         "\\|\\s-*\\([(;\"]\\|\\s-:\\|`(\\|#'(\\)"))
            (paragraph-separate
             (concat paragraph-separate "\\|\\s-*\".*[,\\.]$"))
                (fill-column (if (and (integerp 
emacs-lisp-docstring-fill-column)
                                      (derived-mode-p 'emacs-lisp-mode))
                                 emacs-lisp-docstring-fill-column
                               fill-column)))
-       (fill-paragraph justify))
+         (fill-paragraph justify)))
          ;; Never return nil.
          t))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]