[OS X Emacs] opening *some* files in same window

Win Treese treese at acm.org
Wed Aug 26 18:18:47 EDT 2015


Hi, Pete. Is this something you can use the fancy controls of display-buffer-alist for?

For example, in Aquamacs 3.2, with one-buffer-one-frame-mode enabled, you can use
(set display-buffer-alist
    (cons “\\.txt$ <smb://.txt$>” (display-buffer-reuse-window display-buffer-below-selected))
    display-buffer-alist)

which should make buffers with names ending in “.txt” open in a split window in the current frame.

There’s a lot more you can do it with it; that’s just a very basic example.

Best,

Win

> On Aug 26, 2015, at 11:19 AM, Pete Siemsen <siemsen at ucar.edu> wrote:
> 
> In general, I like that Aquamacs opens new files in new windows (frames). But I think I might sometimes like it better if it opened similar files in the same window. For example, if I'm editing several Perl files that are part of one program, I might like to handle them in the same window. I'd like a "find-file-same-frame" command. I understand that I can use open-buffer-one-frame-mode to set the behavior, but I'd like some guidance as to how to do it elegantly.
> 
> I looked around a bit and found, in the Aquamacs Wiki under "Customize Aquamacs" a description of how to define a function that does the opposite of what I want, like so:
> 
> (defun my-new-frame-with-new-scratch ()
>   (interactive)
>   (let ((one-buffer-one-frame t))
>     (new-frame-with-new-scratch)))
> ​So I tried the following:
> 
> (defun find-file-same-frame ()​​
>   (interactive)​​
>   (let ((one-bu​​ffer-one-frame 0))
>     (ido-find-f​​ile)))​
> ​This just opens the file, in a new window. I think ido-find-file forces it to open in a new window, regardless of the setting of one-buffer-one-frame.
> 
> ​Am I on the right track, or is there a smarter approach?​​
> 
> -- Pete
> 
> 
> _____________________________________________________________
> MacOSX-Emacs mailing list
> MacOSX-Emacs at email.esm.psu.edu
> https://email.esm.psu.edu/mailman/listinfo/macosx-emacs
> List Archives: http://dir.gmane.org/gmane.emacs.macintosh.osx

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://email.esm.psu.edu/pipermail/macosx-emacs/attachments/20150826/8a222614/attachment.html>


More information about the MacOSX-Emacs mailing list