Loading ...
Sorry, an error occurred while loading the content.

2043Re: [jasspa] macro for close / exit

Expand Messages
  • Thomas Hundt
    Oct 24, 2006
    • 0 Attachment
      Well, I actually thought Bryan had described it better than me :-)

      I think all these commands you're looking for exist already... just not
      all bound to the same key. It might be hard to write one macro that can
      handle all of your desired cases, but I think you could do it.

      To close a file-browser, you can just hit F10 again.

      C-x C-x exits Emacs if there are no other buffers open. (I seem to have
      bound Alt-F4 to save-buffers-exit-emacs, which does that, also.)

      If you want to kill a buffer unconditionally, supposedly you can give
      delete-buffer a numeric argument that doesn't have bit 0 set.

      Now that we're talking about it: I seem to have Ctrl-F4 bound to "1
      delete-buffer" and it always asks me to confirm which buffer to kill.
      That's annoying. (I know where my cursor is.) So, I just stuck the
      following one-liner into my company file, which won't ask the name, but
      will ask if I'm sure I want to kill it (if there are changes AND the
      buffer isn't named starting with a '*'):

      ;------------------------------------------------------------
      ; delete-current-buffer: kills buffer w/o confirming the name
      ;------------------------------------------------------------
      define-macro delete-current-buffer
      1 delete-buffer $buffer-bname
      !emacro
      !force 1 global-bind-key delete-current-buffer "C-f4"

      In doing so it will, of course, kill off the file-browser buffers (but
      again, it's easier just to hit F10 to kill both sides and fix up the
      screen again).

      You could add a check for any non-'*' buffers and if there aren't any,
      exit. That might meet your needs.

      -Th



      dsjkvf wrote, On 10/24/2006 10:43 PM:
      > On 10/24/06, Thomas Hundt <thundt@...> wrote:
      >
      >> It sounds to me like you want one key for closing the current document,
      >> not exiting the program. (Most Windows software uses Ctrl-F4 for this
      >> purpose. Or, more recently, coming over from the Mac world, Ctrl-W.)
      >
      > well, yes, that's the right example :).
      >
      > the only additional thing i want is an ability to close ME too with
      > the same "Ctrl-W" if there are no open buffers left (with an exception
      > for those system *buffers* like *scratch*, etc)
      >
      >> So, in ME, maybe you want save-buffer (C-x C-s) followed by kill-buffer
      >> (C-x C-k), wrapped in a macro. Would this work for notes and other
      >> things you use?
      >
      > in fact, no.
      >
      > 1. i do not want to save additionally. (generally, ME asks if you want
      > to kill an unsaved buffer. and, from the other side, i press C-x C-s
      > quite often :))
      > 2. when you execute delete-buffer it _always_ asks you if you really
      > want to kill a buffer even if there were no changes made to it -- so,
      > i'd like to skip this question :).
      >
      > 3. in fact, i think that there should be some IF ... THEN ...
      > condition, which would perform different commands depending on the
      > situation: delete-buffer if there is "simple" buffer in a foreground;
      > file-browser-close if there is a file-browser in a foreground;
      > exit-emacs if there are no open buffers left (as i've mentioned above,
      > with an exception for "system" buffers), etc -- something like that
      > :).
      >
      >
      >
      >
      >
      > dsjkvf
      >
    • Show all 8 messages in this topic