From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Herbert Euler" Newsgroups: gmane.emacs.devel Subject: Re: Patch: Syntax and Hard Newlines Date: Thu, 16 Nov 2006 23:12:03 +0800 Message-ID: References: <455C6026.3030204@gmx.at> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed X-Trace: sea.gmane.org 1163690100 24558 80.91.229.2 (16 Nov 2006 15:15:00 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 16 Nov 2006 15:15:00 +0000 (UTC) Cc: emacs-devel@gnu.org, rms@gnu.org, monnier@iro.umontreal.ca Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Nov 16 16:14:56 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GkiwH-0008R8-Pn for ged-emacs-devel@m.gmane.org; Thu, 16 Nov 2006 16:14:06 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GkiwG-00012D-I3 for ged-emacs-devel@m.gmane.org; Thu, 16 Nov 2006 10:14:04 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GkiuY-0007os-9U for emacs-devel@gnu.org; Thu, 16 Nov 2006 10:12:18 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GkiuP-0007et-GZ for emacs-devel@gnu.org; Thu, 16 Nov 2006 10:12:14 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GkiuP-0007eB-3K for emacs-devel@gnu.org; Thu, 16 Nov 2006 10:12:09 -0500 Original-Received: from [65.54.246.83] (helo=bay0-omc1-s11.bay0.hotmail.com) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GkiuL-0006mo-MF; Thu, 16 Nov 2006 10:12:06 -0500 Original-Received: from hotmail.com ([64.4.26.32]) by bay0-omc1-s11.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.1830); Thu, 16 Nov 2006 07:12:04 -0800 Original-Received: from mail pickup service by hotmail.com with Microsoft SMTPSVC; Thu, 16 Nov 2006 07:12:04 -0800 Original-Received: from 64.4.26.200 by by112fd.bay112.hotmail.msn.com with HTTP; Thu, 16 Nov 2006 15:12:03 GMT X-Originating-IP: [221.220.245.208] X-Originating-Email: [herberteuler@hotmail.com] X-Sender: herberteuler@hotmail.com In-Reply-To: <455C6026.3030204@gmx.at> Original-To: rudalics@gmx.at X-OriginalArrivalTime: 16 Nov 2006 15:12:04.0302 (UTC) FILETIME=[92E94EE0:01C70991] X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:62382 Archived-At: >The major modes I've been talking about (including ada, cperl, python) >use `make-local-variable' to make `parse-sexp-lookup-properties' local >to the buffer they're operating on. When you do `kill-local-variable' >you kill their local binding too and they will see the global binding >which is usually not what they want. What about this? * longlines.el (longlines-mode): Set `parse-sexp-lookup-properties' so that syntax parsing uses text properties. (longlines-parse-sexp-lookup-properties) (longlines-pslp-was-local): New variables. (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.orignal 2006-11-16 23:00:49.000000000 +0000 --- longlines.el 2006-11-16 23:00:55.000000000 +0000 *************** *** 79,89 **** --- 79,100 ---- (defvar longlines-wrap-end nil) (defvar longlines-wrap-point nil) (defvar longlines-showing nil) + (defvar longlines-parse-sexp-lookup-properties nil) + ;; PSLP: Parse-Sexp-Lookup-Properties. + (defvar longlines-pslp-was-local nil) (make-variable-buffer-local 'longlines-wrap-beg) (make-variable-buffer-local 'longlines-wrap-end) (make-variable-buffer-local 'longlines-wrap-point) (make-variable-buffer-local 'longlines-showing) + (make-variable-buffer-local 'longlines-parse-sexp-lookup-properties) + (make-variable-buffer-local 'longlines-pslp-was-local) + + (defconst longlines-soft-newline + (propertize "\n" + 'syntax-table + '(0)) + "The soft newline character for wrapping long lines.") ;; Mode *************** *** 112,117 **** --- 123,137 ---- (make-local-variable 'buffer-substring-filters) (set (make-local-variable 'isearch-search-fun-function) 'longlines-search-function) + (if (local-variable-p 'parse-sexp-lookup-properties) + (setq longlines-parse-sexp-lookup-properties + parse-sexp-lookup-properties + longlines-pslp-was-local + t + parse-sexp-lookup-properties + t) + (setq longlines-pslp-was-local nil) + (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 **** --- 176,185 ---- (add-hook 'post-command-hook 'longlines-post-command-function nil t))) ;; Turn off longlines mode + (if longlines-pslp-was-local + (setq parse-sexp-lookup-properties + longlines-parse-sexp-lookup-properties) + (kill-local-variable 'parse-sexp-lookup-properties)) (setq buffer-file-format (delete 'longlines buffer-file-format)) (if longlines-showing (longlines-unshow-hard-newlines)) *************** *** 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) --- 264,270 ---- 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) Regards, Guanpeng Xu _________________________________________________________________ Don't just search. Find. Check out the new MSN Search! http://search.msn.click-url.com/go/onm00200636ave/direct/01/