flee@gondor.psu.edu (Felix Lee) (11/15/87)
In article <1443@ttidca.TTI.COM> lear@ttidca.UUCP (Russell Lear) writes: > I'm not sure just what the ALL command in XEDIT does, but GNU emacs > (version 18.47.10) does include the commands delete-matching-lines and > delete-non-matching-lines that ... well, that delete matching and > non-matching lines according to a regular expression. GNU Emacs's "narrow-to-region" is closer in spirit. The idea is to restrict editing to a subset of the file. ALL restricts your editing to a set of lines that match Xedit's idea of a regular expression. If you say "ALL /column/ | /row/", all lines that don't have "column" or "row" will be hidden. Hidden lines are represented by a single "shadow line" that says how many lines are hidden. There's another simple command that lets you expose the first or last n lines in a shadow line. You can also turn off shadow lines. I just realized that I often use "egrep 'column' *.h *.c" and repeat-search when what I'd really like is an editor with ALL. ALL gives you the information density of egrep and surrounding context on demand. ALL lets you hide irrelevant parts of the file and focus on the problem at hand. ALL is actually a trivial use of a more general Xedit feature that could support outline processing. Someone should write a set of easy-to-use macros to let you do outline processing in Xedit. I also had another trivial macro that would hide any lines you haven't changed during that editing session--useful for remembering what you were doing after wandering off for half an hour. -- Felix Lee flee@gondor.psu.edu {cbosgd,cmcl2}!psuvax1!gondor!flee
flee@gondor.psu.edu (Felix Lee) (11/19/87)
In article <3089@psuvax1.psu.edu> I wrote: > GNU Emacs's "narrow-to-region" is closer in spirit [to Xedit's ALL]. I've just found out that GNU Emacs (18.47.3) has features very similar to ALL in Xedit. (I don't play with GNU Emacs much; I mostly use Jove). First there's M-x occur. This pops up another buffer showing all the occurrences of a given regexp. And once you have that buffer, you can type C-c C-c to go to a specific occurrence of that regexp. Then there's selective-display. (setq selective-display t) tells Emacs that anything after a ^M on a line should not be displayed. Emacs's outline-mode uses selective-display. It wouldn't be too hard to write an ALL work-alike. -- Felix Lee flee@gondor.psu.edu *!psuvax1!gondor!flee
nate@cpocd2.UUCP (Nathan Hess) (11/25/87)
In article <3115@psuvax1.psu.edu> flee@gondor.psu.edu (Felix Lee) writes: >Then there's selective-display. (setq selective-display t) tells Emacs that >anything after a ^M on a line should not be displayed. Emacs's outline-mode >uses selective-display. It wouldn't be too hard to write an ALL work-alike. Well, it wouldn't be difficult to write an ALL look-alike, but a work-alike *would* be difficult, if you want to include capability to perform 'replace-string' or 'replace-regexp' with ALL in effect. Take, for example, a 40-line file, each line containing "Line nn", where nn is the line number. Consider doing 'ALL /1/' on that file in XEDIT, followed by a 'CHANGE /Line/Fine/ * *'. Once you displayed the entire file again with 'ALL', you would see that only the lines with a '1' in them had "Line" changed to "Fine"; only the displayed lines are affected by editor operations when an ALL is in effect. Implementing this in Emacs would involve doing a series of iterative narrow-to-region/replace-{string,regexp} steps, which is certainly doable, but which would also be rather slow. Also, wrt 'selective-display' and the writing of such buffers to files, are any C-m's originally contained in the buffer treated any differently when written out to a file than C-m's introduced into the buffer by the major mode? Ie., do C-m's get converted to newlines indiscriminately? --woodstock -- "How did you get your mind to tilt like your hat?" ...!{decwrl|hplabs!oliveb|pur-ee|qantel|amd}!intelca!mipos3!cpocd2!nate <domainish> : nate@cpocd2.intel.com ATT : (602) 961-2037