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: Wed, 15 Nov 2006 09:32:51 +0800

Ok, now we get two patches:

       * longlines.el (longlines-mode): Set
       `parse-sexp-lookup-properties' so that syntax parsing uses text
       properties.
       (longlines-wrap-line): Put the `syntax-table' text property to the
       soft newline if in a comment context.

*** longlines.el.~1.2.2.16.~    Mon Nov 13 10:58:17 2006
--- longlines.el        Wed Nov 15 09:27:18 2006
***************
*** 112,117 ****
--- 112,118 ----
         (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)
***************
*** 156,161 ****
--- 157,163 ----
           (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 ()
*** 243,248 ****
--- 245,257 ----
       (progn (insert-before-markers ?\n)
            (backward-char 1)
              (delete-char -1)
+            (let* ((point (point))
+                   (state (syntax-ppss point)))
+              (if (nth 4 state)
+                  ;; We are in a comment context.
+                  (add-text-properties point
+                                       (1+ point)
+                                       '(syntax-table (14)))))
            (forward-char 1)
              nil)
     (if (longlines-merge-lines-p)

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]