Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
a32c1804
Commit
a32c1804
authored
Jan 03, 2008
by
Richard M. Stallman
Browse files
(frame-geom-value-cons, frame-geom-spec-cons): New fns.
parent
f8edc67e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
0 deletions
+66
-0
lisp/ChangeLog
lisp/ChangeLog
+4
-0
lisp/frame.el
lisp/frame.el
+62
-0
No files found.
lisp/ChangeLog
View file @
a32c1804
2008-01-03 Drew Adams <drew.adams@oracle.com>
* frame.el (frame-geom-value-cons, frame-geom-spec-cons): New fns.
2008-01-03 Richard Stallman <rms@gnu.org>
* replace.el (occur-context-lines): New subroutine,
...
...
lisp/frame.el
View file @
a32c1804
...
...
@@ -1329,6 +1329,68 @@ The value is one of the symbols `static-gray', `gray-scale',
'static-gray
))))
;;;; Frame geometry values
(
defun
frame-geom-value-cons
(
type
value
&optional
frame
)
"Return equivalent geometry value for FRAME as a cons with car `+'.
A geometry value equivalent to VALUE for FRAME is returned,
where the value is a cons with car `+', not numeric.
TYPE is the car of the original geometry spec (TYPE . VALUE).
It is `top' or `left', depending on which edge VALUE is related to.
VALUE is the cdr of a frame geometry spec: (left/top . VALUE).
If VALUE is a number, then it is converted to a cons value, perhaps
relative to the opposite frame edge from that in the original spec.
FRAME defaults to the selected frame.
Examples (measures in pixels) -
Assuming display height/width=1024, frame height/width=600:
300 inside display edge: 300 => (+ 300)
(+ 300) => (+ 300)
300 inside opposite display edge: (- 300) => (+ 124)
-300 => (+ 124)
300 beyond display edge
(= 724 inside opposite display edge): (+ -300) => (+ -300)
300 beyond display edge
(= 724 inside opposite display edge): (- -300) => (+ 724)
In the 3rd, 4th, and 6th examples, the returned value is relative to
the opposite frame edge from the edge indicated in the input spec."
(
cond
((
and
(
consp
value
)
(
eq
'+
(
car
value
)))
; e.g. (+ 300), (+ -300)
value
)
((
natnump
value
)
(
list
'+
value
))
; e.g. 300 => (+ 300)
(
t
; e.g. -300, (- 300), (- -300)
(
list
'+
(
-
(
if
(
eq
'left
type
)
; => (+ 124), (+ 124), (+ 724)
(
x-display-pixel-width
)
(
x-display-pixel-height
))
(
if
(
integerp
value
)
(
-
value
)
(
cadr
value
))
(
if
(
eq
'left
type
)
(
frame-pixel-width
frame
)
(
frame-pixel-height
frame
)))))))
(
defun
frame-geom-spec-cons
(
spec
&optional
frame
)
"Return equivalent geometry spec for FRAME as a cons with car `+'.
A geometry specification equivalent to SPEC for FRAME is returned,
where the value is a cons with car `+', not numeric.
SPEC is a frame geometry spec: (left . VALUE) or (top . VALUE).
If VALUE is a number, then it is converted to a cons value, perhaps
relative to the opposite frame edge from that in the original spec.
FRAME defaults to the selected frame.
Examples (measures in pixels) -
Assuming display height=1024, frame height=600:
top 300 below display top: (top . 300) => (top + 300)
(top + 300) => (top + 300)
bottom 300 above display bottom: (top - 300) => (top + 124)
(top . -300) => (top + 124)
top 300 above display top
(= bottom 724 above display bottom): (top + -300) => (top + -300)
bottom 300 below display bottom
(= top 724 below display top): (top - -300) => (top + 724)
In the 3rd, 4th, and 6th examples, the returned value is relative to
the opposite frame edge from the edge indicated in the input spec."
(
cons
(
car
spec
)
(
frame-geom-value-cons
(
car
spec
)
(
cdr
spec
))))
;;;; Aliases for backward compatibility with Emacs 18.
(
define-obsolete-function-alias
'screen-height
'frame-height
)
;before 19.15
(
define-obsolete-function-alias
'screen-width
'frame-width
)
;before 19.15
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment