emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: frame names on tty are different than the ones on X-frames


From: Christian Lynbech
Subject: Re: frame names on tty are different than the ones on X-frames
Date: Tue, 27 Feb 2018 14:13:57 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (darwin)

I too have a multi-frame setup, though it has not got quite as many
frames and I use it mostly in graphical environments.

I define my frames with frame paramaters such as:

                ((name . "((MAIN))")
                 (icon-name . "((MAIN))")
                 ...)

and then I have functions such as

    (defun my-select-main (&optional arg)
      "Fast select of main buffer.
    Optional argument ARG (prefix arg.) means iconify current frame."
      (interactive "P")
      (my-select-frame 'main arg))

This I bind to keys (in my case for the main frame: F8 2)

It calls `my-select-frame' which is defined as:

    (defun my-select-frame (name &optional discard)
      "Select, raise and show frame NAME.
    NAME may be either a frame object or a symbol that will then be interpreted
    by  `my-frame-configuration'.
    Optional argument DISCARD means get rid of current frame."
      (interactive)
      (let* ((current-frame (selected-frame))
             (frame-conf (my-frame-configuration name))
             (frame-exists t))
        (cond
          ((framep name)
           (make-frame-visible name)
           (raise-frame (select-frame name))
           (and discard (iconify-frame current-frame)))
          ((not frame-conf)
           (warn "No definition for %s" name))
          ((stringp frame-conf)
           (switch-to-buffer frame-conf))
          (t
           (condition-case nil
                           (select-frame-by-name (cdr (assq 'name frame-conf)))
                           (error (setq frame-exists nil)))
           (if (not frame-exists)
               (raise-frame (select-frame (funcall 'make-frame frame-conf))))
           (and discard (iconify-frame current-frame)))))
      (sit-for 0.1)
      (frame-reposition)
      (other-frame 0)            ;hack to place mouse cursor in corner
      (sit-for 0.1)
      (setq current-prefix-arg nil))

The function `my-frame-configuration' just is a small utility function
to return the desired configuration of a certain frame (using the symbol
'main to signify the main frame) such that I can select the frame if it
exists or create it on demand if not.

Some window managers are diligent about putting the icon name under the
icon, others are not, but I mostly use the keyboard shortcuts anyway.


------------------------+-----------------------------------------------------
Christian Lynbech       | christian #\@ defun #\. dk
------------------------+-----------------------------------------------------
Hit the philistines three times over the head with the Elisp reference manual.
                                        - address@hidden (Michael A. Petonic)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]