3

I would like all frames to overlap at (1,1). Yet with a .emacs containing

(setq initial-frame-alist
      '((top . 1) (left . 1) (width . 80) (height . 55)))

(setq default-frame-alist
      '((top . 1) (left . 1) (width . 80) (height . 55)))

calling C-x 5 2 results in frames in a cascade, as you see in the figure.

emacs-frames

How can I force all frames to be anchored at the same place?

I am running Emacs 23.3.1 on OS X (Mountain Lion).

4

1 回答 1

4

设置不会被忽略。您看到上述行为的原因是由于before-make-frame-hookns-win.el 中的一个在顶部和左侧添加了 25。

为避免上述影响,您可以将以下内容添加到您的 .emacs 文件中:

(setq default-frame-alist '((left . 0) (top . 0) (width . 80) (height . 55)))
(defvar parameters)
(add-hook 'before-make-frame-hook 
  (lambda ()
    (let ((left (cdr (assq 'left (frame-parameters))))
      (top (cdr (assq 'top (frame-parameters)))))
      (setq parameters (cons (cons 'left (+ left 0))
                     (cons (cons 'top (+ top 0))
                       parameters))))))

如果上述方法不起作用,您可以尝试以下来自ns-win.el before-make-frame-hook.

(setq default-frame-alist '((left . 0) (top . 0) (width . 80) (height . 55)))

(defvar parameters)
(add-hook 'before-make-frame-hook
  (lambda ()
    (let ((left (cdr (assq 'left (frame-parameters))))
          (top (cdr (assq 'top (frame-parameters)))))
      (if (consp left) (setq left (cadr left)))
      (if (consp top) (setq top (cadr top)))
      (cond
       ((or (assq 'top parameters) (assq 'left parameters)))
       ((or (not left) (not top)))
       (t
         (setq parameters (cons (cons 'left (+ left 0))
                   (cons (cons 'top (+ top 0))
                     parameters))))))))
于 2013-05-11T12:43:44.823 回答