Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
edited body
Source Link
Dilna
  • 1.5k
  • 7
  • 13

I have the following code to store the position where to put the initial frame (fxpos and fypos).

My problem is that when I run a new emacs session, the defcustom commands are resetting the values back to 8. Mhat What can I do to avoid this?

(defgroup frame-pos nil "Set position of frame." :group 'convenience) (defcustom fxpos 8 "X position of initial frame." :type 'integer :group 'frame-pos) (defcustom fypos 8 "Y position of initial frame." :type 'integer :group 'frame-pos) (defun frame-shift (frame) (let* ( (lft (car (frame-position))) (top (cdr (frame-position))) (wdt (frame-outer-width frame)) (hgt (frame-outer-height frame)) (fxmid (+ lft (/ wdt 2))) (fymid (+ top (/ hgt 2))) (mgm (cdr (assq 'geometry (frame-monitor-attributes frame)))) (mxmid (+ (nth 0 mgm) (/ (nth 2 mgm) 2))) (mymid (+ (nth 1 mgm) (/ (nth 3 mgm) 2))) (nlft (+ lft (- mxmid fxmid))) (ntop (+ top (- mymid fymid))) ) (custom-declare-variable 'fxpos nlft) (custom-declare-variable 'fypos ntop))) 

I have the following code to store the position where to put the initial frame (fxpos and fypos).

My problem is that when I run a new emacs session, the defcustom commands are resetting the values back to 8. Mhat can I do to avoid this?

(defgroup frame-pos nil "Set position of frame." :group 'convenience) (defcustom fxpos 8 "X position of initial frame." :type 'integer :group 'frame-pos) (defcustom fypos 8 "Y position of initial frame." :type 'integer :group 'frame-pos) (defun frame-shift (frame) (let* ( (lft (car (frame-position))) (top (cdr (frame-position))) (wdt (frame-outer-width frame)) (hgt (frame-outer-height frame)) (fxmid (+ lft (/ wdt 2))) (fymid (+ top (/ hgt 2))) (mgm (cdr (assq 'geometry (frame-monitor-attributes frame)))) (mxmid (+ (nth 0 mgm) (/ (nth 2 mgm) 2))) (mymid (+ (nth 1 mgm) (/ (nth 3 mgm) 2))) (nlft (+ lft (- mxmid fxmid))) (ntop (+ top (- mymid fymid))) ) (custom-declare-variable 'fxpos nlft) (custom-declare-variable 'fypos ntop))) 

I have the following code to store the position where to put the initial frame (fxpos and fypos).

My problem is that when I run a new emacs session, the defcustom commands are resetting the values back to 8. What can I do to avoid this?

(defgroup frame-pos nil "Set position of frame." :group 'convenience) (defcustom fxpos 8 "X position of initial frame." :type 'integer :group 'frame-pos) (defcustom fypos 8 "Y position of initial frame." :type 'integer :group 'frame-pos) (defun frame-shift (frame) (let* ( (lft (car (frame-position))) (top (cdr (frame-position))) (wdt (frame-outer-width frame)) (hgt (frame-outer-height frame)) (fxmid (+ lft (/ wdt 2))) (fymid (+ top (/ hgt 2))) (mgm (cdr (assq 'geometry (frame-monitor-attributes frame)))) (mxmid (+ (nth 0 mgm) (/ (nth 2 mgm) 2))) (mymid (+ (nth 1 mgm) (/ (nth 3 mgm) 2))) (nlft (+ lft (- mxmid fxmid))) (ntop (+ top (- mymid fymid))) ) (custom-declare-variable 'fxpos nlft) (custom-declare-variable 'fypos ntop))) 
Source Link
Dilna
  • 1.5k
  • 7
  • 13

Storing position for initial frame

I have the following code to store the position where to put the initial frame (fxpos and fypos).

My problem is that when I run a new emacs session, the defcustom commands are resetting the values back to 8. Mhat can I do to avoid this?

(defgroup frame-pos nil "Set position of frame." :group 'convenience) (defcustom fxpos 8 "X position of initial frame." :type 'integer :group 'frame-pos) (defcustom fypos 8 "Y position of initial frame." :type 'integer :group 'frame-pos) (defun frame-shift (frame) (let* ( (lft (car (frame-position))) (top (cdr (frame-position))) (wdt (frame-outer-width frame)) (hgt (frame-outer-height frame)) (fxmid (+ lft (/ wdt 2))) (fymid (+ top (/ hgt 2))) (mgm (cdr (assq 'geometry (frame-monitor-attributes frame)))) (mxmid (+ (nth 0 mgm) (/ (nth 2 mgm) 2))) (mymid (+ (nth 1 mgm) (/ (nth 3 mgm) 2))) (nlft (+ lft (- mxmid fxmid))) (ntop (+ top (- mymid fymid))) ) (custom-declare-variable 'fxpos nlft) (custom-declare-variable 'fypos ntop)))