From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.help,gmane.emacs.devel Subject: Re: Font lock for #if 0 ... #endif Date: Tue, 29 May 2007 14:29:31 +0200 Message-ID: <465C1CAB.8030304@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050807050707080805000603" X-Trace: sea.gmane.org 1180441931 10858 80.91.229.12 (29 May 2007 12:32:11 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 29 May 2007 12:32:11 +0000 (UTC) Cc: help-gnu-emacs@gnu.org, emacs-devel To: eliz@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 29 14:32:08 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Ht0rw-0000vr-4n for geh-help-gnu-emacs@m.gmane.org; Tue, 29 May 2007 14:32:08 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ht0rv-0003Yu-Kj for geh-help-gnu-emacs@m.gmane.org; Tue, 29 May 2007 08:32:07 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ht0rC-0002xl-Sg for help-gnu-emacs@gnu.org; Tue, 29 May 2007 08:31:23 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ht0rB-0002vq-L8 for help-gnu-emacs@gnu.org; Tue, 29 May 2007 08:31:22 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ht0rB-0002vL-Ai for help-gnu-emacs@gnu.org; Tue, 29 May 2007 08:31:21 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1Ht0rA-0004XZ-R8 for help-gnu-emacs@gnu.org; Tue, 29 May 2007 08:31:21 -0400 Original-Received: (qmail invoked by alias); 29 May 2007 12:31:19 -0000 Original-Received: from N924P006.adsl.highway.telekom.at (EHLO [62.47.59.102]) [62.47.59.102] by mail.gmx.net (mp019) with SMTP; 29 May 2007 14:31:19 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX1+8x/5NIp28v2F+368Xptq7lI0qVa23KVnl1GTnlP AFHBEFaEKJxn8l User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en X-Y-GMX-Trusted: 0 X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:44529 gmane.emacs.devel:71941 Archived-At: This is a multi-part message in MIME format. --------------050807050707080805000603 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit > Martin, how about extending hideif to allow this as an option? It > sounds like a good feature. Please have a look at the attached patch. --------------050807050707080805000603 Content-Type: text/plain; name="hideif.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="hideif.patch" *** progmodes/hideif.el Tue Jan 23 06:41:08 2007 --- progmodes/hideif.el Tue May 29 14:13:08 2007 *************** *** 242,250 **** (end-of-line 2))) (defun hide-ifdef-region-internal (start end) ! (remove-overlays start end 'invisible 'hide-ifdef) (let ((o (make-overlay start end))) ! (overlay-put o 'invisible 'hide-ifdef))) (defun hide-ifdef-region (start end) "START is the start of a #if or #else form. END is the ending part. --- 242,253 ---- (end-of-line 2))) (defun hide-ifdef-region-internal (start end) ! (remove-overlays start end 'hide-ifdef t) (let ((o (make-overlay start end))) ! (overlay-put o 'hide-ifdef t) ! (if hide-ifdef-shadow ! (overlay-put o 'face 'hide-ifdef-shadow) ! (overlay-put o 'invisible 'hide-ifdef)))) (defun hide-ifdef-region (start end) "START is the start of a #if or #else form. END is the ending part. *************** *** 256,262 **** (defun hif-show-ifdef-region (start end) "Everything between START and END is made visible." ! (remove-overlays start end 'invisible 'hide-ifdef)) ;;===%%SF%% evaluation (Start) === --- 259,265 ---- (defun hif-show-ifdef-region (start end) "Everything between START and END is made visible." ! (remove-overlays start end 'hide-ifdef t)) ;;===%%SF%% evaluation (Start) === *************** *** 726,736 **** (defun hif-hide-line (point) "Hide the line containing point. Does nothing if `hide-ifdef-lines' is nil." ! (if hide-ifdef-lines ! (save-excursion ! (goto-char point) ! (hide-ifdef-region-internal (line-beginning-position) ! (progn (hif-end-of-line) (point)))))) ;;; Hif-Possibly-Hide --- 729,739 ---- (defun hif-hide-line (point) "Hide the line containing point. Does nothing if `hide-ifdef-lines' is nil." ! (when hide-ifdef-lines ! (save-excursion ! (goto-char point) ! (hide-ifdef-region-internal ! (line-beginning-position) (progn (hif-end-of-line) (point)))))) ;;; Hif-Possibly-Hide *************** *** 815,836 **** ;;;###autoload (defcustom hide-ifdef-initially nil ! "*Non-nil means call `hide-ifdefs' when Hide-Ifdef mode is first activated." :type 'boolean :group 'hide-ifdef) ;;;###autoload (defcustom hide-ifdef-read-only nil ! "*Set to non-nil if you want buffer to be read-only while hiding text." :type 'boolean :group 'hide-ifdef) ;;;###autoload (defcustom hide-ifdef-lines nil ! "*Non-nil means hide the #ifX, #else, and #endif lines." :type 'boolean :group 'hide-ifdef) (defun hide-ifdef-toggle-read-only () "Toggle `hide-ifdef-read-only'." (interactive) --- 818,849 ---- ;;;###autoload (defcustom hide-ifdef-initially nil ! "Non-nil means call `hide-ifdefs' when Hide-Ifdef mode is first activated." :type 'boolean :group 'hide-ifdef) ;;;###autoload (defcustom hide-ifdef-read-only nil ! "Set to non-nil if you want buffer to be read-only while hiding text." :type 'boolean :group 'hide-ifdef) ;;;###autoload (defcustom hide-ifdef-lines nil ! "Non-nil means hide the #ifX, #else, and #endif lines." :type 'boolean :group 'hide-ifdef) + ;;;###autoload + (defcustom hide-ifdef-shadow nil + "Non-nil means shadow text instead of hiding it." + :type 'boolean + :group 'hide-ifdef) + + (defface hide-ifdef-shadow '((t (:inherit shadow))) + "Face for shadowing ifdef blocks." + :group 'hide-ifdef) + (defun hide-ifdef-toggle-read-only () "Toggle `hide-ifdef-read-only'." (interactive) --------------050807050707080805000603 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ help-gnu-emacs mailing list help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs --------------050807050707080805000603--