Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!ll-xn!mit-eddie!husc6!hao!oddjob!gargoyle!ihnp4!cbosgd!mandrill!hal!ncoast!axcess!allbery From: allbery@axcess.UUCP (Brandon S. Allbery) Newsgroups: comp.emacs Subject: Re: Hiding comments in C mode Message-ID: <143@axcess.UUCP> Date: 28 Jan 88 14:00:43 GMT References: <8801202039.AA09434@ucbvax.Berkeley.EDU> Organization: aXcess Company, Mentor, Ohio Lines: 37 Summary: I see a generalization of selective-display here.... In article <8801202039.AA09434@ucbvax.Berkeley.EDU>, dsill@NSWC-OAS.ARPA (Dave Sill) writes: +--------------- | the future of computing. One person mentioned something about editors | being able to hide comments on command. How hard would it be to add | this feature to GNU's C mode? It sure would be handy, and a boon to | readability, to be able to compress comments into /**/. Kinda like | outline mode... +--------------- My "yacc" mode would benefit from being able to selective-display out stuff between matched { } as well. My thoughts on this -- no idea how implementable -- is to teach Emacs about a standard way of handling paired strings. A list "matched-string-list" could be used to define these: (("{" "}" t) ("(" ")" t) ("/*" "*/" nil) ("[" "]" t) ("\"" "\"" nil)) The list is made up of lists of (open-string, close-string, nest-flag). The nest-flag is "t" if the balanced strings can balance with themselves and with other balancing strings; "nil" means the strings don't balance with themselves and Emacs should balance other strings only within the current pair of strings (i.e. a parenthesis inside a comment or string should never try to balance a parenthesis outside the comment or string). This would replace the current implementation as part of the syntax table (the current way of handling e.g. C comments looks like a kluge to me!). Now for selective-display: it is currently defined for "t"/"nil" or a number, I would like it to take one of these matched-string-lists, and hide everything between the balanced strings. How doable is this? I assume it has to be C code. -- ___ ________________, Brandon S. Allbery cbosgd \ ' \/ __ __, __, aXcess Company mandrill| __ | /__> <__ <__ 6615 Center St. #A1-105 !ncoast! / ` | \__. .__> .__> Mentor, OH 44060-4101 necntc | axcess!allbery \___/\________________. Moderator, comp.sources.misc hoptoad/