* view/edit large files (was: map-file-lines)
@ 2009-02-07 3:44 MON KEY
2009-02-08 4:34 ` Bob Rogers
0 siblings, 1 reply; 5+ messages in thread
From: MON KEY @ 2009-02-07 3:44 UTC (permalink / raw)
To: tzz; +Cc: emacs-devel
> [1] I still can't think of a better term than "window."
> large-file-window is too verbose. boffset? byte-offset?
> virtual-buffer?
off-slice
slice-off
virtual-slice
s_P
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: map-file-lines
@ 2009-02-04 15:38 Ted Zlatanov
2009-02-05 5:40 ` map-file-lines Richard M Stallman
0 siblings, 1 reply; 5+ messages in thread
From: Ted Zlatanov @ 2009-02-04 15:38 UTC (permalink / raw)
To: emacs-devel
On Wed, 04 Feb 2009 02:04:32 -0500 Richard M Stallman <rms@gnu.org> wrote:
RMS> Here's an idea for a UI for editing big files. First you run M-x grep on
RMS> the file, and display the matches for whatever regexp. In the *grep*
RMS> buffer you specify a region, which is a way of choosing two matches,
RMS> the ones whose entries contain point and mark. Then you give a command to edit
RMS> the file from one of the matches to the other. It marks these matches
RMS> (and the lines containing them) as read-only so that you can't
RMS> spoil the correspondance with the file. Thus, you can always save this
RMS> partial-file buffer.
RMS> The beginning and end of the *grep* buffer can be used to specify
RMS> that the portion to edit starts or ends at bof or eof.
RMS> It would be easy to adapt this to variants such as
RMS> (1) using hexl-mode to visit the file,
RMS> (2) using methods other than grep to subdivide the file,
RMS> (3) providing more friendly front ends to grep.
This is essentially mapping byte offsets to line positions, with extra
calculations. As Stefan suggested, it's better to just use byte
offsets. Your approach requires a lot of tracking of the grep lines,
whereas just using byte offsets requires remembering the two current
offsets and nothing else.
Otherwise I think your suggestions are similar to mine: set up a special
mode where the buffer is a window[1] into the file instead of the whole
file, and create special commands to move the window back and forth.
Saving would only save the buffer contents; the window won't be moveable
until changes are saved (another approach is to remember modifications
outside the window, but that gets hairy with undo).
Ted
[1] I know "window" has meaning in Emacs already, but I can't think of a
better term.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: map-file-lines
2009-02-04 15:38 map-file-lines Ted Zlatanov
@ 2009-02-05 5:40 ` Richard M Stallman
2009-02-06 18:42 ` view/edit large files (was: map-file-lines) Ted Zlatanov
0 siblings, 1 reply; 5+ messages in thread
From: Richard M Stallman @ 2009-02-05 5:40 UTC (permalink / raw)
To: Ted Zlatanov; +Cc: emacs-devel
This is essentially mapping byte offsets to line positions, with extra
calculations. As Stefan suggested, it's better to just use byte
offsets.
The main point of my message is the UI proposal. You're right that
it's good to use byte offsets. I had not thought about that, but it
could be done by specifying the -b option for grep.
Otherwise I think your suggestions are similar to mine: set up a special
mode where the buffer is a window[1] into the file instead of the whole
file, and create special commands to move the window back and forth.
I proposed a specific UI for specifying which part of the file to
edit, one I think will be convenient.
^ permalink raw reply [flat|nested] 5+ messages in thread
* view/edit large files (was: map-file-lines)
2009-02-05 5:40 ` map-file-lines Richard M Stallman
@ 2009-02-06 18:42 ` Ted Zlatanov
2009-02-07 9:14 ` Richard M Stallman
0 siblings, 1 reply; 5+ messages in thread
From: Ted Zlatanov @ 2009-02-06 18:42 UTC (permalink / raw)
To: emacs-devel
On Thu, 05 Feb 2009 00:40:40 -0500 Richard M Stallman <rms@gnu.org> wrote:
RMS> The main point of my message is the UI proposal. You're right that
RMS> it's good to use byte offsets. I had not thought about that, but it
RMS> could be done by specifying the -b option for grep.
RMS> I proposed a specific UI for specifying which part of the file to
RMS> edit, one I think will be convenient.
Could you please explain, with code or text, what using your UI would
look like? I looked over your suggestions and I still think we have the
same idea, just expressed differently. You do seem to want `grep'
instead of dynamic offsets, but see my comments later.
Here's the "window"[1] API I'm suggesting, as a detailed list of TODO
items:
1) a buffer-local set of offset variables that indicate the beginning
and the end of the current window into the file.
2) override all write-file functions to write the buffer at the starting
offset. I don't think there's a write-file-contents analogous to
insert-file-contents
3) override all insert-file* functions to respect the offsets as well
3) disable insertion, always in overwrite mode for better performance
(maybe allow insert at end of file...). Force save when the "window" is
moved.
4) "window" management functions: set/get-window-offset,
set/get-window-length, etc. These operate on the (1) buffer-local
variables.
As you can see, it requires no grep calls to pre-scan the file, and
should be consistent with the existing Emacs code. Pre-scanning a large
file with grep can be very expensive, and it's inaccurate if the large
file is growing (e.g. a log file).
Thanks to anyone with suggestions...
Ted
[1] I still can't think of a better term than "window."
large-file-window is too verbose. boffset? byte-offset?
virtual-buffer?
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-02-09 19:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-07 3:44 view/edit large files (was: map-file-lines) MON KEY
2009-02-08 4:34 ` Bob Rogers
2009-02-09 19:44 ` view/edit large files Thien-Thi Nguyen
-- strict thread matches above, loose matches on Subject: below --
2009-02-04 15:38 map-file-lines Ted Zlatanov
2009-02-05 5:40 ` map-file-lines Richard M Stallman
2009-02-06 18:42 ` view/edit large files (was: map-file-lines) Ted Zlatanov
2009-02-07 9:14 ` Richard M Stallman
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.