emacs-devel
[Top][All Lists]
Advanced

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

RE: Patch: Syntax and Hard Newlines


From: Herbert Euler
Subject: RE: Patch: Syntax and Hard Newlines
Date: Thu, 16 Nov 2006 14:23:45 +0800

Summing up:

       * longlines.el (longlines-mode): Set
       `parse-sexp-lookup-properties' so that syntax parsing uses text
       properties.
       (longlines-soft-newline): New constant.
       (longlines-wrap-line): Use `longlines-soft-newline' to make syntax
       parsing regard soft newlines the same as spaces.

*** longlines.el.~1.2.2.16.~    Mon Nov 13 10:58:17 2006
--- longlines.el        Thu Nov 16 13:49:15 2006
***************
*** 80,85 ****
--- 80,91 ----
 (defvar longlines-wrap-point nil)
 (defvar longlines-showing nil)

+ (defconst longlines-soft-newline
+   (propertize "\n"
+             'syntax-table
+             '(0))
+   "The soft newline character for wrapping long lines.")
+
 (make-variable-buffer-local 'longlines-wrap-beg)
 (make-variable-buffer-local 'longlines-wrap-end)
 (make-variable-buffer-local 'longlines-wrap-point)
*************** (define-minor-mode longlines-mode
*** 112,117 ****
--- 118,124 ----
         (make-local-variable 'buffer-substring-filters)
       (set (make-local-variable 'isearch-search-fun-function)
            'longlines-search-function)
+       (set (make-local-variable 'parse-sexp-lookup-properties) t)
         (add-to-list 'buffer-substring-filters 'longlines-encode-string)
         (when longlines-wrap-follows-window-size
           (set (make-local-variable 'fill-column)
*************** (define-minor-mode longlines-mode
*** 156,161 ****
--- 163,169 ----
           (add-hook 'post-command-hook
                     'longlines-post-command-function nil t)))
     ;; Turn off longlines mode
+     (kill-local-variable 'parse-sexp-lookup-properties)
     (setq buffer-file-format (delete 'longlines buffer-file-format))
     (if longlines-showing
         (longlines-unshow-hard-newlines))
*************** (defun longlines-wrap-line ()
*** 240,246 ****
 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)
--- 248,254 ----
 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 longlines-soft-newline)
            (backward-char 1)
              (delete-char -1)
            (forward-char 1)

I chose Miles' approach, because it

   [1] is limited in `longlines.el',

   [2] takes the same effect both in interpretation and compilation.

Regards,
Guanpeng Xu

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/





reply via email to

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