* longlines-mode and comments
@ 2007-11-28 16:02 David Reitter
2007-11-29 10:34 ` martin rudalics
0 siblings, 1 reply; 6+ messages in thread
From: David Reitter @ 2007-11-28 16:02 UTC (permalink / raw)
To: bug-gnu-emacs
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.
(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.
In GNU Emacs 22.1.50.1 (i386-apple-darwin8.11.1, Carbon Version 1.6.0)
of 2007-11-27 on plume.sr.unh.edu - Aquamacs Distribution 1.2
Windowing system distributor `Apple Inc.', version 10.5.1
configured using `configure '--without-x' '--prefix=/usr/local''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: nil
locale-coding-system: iso-8859-1
default-enable-multibyte-characters: t
Major mode: PDFLaTeX/F
Minor modes in effect:
reftex-mode: t
TeX-fold-mode: t
outline-minor-mode: t
TeX-PDF-mode: t
smart-frame-positioning-mode: t
aquamacs-styles-mode: t
shell-dirtrack-mode: t
recentf-mode: t
encoded-kbd-mode: t
osx-key-mode: t
longlines-mode: t
show-paren-mode: t
delete-selection-mode: t
pc-selection-mode: t
cua-mode: t
tooltip-mode: t
mac-input-method-mode: t
tool-bar-mode: 0
mouse-wheel-mode: t
use-hard-newlines: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
unify-8859-on-encoding-mode: t
utf-translate-cjk-mode: t
auto-compression-mode: t
column-number-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
<left> <left> <up> <right> <backspace> <up> <delete>
<backspace> SPC <down> <backspace> <delete> <down>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <right> <right> <right> <right> <right> <right>
<right> <delete> <delete> <down> <left> <left> <left>
<left> <left> <left> <left> <left> <left> <left> <left>
<left> <left> <left> <left> <left> <left> <left> <left>
<left> <left> <left> <left> <left> <left> <left> <left>
<left> <left> <left> <left> <left> <left> <left> <left>
<backspace> <backspace> <backspace> SPC M-q <up> <up>
<up> <up> <right> <down> % SPC <down> <up> <left> <left>
<return> <down> <left> <return> <left> <left> <return>
<down> <backspace> SPC <down> <left> <left> <left>
<left> <right> % SPC <left> <left> <return> <down>
<down-mouse-1> <mouse-1> A-s <down-mouse-1> <mouse-1>
<delete> <delete> A-s <menu-bar> <buffer> "model-chapter.tex"
<mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1>
<mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1>
<mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1>
<mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1>
<mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1>
<mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1>
<mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1>
<mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1>
<mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1>
<mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1>
<mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1>
<mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1>
<mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1>
<mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1>
<mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1>
<mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1> <mouse-1>
<mouse-1> <mouse-1> <mouse-1> <mouse-1> <down-mouse-1>
<mouse-movement> <mouse-movement> <mouse-movement>
<mouse-movement> <drag-mouse-1> A-' A-z <delete> <delete>
<down-mouse-1> <mouse-1> <delete> <delete> <up> <right>
<down> A-s C-h k A-' <help-echo> <switch-frame> C-h
f c o m m e n t - r e g <tab> <return> <switch-frame>
<down-mouse-1> <mouse-movement> <mouse-movement> <mouse-movement>
<mouse-movement> <drag-mouse-1> <escape> x c o m m
<tab> e n t - r e g i o n <return> <help-echo> <S-down-mouse-1>
<S-mouse-1> A-c <menu-bar> <help-menu> <report-ema
cs-bug>
Recent messages:
Quit
Mark set
Mark saved where search started
Wrote /Users/dr/PhD/thesis/introduction-chapter.tex [2 times]
Undo...
Undo!
Saving file /Users/dr/PhD/thesis/model-chapter.tex...
Wrote /Users/dr/PhD/thesis/model-chapter.tex
Type "q" to quit, C-v to scroll help. [2 times]
Making completion list...
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: longlines-mode and comments
2007-11-28 16:02 longlines-mode and comments David Reitter
@ 2007-11-29 10:34 ` martin rudalics
2007-11-30 7:22 ` David Reitter
2007-12-17 18:40 ` David Reitter
0 siblings, 2 replies; 6+ messages in thread
From: martin rudalics @ 2007-11-29 10:34 UTC (permalink / raw)
To: David Reitter; +Cc: bug-gnu-emacs
> 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.
>
> (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's hardly trivial. Have a look at the thread starting with:
http://lists.gnu.org/archive/html/emacs-devel/2006-11/msg00634.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: longlines-mode and comments
2007-11-29 10:34 ` martin rudalics
@ 2007-11-30 7:22 ` David Reitter
2007-11-30 16:48 ` Richard Stallman
2007-12-17 18:40 ` David Reitter
1 sibling, 1 reply; 6+ messages in thread
From: David Reitter @ 2007-11-30 7:22 UTC (permalink / raw)
To: martin rudalics; +Cc: bug-gnu-emacs, Kim F. Storm
On 29 Nov 2007, at 10:34, martin rudalics wrote:
>> (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's hardly trivial. Have a look at the thread starting with:
>
> http://lists.gnu.org/archive/html/emacs-devel/2006-11/msg00634.html
Sure, one can fix longlines to deal with further eventualities. But
each of them is going to be a further hack, because code everywhere
assumes that a line in the buffer is a line in the file, and
everything else would be a lot more complicated.
Longlines mode has a number of shortcomings that can't be addressed
within the current architecture: for instance it looks rather bad with
variable-width fonts and with different font sizes in the buffer, for
instance when editing long LaTeX documents using AUCTeX.
The alternative is display-time word wrap (DTWW), and Kim Storm has
developed a patch that was supposed to be applied after the 22.1
release:
http://www.mail-archive.com/emacs-pretest-bug@gnu.org/msg03729.html
There was a good discussion in 2005 with the same conclusion:
http://www.nabble.com/flyspell-+-longlines:-hang-wait-t448677.html
I wish this could be updated and applied. Every modern text editor has
this. It is really needed when you want to write text and not code on
non-TTY displays.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: longlines-mode and comments
2007-11-30 7:22 ` David Reitter
@ 2007-11-30 16:48 ` Richard Stallman
0 siblings, 0 replies; 6+ messages in thread
From: Richard Stallman @ 2007-11-30 16:48 UTC (permalink / raw)
To: David Reitter; +Cc: bug-gnu-emacs, storm
The alternative is display-time word wrap (DTWW), and Kim Storm has
developed a patch that was supposed to be applied after the 22.1
release:
http://www.mail-archive.com/emacs-pretest-bug@gnu.org/msg03729.html
Would people please study that patch and report?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: longlines-mode and comments
2007-11-29 10:34 ` martin rudalics
2007-11-30 7:22 ` David Reitter
@ 2007-12-17 18:40 ` David Reitter
2007-12-17 22:11 ` martin rudalics
1 sibling, 1 reply; 6+ messages in thread
From: David Reitter @ 2007-12-17 18:40 UTC (permalink / raw)
To: martin rudalics; +Cc: bug-gnu-emacs
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: longlines-mode and comments
2007-12-17 18:40 ` David Reitter
@ 2007-12-17 22:11 ` martin rudalics
0 siblings, 0 replies; 6+ messages in thread
From: martin rudalics @ 2007-12-17 22:11 UTC (permalink / raw)
To: David Reitter; +Cc: bug-gnu-emacs
> 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.
For some reason my Emacs hangs with your patch.
> ! (unless (nth 4 (syntax-ppss (point)))
I think this should be tested iff a comment syntax has been defined by
the current major mode. Moreover, the line should be wrapped when the
actual comment is not terminated by a newline.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-12-17 22:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-28 16:02 longlines-mode and comments David Reitter
2007-11-29 10:34 ` martin rudalics
2007-11-30 7:22 ` David Reitter
2007-11-30 16:48 ` Richard Stallman
2007-12-17 18:40 ` David Reitter
2007-12-17 22:11 ` martin rudalics
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.