unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: David Reitter <david.reitter@gmail.com>
To: martin rudalics <rudalics@gmx.at>
Cc: bug-gnu-emacs@gnu.org
Subject: Re: longlines-mode and comments
Date: Mon, 17 Dec 2007 18:40:21 +0000	[thread overview]
Message-ID: <35DB6480-F9E8-47C3-843F-0FA6BB4B5A94@gmail.com> (raw)
In-Reply-To: <474E95A7.4090807@gmx.at>

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







  parent reply	other threads:[~2007-12-17 18:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2007-12-17 22:11     ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=35DB6480-F9E8-47C3-843F-0FA6BB4B5A94@gmail.com \
    --to=david.reitter@gmail.com \
    --cc=bug-gnu-emacs@gnu.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).