* [Q] Several emacs instances / dired and "derived" buffers
@ 2004-05-27 10:22 Ames Andreas (MPA/DF)
2004-05-29 12:11 ` Kai Grossjohann
0 siblings, 1 reply; 5+ messages in thread
From: Ames Andreas (MPA/DF) @ 2004-05-27 10:22 UTC (permalink / raw)
Hi all,
I've got two questions for which I'd welcome your experienced advice.
1) I use emacs not only for editing but also as calendar, mua etc (I
think this is not extraordinary around here). From time to time
emacs freezes and I'm suspecting gnus (I use procmail and I'm not
sure I have the locking right; furthermore I'm using nnimap with an
MS Exchange which seems sometimes to be unreachable). It is not
enough of a problem for me to try to find the error(s) but I'm
thinking of separating the non-editing tasks of my emacs into its
own emacs instance/process. That would also be an opportunity to
make my .emacs more lightweight and faster (because I could do
without starting calendar etc.).
Does it make sense to have sevaral instances of emacs running? How
can I start emacs with a separate startup file (and not my default
.emacs)? How can I make sure that gnuclient and friends finds only
my emacs-for-editing instance? Are there other potential problems
I do not recognise yet?
2) I use separate filesystem directories for separate programming (and
other) projects (surprise, surprise). When I begin working on one
project, I usually dired its toplevel directory and then I open
buffers below that one. When I switch to another project I oftenly
want to close all buffers related to the first project. This is
even a necessity when the project is in a directory that I have
mounted from a mobile computer because I want/must to unmount when
I stop working.
Currently I just close all these buffers manually. I'm wondering
if there isn't someone who has already written a command that
closes all buffers which are visiting files below a given
directory.
TIA,
andreas
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Q] Several emacs instances / dired and "derived" buffers
[not found] <mailman.7759.1085670886.1061.help-gnu-emacs@gnu.org>
@ 2004-05-27 16:15 ` Barry Margolin
[not found] ` <wkaczo1rjv.fsf@smsoft.ixy.de>
1 sibling, 0 replies; 5+ messages in thread
From: Barry Margolin @ 2004-05-27 16:15 UTC (permalink / raw)
In article <mailman.7759.1085670886.1061.help-gnu-emacs@gnu.org>,
"Ames Andreas (MPA/DF)" <Andreas.Ames@tenovis.com> wrote:
> Does it make sense to have sevaral instances of emacs running? How
> can I start emacs with a separate startup file (and not my default
> .emacs)? How can I make sure that gnuclient and friends finds only
> my emacs-for-editing instance? Are there other potential problems
> I do not recognise yet?
You can use the -q option to prevent emacs from reading the default
.emacs file, and -l filename to make it load a specific file. So your
gnus instance could be started up with something like:
emacs -q -l ~/.gnus.elc
Just make sure that only your init file for the emacs-for-editing
instance executes (gnuserve) to start up the server for gnuclient.
You'll probably want the init files to give the windows distinct title
bars.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Q] Several emacs instances / dired and "derived" buffers
2004-05-27 10:22 Ames Andreas (MPA/DF)
@ 2004-05-29 12:11 ` Kai Grossjohann
0 siblings, 0 replies; 5+ messages in thread
From: Kai Grossjohann @ 2004-05-29 12:11 UTC (permalink / raw)
"Ames Andreas (MPA/DF)" <Andreas.Ames@tenovis.com> writes:
> 1) I use emacs not only for editing but also as calendar, mua etc (I
> think this is not extraordinary around here). From time to time
> emacs freezes and I'm suspecting gnus (I use procmail and I'm not
> sure I have the locking right; furthermore I'm using nnimap with an
> MS Exchange which seems sometimes to be unreachable). It is not
> enough of a problem for me to try to find the error(s) but I'm
> thinking of separating the non-editing tasks of my emacs into its
> own emacs instance/process. That would also be an opportunity to
> make my .emacs more lightweight and faster (because I could do
> without starting calendar etc.).
Please note that Gnus gets very angry if something else frobs its
files. So it is best to tell procmail to deliver mail for the group
nnml:foo.bar into the file ~/spool/foo.bar.in, and then to set up
mail-sources like this:
(setq mail-sources '((directory :path "~/spool" :suffix ".in")))
Please note that the file is ~/spool/foo.bar.in (with a dot between
foo and bar) even if Gnus uses the directory ~/Mail/foo/bar (with a
slash between foo and bar) for the group.
The same setup also works for nnfolder and other backends, you do not
have to change the mail-sources setting, just
gnus-secondary-select-methods.
> Does it make sense to have sevaral instances of emacs running? How
> can I start emacs with a separate startup file (and not my default
> .emacs)? How can I make sure that gnuclient and friends finds only
> my emacs-for-editing instance? Are there other potential problems
> I do not recognise yet?
I define a function kai-gnus which does the Gnus-specific setup. Then
the Gnus Emacs is started as "emacs -f kai-gnus".
The other Emacs is started as "emacs -f server-start".
Kai
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Q] Several emacs instances / dired and "derived" buffers
[not found] ` <40BD062A.7070205@yahoo.com>
@ 2004-06-18 8:32 ` Michael Schierl
2004-06-21 15:13 ` Kevin Rodgers
0 siblings, 1 reply; 5+ messages in thread
From: Michael Schierl @ 2004-06-18 8:32 UTC (permalink / raw)
Kevin Rodgers <ihs_4664@yahoo.com> writes:
> Michael Schierl wrote:
> > "Ames Andreas (MPA/DF)" <Andreas.Ames@tenovis.com> writes:
> >> if there isn't someone who has already written a command that
> >> closes all buffers which are visiting files below a given
> >> directory.
> >
> > Quick&dirty solution:
> >
> > (defun close-all-buffers-below (dir)
> > (interactive "DDirectory: ")
> > (mapc '(lambda (buf) (if (and (buffer-file-name buf)
> > (string= dir
> > (substring (buffer-file-name buf)
> > 0
> > (length dir))))
> > (kill-buffer buf)))
> > (buffer-list)))
After some testing: that solution throws an error if a file name is
shorter than the given directory name.
e.g. when you close all files below c:/program files/my projects/foo/
and have a file open in c:/autoexec.bat. Seems that Emacs' substring
function throws an error if the string is shorter than TO. (I
expected it to return the substring from FROM to the end of the string
then...)
> If dir is "/foo/bar", won't that delete all buffers visiting files under
> "/FoO/bAr" (because string= ignores case)
If string= ignored case, that would not be any problem, since both me
and the OP are using Windows ;-)
> and "/foo/bar1" (because you
> ignore all characters after "/foo/bar") etc. as well?
If you use the autocompletion feature, dir will always end with a
slash. Of course you could adjust it to add the slash manually if
ther is no one yet.
> (mapc (lambda (buf)
> (let ((file (buffer-file-name buf)))
> (when (and file
> (equal (file-name-directory file) dir))
> (kill-buffer buf))))
> (buffer-list))
That one only closes all files *in* a directory and not *below* a
directory. If you specify to close all files below "/foo/bar", a file
like "/foo/bar/src/package/subpackage/blah/Classname.java" will
not be closed as well.
Michael
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [Q] Several emacs instances / dired and "derived" buffers
2004-06-18 8:32 ` Michael Schierl
@ 2004-06-21 15:13 ` Kevin Rodgers
0 siblings, 0 replies; 5+ messages in thread
From: Kevin Rodgers @ 2004-06-21 15:13 UTC (permalink / raw)
Michael Schierl wrote:
> Kevin Rodgers <ihs_4664@yahoo.com> writes:
>> (mapc (lambda (buf)
>> (let ((file (buffer-file-name buf)))
>> (when (and file
>>
(equal (file-name-directory file) dir))
>> (kill-buffer buf))))
>> (buffer-list))
>
> That one only closes all files *in* a directory and not *below* a
> directory. If you specify to close all files below "/foo/bar", a file
> like "/foo/bar/src/package/subpackage/blah/Classname.java" will
> not be closed as well.
Change (equal (file-name-directory file) dir) to
(string-match (concat "^" (regexp-quote (file-name-directory))) dir)
--
Kevin Rodgers
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2004-06-21 15:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.7759.1085670886.1061.help-gnu-emacs@gnu.org>
2004-05-27 16:15 ` [Q] Several emacs instances / dired and "derived" buffers Barry Margolin
[not found] ` <wkaczo1rjv.fsf@smsoft.ixy.de>
[not found] ` <40BD062A.7070205@yahoo.com>
2004-06-18 8:32 ` Michael Schierl
2004-06-21 15:13 ` Kevin Rodgers
2004-05-27 10:22 Ames Andreas (MPA/DF)
2004-05-29 12:11 ` Kai Grossjohann
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.