[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: longlines-mode and comments
From: |
David Reitter |
Subject: |
Re: longlines-mode and comments |
Date: |
Mon, 17 Dec 2007 18:40:21 +0000 |
I posted this a while ago:
emacs-lisp-mode, or latex-mode (AUCTeX)
Turn on longlines-mode.
Paste a long line (paragraph in the long-lines sense) into the
buffer, which should be wrapped correctly and displayed as a
paragraph of text.
Select the entire paragraph and call `comment-region'.
Result: The comment mark (;; or % or whatever) is placed all over
the lines, and only the first line has it in the right place, i.e.
at the beginning.
would the following be solution?
It works for me.
*** newcomment.el 28 Nov 2007 12:14:50 +0000 1.101.2.2
--- newcomment.el 17 Dec 2007 18:22:18 +0000
***************
*** 1035,1040 ****
--- 1035,1041 ----
(comment-normalize-vars)
(if (> beg end) (let (mid) (setq mid beg beg end end mid)))
(save-excursion
+ (if longlines-mode (longlines-decode-region beg end))
;; FIXME: maybe we should call uncomment depending on ARG.
(funcall comment-region-function beg end arg)))
What remains is:
(Also, when `longlines-wrap-follows-window-size' is turned on,
then the line/paragraph is reformatted.)
The expected (correct) behavior would be to add the comment command
at the beginning of the line in the file, i.e. at the beginning of
the paragraph, that is, after each hard return.
Note that the other expected thing there is that the syntax
highlighting (font-lock) works, i.e. that the whole comment is
shown using the right face. This, IMHO, is a second bug.
It seems like `longlines-wrap-line' has a provision for the case, but
it doesn't work (I don't understand that code). What does work is to
not comment wrap lines at all until a better solution is found.
*** longlines.el 28 Nov 2007 12:14:50 +0000 1.33.2.5
--- longlines.el 17 Dec 2007 18:37:40 +0000
***************
*** 257,267 ****
If wrapping is performed, point remains on the line. If the line
does
not need to be wrapped, move point to the next line and return t."
(if (longlines-set-breakpoint)
! (progn (insert-before-markers ?\n)
! (backward-char 1)
! (delete-char -1)
! (forward-char 1)
! nil)
(if (longlines-merge-lines-p)
(progn (end-of-line)
;; After certain commands (e.g. kill-line), there may be two
--- 259,273 ----
If wrapping is performed, point remains on the line. If the line
does
not need to be wrapped, move point to the next line and return t."
(if (longlines-set-breakpoint)
! (progn
! (unless (nth 4 (syntax-ppss (point)))
! ;; We are not in a comment context.
! (insert-before-markers ?\n)
! (backward-char 1)
! (delete-char -1)
!
! (forward-char 1))
! nil)
(if (longlines-merge-lines-p)
(progn (end-of-line)
;; After certain commands (e.g. kill-line), there may be two
- Re: longlines-mode and comments,
David Reitter <=