From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: fortran pre-process Date: Mon, 17 May 2004 10:01:23 -0600 Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <40A8E1D3.8040103@yahoo.com> References: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1084814633 17415 80.91.224.253 (17 May 2004 17:23:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 17 May 2004 17:23:53 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon May 17 19:23:47 2004 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BPlq6-0004iw-00 for ; Mon, 17 May 2004 19:23:46 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.34) id 1BPkmK-0005JF-8f for geh-help-gnu-emacs@m.gmane.org; Mon, 17 May 2004 12:15:48 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!newsmi-us.news.garr.it!newsmi-eu.news.garr.it!NewsITBone-GARR!fu-berlin.de!uni-berlin.de!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 93 Original-X-Trace: news.uni-berlin.de yvpybKNoVyeUib8eteksMg4jY1YVCLFqeZZTj8MFbs3HGtR54= User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 X-Accept-Language: en-us Original-Xref: shelby.stanford.edu gnu.emacs.help:123231 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:18523 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:18523 Randy Haddox wrote: > Hello, I am working with emacs lisp programming some and would like > help to do the following: > > Hide a code block based on a define variable when using preprocessor > directives (#define, #ifdef, #endif). From lisp/progmodes/hideif.el: ;; To initialize, toggle the hide-ifdef minor mode with ;; ;; M-x hide-ifdef-mode ;; ;; This will set up key bindings and call hide-ifdef-mode-hook if it ;; has a value. To explicitly hide ifdefs using a buffer-local ;; define list (default empty), type ;; ;; M-x hide-ifdefs or C-c @ h ;; ;; Hide-ifdef suppresses the display of code that the preprocessor wouldn't ;; pass through. The support of constant expressions in #if lines is ;; limited to identifiers, parens, and the operators: &&, ||, !, and ;; "defined". Please extend this. ;; ;; The hidden code is marked by ellipses (...). Be ;; cautious when editing near ellipses, since the hidden text is ;; still in the buffer, and you can move the point into it and modify ;; text unawares. If you don't want to see the ellipses, set ;; selective-display-ellipses to nil. But this can be dangerous. ;; You can make your buffer read-only while hide-ifdef-hiding by setting ;; hide-ifdef-read-only to a non-nil value. You can toggle this ;; variable with hide-ifdef-toggle-read-only (C-c @ C-q). ;; ;; You can undo the effect of hide-ifdefs by typing ;; ;; M-x show-ifdefs or C-c @ s ;; ;; Use M-x hide-ifdef-define (C-c @ d) to define a symbol. ;; Use M-x hide-ifdef-undef (C-c @ u) to undefine a symbol. ;; ;; If you define or undefine a symbol while hide-ifdef-mode is in effect, ;; the display will be updated. Only the define list for the current ;; buffer will be affected. You can save changes to the local define ;; list with hide-ifdef-set-define-alist. This adds entries ;; to hide-ifdef-define-alist. ;; ;; If you have defined a hide-ifdef-mode-hook, you can set ;; up a list of symbols that may be used by hide-ifdefs as in the ;; following example: ;; ;; (setq hide-ifdef-mode-hook ;; (lambda () ;; (if (not hide-ifdef-define-alist) ;; (setq hide-ifdef-define-alist ;; '((list1 ONE TWO) ;; (list2 TWO THREE) ;; ))) ;; (hide-ifdef-use-define-alist 'list2) ; use list2 by default ;; )) ;; ;; You can call hide-ifdef-use-define-alist (C-c @ U) at any time to specify ;; another list to use. ;; ;; To cause ifdefs to be hidden as soon as hide-ifdef-mode is called, ;; set hide-ifdef-initially to non-nil. ;; ;; If you set hide-ifdef-lines to t, hide-ifdefs hides all the #ifdef lines. ;; In the absence of highlighting, that might be a bad idea. If you set ;; hide-ifdef-lines to nil (the default), the surrounding preprocessor ;; lines will be displayed. That can be confusing in its own ;; right. Other variations on display are possible, but not much ;; better. ;; ;; You can explicitly hide or show individual ifdef blocks irrespective ;; of the define list by using hide-ifdef-block and show-ifdef-block. ;; ;; You can move the point between ifdefs with forward-ifdef, backward-ifdef, ;; up-ifdef, down-ifdef, next-ifdef, and previous-ifdef. ;; ;; If you have minor-mode-alist in your mode line (the default) two labels ;; may appear. "Ifdef" will appear when hide-ifdef-mode is active. "Hiding" ;; will appear when text may be hidden ("hide-ifdef-hiding" is non-nil). -- Kevin Rodgers