unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Implement functions for measuring fonts and max chars per line
@ 2014-12-22 14:39 Titus von der Malsburg
  2014-12-22 22:25 ` Titus von der Malsburg
  0 siblings, 1 reply; 25+ messages in thread
From: Titus von der Malsburg @ 2014-12-22 14:39 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 7344 bytes --]


Hi,

I produced a patch that adds convenient capabilities for measuring font
sizes and for calculating how many characters fit on a line given a
window and a font.  This is in response to bug#19395 and builds on Eli
Zaretskii's recent extension of `font-info' (commit
b1978229162b0d4c3b14d8ad8bff383eb3511969).

I'm a first-time submitter and would appreciate some feedback and
additional information.

Question 1: The file CONTRIBUTING says that I should ask on the list for
the procedure regarding the copyright assignment.  I currently live in
the US but I think I do not have resident status.

Question 2: It there a 1-to-1 relationship of commit messages and
ChangeLog entries?  The file CONTRIBUTING makes it sound like that but I
see that some entries in ChangeLog are quite heavy which makes me
suspect that they may represent several commits.

Description of the new features:

The background for this work is that I need a reliable way to determine
how many characters I can fit on a line in a given font and
window.  This information is needed for presenting data in table format,
for instance, when displaying search results in Helm.  `window-width'
looks like a solution for that but there are two problems: it
assumes the frame's default font when doing the calculations and it does
not account for the column reserved for the continuation glyph.  (If
either one of the fringes is zero, a column is reserved but not when
both fringes are non-zero.)

The solution to this problem is the new function
`window-max-chars-per-line' which optionally accepts a window and font
argument.  For measuring the width of a character in the given window
and font, this function uses another new function,
`window-font-width'.  For completeness, I also added
`window-font-height'.  The latter function is different from the
existing function `default-font-height' in simple.el because it takes
the window and font into account.  `default-font-height' assumes the
default font (possibly remapped in the current
buffer).  `window-font-height' and `window-font-width' both take an
optional window argument because the relevant buffer may be displayed in
several frames at the same time and different frames may use different
fonts.  So the result depends not just on the face but also on the
window.  For completeness, I also added a function `default-font-width'
in simple.el which was previously missing.

Many thanks to Eli for providing crucial input while I worked on
this.  All errors are obviously my fault.

  Titus

The patch:

Implement functions for measuring fonts and max chars per line

* simple.el (default-font-width): new function.
* (default-font-height): elaborate doc-string
* window.el (window-font-width): new function
(window-font-height): new function
(window-max-chars-per-line): new function
---
 lisp/simple.el | 24 +++++++++++++++++++++++-
 lisp/window.el | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 74 insertions(+), 1 deletion(-)

diff --git a/lisp/simple.el b/lisp/simple.el
index 0fcd5db..72dcbb2 100644

--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -5377,7 +5377,10 @@ lines."
 (declare-function font-info "font.c" (name &optional frame))
 
 (defun default-font-height ()
-  "Return the height in pixels of the current buffer's default face font."
+  "Return the height in pixels of the current buffer's default face font.
+
+If the default font is remapped (see `face-remapping-alist'), the
+function returns the width of the remapped face."
   (let ((default-font (face-font 'default)))
     (cond
      ((and (display-multi-font-p)
@@ -5388,6 +5391,25 @@ lines."
       (aref (font-info default-font) 3))
      (t (frame-char-height)))))
 
+(defun default-font-width ()
+  "Return the width in pixels of the current buffer's default face font.
+
+If the default font is remapped (see `face-remapping-alist'), the
+function returns the width of the remapped face."
+  (let ((default-font (face-font 'default)))
+    (cond
+     ((and (display-multi-font-p)
+	   ;; Avoid calling font-info if the frame's default font was
+	   ;; not changed since the frame was created.  That's because
+	   ;; font-info is expensive for some fonts, see bug #14838.
+	   (not (string= (frame-parameter nil 'font) default-font)))
+      (let* ((info (font-info (face-font 'default)))
+	     (width (aref info 11)))
+	(if (> width 0)
+	    width
+	  (aref info 10))))
+     (t (frame-char-width)))))
+
 (defun default-line-height ()
   "Return the pixel height of current buffer's default-face text line.
 
diff --git a/lisp/window.el b/lisp/window.el
index c95b0d6..990f953 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -1830,6 +1830,57 @@ optional argument PIXELWISE is passed to the functions."
       (window-body-width window pixelwise)
     (window-body-height window pixelwise)))
 
+(defun window-font-width (&optional window face)
+   "Return average character width for the font of FACE used in WINDOW.
+WINDOW must be a live window and defaults to the selected one.
+
+If FACE is nil or omitted, the default face is used.  If FACE is
+remapped (see `face-remapping-alist'), the function returns the
+information for the remapped face."
+   (with-selected-window (window-normalize-window window t)
+     (let* ((face (if face face 'default))
+	    (info (font-info (face-font face)))
+	    (width (aref info 11)))
+       (if (> width 0)
+	  width
+	 (aref info 10)))))
+
+(defun window-font-height (&optional window face)
+   "Return character height for the font of FACE used in WINDOW.
+WINDOW must be a live window and defaults to the selected one.
+
+If FACE is nil or omitted, the default face is used.  If FACE is
+remapped (see `face-remapping-alist'), the function returns the
+information for the remapped face."
+   (with-selected-window (window-normalize-window window t)
+     (let* ((face (if face face 'default))
+	    (info (font-info (face-font face))))
+       (aref info 3))))
+
+(defun window-max-chars-per-line (&optional window face)
+  "Return the number of characters that can be displayed on one line in WINDOW.
+WINDOW must be a live window and defaults to the selected one.
+
+The character width of FACE is used for the calculation.  If FACE
+is nil or omitted, the default face is used.  If FACE is
+remapped (see `face-remapping-alist'), the function uses the
+remapped face.
+
+This function is different from `window-body-width' in two
+ways.  First, it accounts for the portions of the line reserved
+for the continuation glyph.  Second, it accounts for the size of
+the font."
+  (with-selected-window (window-normalize-window window t)
+    (let* ((window-width (window-body-width window t))
+	   (font-width (window-font-width window face))
+	   (ncols (/ window-width font-width)))
+      (if (and (display-graphic-p)
+	       overflow-newline-into-fringe
+	       (/= (frame-parameter nil 'left-fringe) 0)
+	       (/= (frame-parameter nil 'right-fringe) 0))
+	  ncols
+	(1- ncols)))))
+
 (defun window-current-scroll-bars (&optional window)
   "Return the current scroll bar types for WINDOW.
 WINDOW must be a live window and defaults to the selected one.
-- 
1.9.1



[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH] Implement functions for measuring fonts and max chars per line
  2014-12-22 14:39 [PATCH] Implement functions for measuring fonts and max chars per line Titus von der Malsburg
@ 2014-12-22 22:25 ` Titus von der Malsburg
  2014-12-23 12:52   ` Titus von der Malsburg
  0 siblings, 1 reply; 25+ messages in thread
From: Titus von der Malsburg @ 2014-12-22 22:25 UTC (permalink / raw)
  To: emacs-devel; +Cc: Eli Zaretskii

[-- Attachment #1: Type: text/plain, Size: 6031 bytes --]


Below is an updated version of the patch with entries in etc/NEWS and a
fix for a typo in the doc-string of `default-font-height'.  The old
ChangeLog entry can be reused:

Implement functions for measuring fonts and max chars per line

* simple.el (default-font-width): new function.
* (default-font-height): elaborate doc-string
* window.el (window-font-width): new function
(window-font-height): new function
(window-max-chars-per-line): new function

diff --git a/etc/NEWS b/etc/NEWS
index 14a9176..4adcb3d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -163,6 +163,24 @@ possible inaccuracies in the end position.
 In particular, it now returns the average width of the font's
 characters, which can be used for geometry-related calculations.
 
+** A new function `default-font-width' returns the average width of a
+character in the current buffer's default font.  If the default face
+is remapped (see `face-remapping-alist'), the value for the remapped
+face is returned.  This function complements the existing function
+`default-font-height'.
+
+** New functions `window-font-height' and `window-font-width return
+the height and average width of characters in a specified face and
+window.  If FACE is remapped (see `face-remapping-alist'), the
+function returns the information for the remapped face.
+
+** A new function `window-max-chars-per-line' returns the maximal
+number of characters that can be displayed on one line.  If a face
+and/or window are provided, these values are used for the
+calculation.  This function is different from `window-body-width' in
+that it accounts for (i) continuation glyphs, (ii) the size of the
+font, and (iii) the specified window.
+
 \f
 * Editing Changes in Emacs 25.1
 
diff --git a/lisp/simple.el b/lisp/simple.el
index 0fcd5db..b700c68 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -5377,7 +5377,10 @@ lines."
 (declare-function font-info "font.c" (name &optional frame))
 
 (defun default-font-height ()
-  "Return the height in pixels of the current buffer's default face font."
+  "Return the height in pixels of the current buffer's default face font.
+
+If the default font is remapped (see `face-remapping-alist'), the
+function returns the height of the remapped face."
   (let ((default-font (face-font 'default)))
     (cond
      ((and (display-multi-font-p)
@@ -5388,6 +5391,25 @@ lines."
       (aref (font-info default-font) 3))
      (t (frame-char-height)))))
 
+(defun default-font-width ()
+  "Return the width in pixels of the current buffer's default face font.
+
+If the default font is remapped (see `face-remapping-alist'), the
+function returns the width of the remapped face."
+  (let ((default-font (face-font 'default)))
+    (cond
+     ((and (display-multi-font-p)
+	   ;; Avoid calling font-info if the frame's default font was
+	   ;; not changed since the frame was created.  That's because
+	   ;; font-info is expensive for some fonts, see bug #14838.
+	   (not (string= (frame-parameter nil 'font) default-font)))
+      (let* ((info (font-info (face-font 'default)))
+	     (width (aref info 11)))
+	(if (> width 0)
+	    width
+	  (aref info 10))))
+     (t (frame-char-width)))))
+
 (defun default-line-height ()
   "Return the pixel height of current buffer's default-face text line.
 
diff --git a/lisp/window.el b/lisp/window.el
index c95b0d6..990f953 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -1830,6 +1830,57 @@ optional argument PIXELWISE is passed to the functions."
       (window-body-width window pixelwise)
     (window-body-height window pixelwise)))
 
+(defun window-font-width (&optional window face)
+   "Return average character width for the font of FACE used in WINDOW.
+WINDOW must be a live window and defaults to the selected one.
+
+If FACE is nil or omitted, the default face is used.  If FACE is
+remapped (see `face-remapping-alist'), the function returns the
+information for the remapped face."
+   (with-selected-window (window-normalize-window window t)
+     (let* ((face (if face face 'default))
+	    (info (font-info (face-font face)))
+	    (width (aref info 11)))
+       (if (> width 0)
+	  width
+	 (aref info 10)))))
+
+(defun window-font-height (&optional window face)
+   "Return character height for the font of FACE used in WINDOW.
+WINDOW must be a live window and defaults to the selected one.
+
+If FACE is nil or omitted, the default face is used.  If FACE is
+remapped (see `face-remapping-alist'), the function returns the
+information for the remapped face."
+   (with-selected-window (window-normalize-window window t)
+     (let* ((face (if face face 'default))
+	    (info (font-info (face-font face))))
+       (aref info 3))))
+
+(defun window-max-chars-per-line (&optional window face)
+  "Return the number of characters that can be displayed on one line in WINDOW.
+WINDOW must be a live window and defaults to the selected one.
+
+The character width of FACE is used for the calculation.  If FACE
+is nil or omitted, the default face is used.  If FACE is
+remapped (see `face-remapping-alist'), the function uses the
+remapped face.
+
+This function is different from `window-body-width' in two
+ways.  First, it accounts for the portions of the line reserved
+for the continuation glyph.  Second, it accounts for the size of
+the font."
+  (with-selected-window (window-normalize-window window t)
+    (let* ((window-width (window-body-width window t))
+	   (font-width (window-font-width window face))
+	   (ncols (/ window-width font-width)))
+      (if (and (display-graphic-p)
+	       overflow-newline-into-fringe
+	       (/= (frame-parameter nil 'left-fringe) 0)
+	       (/= (frame-parameter nil 'right-fringe) 0))
+	  ncols
+	(1- ncols)))))
+
 (defun window-current-scroll-bars (&optional window)
   "Return the current scroll bar types for WINDOW.
 WINDOW must be a live window and defaults to the selected one.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH] Implement functions for measuring fonts and max chars per line
  2014-12-22 22:25 ` Titus von der Malsburg
@ 2014-12-23 12:52   ` Titus von der Malsburg
  2015-01-17 18:13     ` Titus von der Malsburg
  0 siblings, 1 reply; 25+ messages in thread
From: Titus von der Malsburg @ 2014-12-23 12:52 UTC (permalink / raw)
  To: emacs-devel; +Cc: Eli Zaretskii

[-- Attachment #1: Type: text/plain, Size: 5951 bytes --]


In the last version of the path `window-font-width' and
`window-font-height' didn't work properly when Emacs was running in a
terminal.  This is fixed in the patch below.

Regarding the copyright paperwork, I sent an email to
copyright-clerk@fsf.org.  

  Titus

diff --git a/etc/NEWS b/etc/NEWS
index 14a9176..4adcb3d 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -163,6 +163,24 @@ possible inaccuracies in the end position.
 In particular, it now returns the average width of the font's
 characters, which can be used for geometry-related calculations.
 
+** A new function `default-font-width' returns the average width of a
+character in the current buffer's default font.  If the default face
+is remapped (see `face-remapping-alist'), the value for the remapped
+face is returned.  This function complements the existing function
+`default-font-height'.
+
+** New functions `window-font-height' and `window-font-width return
+the height and average width of characters in a specified face and
+window.  If FACE is remapped (see `face-remapping-alist'), the
+function returns the information for the remapped face.
+
+** A new function `window-max-chars-per-line' returns the maximal
+number of characters that can be displayed on one line.  If a face
+and/or window are provided, these values are used for the
+calculation.  This function is different from `window-body-width' in
+that it accounts for (i) continuation glyphs, (ii) the size of the
+font, and (iii) the specified window.
+
 \f
 * Editing Changes in Emacs 25.1
 
diff --git a/lisp/simple.el b/lisp/simple.el
index 0fcd5db..b700c68 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -5377,7 +5377,10 @@ lines."
 (declare-function font-info "font.c" (name &optional frame))
 
 (defun default-font-height ()
-  "Return the height in pixels of the current buffer's default face font."
+  "Return the height in pixels of the current buffer's default face font.
+
+If the default font is remapped (see `face-remapping-alist'), the
+function returns the height of the remapped face."
   (let ((default-font (face-font 'default)))
     (cond
      ((and (display-multi-font-p)
@@ -5388,6 +5391,25 @@ lines."
       (aref (font-info default-font) 3))
      (t (frame-char-height)))))
 
+(defun default-font-width ()
+  "Return the width in pixels of the current buffer's default face font.
+
+If the default font is remapped (see `face-remapping-alist'), the
+function returns the width of the remapped face."
+  (let ((default-font (face-font 'default)))
+    (cond
+     ((and (display-multi-font-p)
+	   ;; Avoid calling font-info if the frame's default font was
+	   ;; not changed since the frame was created.  That's because
+	   ;; font-info is expensive for some fonts, see bug #14838.
+	   (not (string= (frame-parameter nil 'font) default-font)))
+      (let* ((info (font-info (face-font 'default)))
+	     (width (aref info 11)))
+	(if (> width 0)
+	    width
+	  (aref info 10))))
+     (t (frame-char-width)))))
+
 (defun default-line-height ()
   "Return the pixel height of current buffer's default-face text line.
 
diff --git a/lisp/window.el b/lisp/window.el
index c95b0d6..240d160 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -1830,6 +1830,61 @@ optional argument PIXELWISE is passed to the functions."
       (window-body-width window pixelwise)
     (window-body-height window pixelwise)))
 
+(defun window-font-width (&optional window face)
+   "Return average character width for the font of FACE used in WINDOW.
+WINDOW must be a live window and defaults to the selected one.
+
+If FACE is nil or omitted, the default face is used.  If FACE is
+remapped (see `face-remapping-alist'), the function returns the
+information for the remapped face."
+   (with-selected-window (window-normalize-window window t)
+     (if (display-multi-font-p)
+	 (let* ((face (if face face 'default))
+		(info (font-info (face-font face)))
+		(width (aref info 11)))
+	   (if (> width 0)
+	      width
+	     (aref info 10)))
+       (frame-char-width))))
+
+(defun window-font-height (&optional window face)
+   "Return character height for the font of FACE used in WINDOW.
+WINDOW must be a live window and defaults to the selected one.
+
+If FACE is nil or omitted, the default face is used.  If FACE is
+remapped (see `face-remapping-alist'), the function returns the
+information for the remapped face."
+   (with-selected-window (window-normalize-window window t)
+     (if (display-multi-font-p)
+	 (let* ((face (if face face 'default))
+		(info (font-info (face-font face))))
+	   (aref info 3))
+       (frame-char-height))))
+
+(defun window-max-chars-per-line (&optional window face)
+  "Return the number of characters that can be displayed on one line in WINDOW.
+WINDOW must be a live window and defaults to the selected one.
+
+The character width of FACE is used for the calculation.  If FACE
+is nil or omitted, the default face is used.  If FACE is
+remapped (see `face-remapping-alist'), the function uses the
+remapped face.
+
+This function is different from `window-body-width' in two
+ways.  First, it accounts for the portions of the line reserved
+for the continuation glyph.  Second, it accounts for the size of
+the font."
+  (with-selected-window (window-normalize-window window t)
+    (let* ((window-width (window-body-width window t))
+	   (font-width (window-font-width window face))
+	   (ncols (/ window-width font-width)))
+      (if (and (display-graphic-p)
+	       overflow-newline-into-fringe
+	       (/= (frame-parameter nil 'left-fringe) 0)
+	       (/= (frame-parameter nil 'right-fringe) 0))
+	  ncols
+	(1- ncols)))))
+
 (defun window-current-scroll-bars (&optional window)
   "Return the current scroll bar types for WINDOW.
 WINDOW must be a live window and defaults to the selected one.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH] Implement functions for measuring fonts and max chars per line
  2014-12-23 12:52   ` Titus von der Malsburg
@ 2015-01-17 18:13     ` Titus von der Malsburg
  2015-01-17 18:43       ` Eli Zaretskii
                         ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Titus von der Malsburg @ 2015-01-17 18:13 UTC (permalink / raw)
  To: emacs-devel; +Cc: Eli Zaretskii

[-- Attachment #1: Type: text/plain, Size: 5849 bytes --]


I signed and submitted the copyright forms a while ago.  As far as I'm
concerned this patch is ready to be merged.  Below is an updated
version.

Best,

  Titus

diff --git a/etc/NEWS b/etc/NEWS
index be283bb..603bbc8 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -165,6 +165,24 @@ possible inaccuracies in the end position.
 In particular, it now returns the average width of the font's
 characters, which can be used for geometry-related calculations.
 
+** A new function `default-font-width' returns the average width of a
+character in the current buffer's default font.  If the default face
+is remapped (see `face-remapping-alist'), the value for the remapped
+face is returned.  This function complements the existing function
+`default-font-height'.
+
+** New functions `window-font-height' and `window-font-width return
+the height and average width of characters in a specified face and
+window.  If FACE is remapped (see `face-remapping-alist'), the
+function returns the information for the remapped face.
+
+** A new function `window-max-chars-per-line' returns the maximal
+number of characters that can be displayed on one line.  If a face
+and/or window are provided, these values are used for the
+calculation.  This function is different from `window-body-width' in
+that it accounts for (i) continuation glyphs, (ii) the size of the
+font, and (iii) the specified window.
+
 \f
 * Editing Changes in Emacs 25.1
 
diff --git a/lisp/simple.el b/lisp/simple.el
index 25293ed..3369606 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -5377,7 +5377,10 @@ lines."
 (declare-function font-info "font.c" (name &optional frame))
 
 (defun default-font-height ()
-  "Return the height in pixels of the current buffer's default face font."
+  "Return the height in pixels of the current buffer's default face font.
+
+If the default font is remapped (see `face-remapping-alist'), the
+function returns the height of the remapped face."
   (let ((default-font (face-font 'default)))
     (cond
      ((and (display-multi-font-p)
@@ -5388,6 +5391,25 @@ lines."
       (aref (font-info default-font) 3))
      (t (frame-char-height)))))
 
+(defun default-font-width ()
+  "Return the width in pixels of the current buffer's default face font.
+
+If the default font is remapped (see `face-remapping-alist'), the
+function returns the width of the remapped face."
+  (let ((default-font (face-font 'default)))
+    (cond
+     ((and (display-multi-font-p)
+	   ;; Avoid calling font-info if the frame's default font was
+	   ;; not changed since the frame was created.  That's because
+	   ;; font-info is expensive for some fonts, see bug #14838.
+	   (not (string= (frame-parameter nil 'font) default-font)))
+      (let* ((info (font-info (face-font 'default)))
+	     (width (aref info 11)))
+	(if (> width 0)
+	    width
+	  (aref info 10))))
+     (t (frame-char-width)))))
+
 (defun default-line-height ()
   "Return the pixel height of current buffer's default-face text line.
 
diff --git a/lisp/window.el b/lisp/window.el
index abc6006..1606f6c 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -1835,6 +1835,61 @@ optional argument PIXELWISE is passed to the functions."
       (window-body-width window pixelwise)
     (window-body-height window pixelwise)))
 
+(defun window-font-width (&optional window face)
+   "Return average character width for the font of FACE used in WINDOW.
+WINDOW must be a live window and defaults to the selected one.
+
+If FACE is nil or omitted, the default face is used.  If FACE is
+remapped (see `face-remapping-alist'), the function returns the
+information for the remapped face."
+   (with-selected-window (window-normalize-window window t)
+     (if (display-multi-font-p)
+	 (let* ((face (if face face 'default))
+		(info (font-info (face-font face)))
+		(width (aref info 11)))
+	   (if (> width 0)
+	      width
+	     (aref info 10)))
+       (frame-char-width))))
+
+(defun window-font-height (&optional window face)
+   "Return character height for the font of FACE used in WINDOW.
+WINDOW must be a live window and defaults to the selected one.
+
+If FACE is nil or omitted, the default face is used.  If FACE is
+remapped (see `face-remapping-alist'), the function returns the
+information for the remapped face."
+   (with-selected-window (window-normalize-window window t)
+     (if (display-multi-font-p)
+	 (let* ((face (if face face 'default))
+		(info (font-info (face-font face))))
+	   (aref info 3))
+       (frame-char-height))))
+
+(defun window-max-chars-per-line (&optional window face)
+  "Return the number of characters that can be displayed on one line in WINDOW.
+WINDOW must be a live window and defaults to the selected one.
+
+The character width of FACE is used for the calculation.  If FACE
+is nil or omitted, the default face is used.  If FACE is
+remapped (see `face-remapping-alist'), the function uses the
+remapped face.
+
+This function is different from `window-body-width' in two
+ways.  First, it accounts for the portions of the line reserved
+for the continuation glyph.  Second, it accounts for the size of
+the font."
+  (with-selected-window (window-normalize-window window t)
+    (let* ((window-width (window-body-width window t))
+	   (font-width (window-font-width window face))
+	   (ncols (/ window-width font-width)))
+      (if (and (display-graphic-p)
+	       overflow-newline-into-fringe
+	       (/= (frame-parameter nil 'left-fringe) 0)
+	       (/= (frame-parameter nil 'right-fringe) 0))
+	  ncols
+	(1- ncols)))))
+
 (defun window-current-scroll-bars (&optional window)
   "Return the current scroll bar types for WINDOW.
 WINDOW must be a live window and defaults to the selected one.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply related	[flat|nested] 25+ messages in thread

* Re: [PATCH] Implement functions for measuring fonts and max chars per line
  2015-01-17 18:13     ` Titus von der Malsburg
@ 2015-01-17 18:43       ` Eli Zaretskii
  2015-01-17 20:38       ` Perry E. Metzger
  2015-03-21 10:33       ` Eli Zaretskii
  2 siblings, 0 replies; 25+ messages in thread
From: Eli Zaretskii @ 2015-01-17 18:43 UTC (permalink / raw)
  To: Titus von der Malsburg; +Cc: emacs-devel

> From: Titus von der Malsburg <malsburg@posteo.de>
> Cc: Eli Zaretskii <eliz@gnu.org>
> Date: Sat, 17 Jan 2015 10:13:27 -0800
> 
> I signed and submitted the copyright forms a while ago.  As far as I'm
> concerned this patch is ready to be merged.  Below is an updated
> version.

Thanks.  I'm waiting for the FSF copyright clerk to update the list of
assignments (it's not there yet), at which time I will commit your
changes.  Perhaps try writing to the FSF clerk asking him where things
stand with your assignment.



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] Implement functions for measuring fonts and max chars per line
  2015-01-17 18:13     ` Titus von der Malsburg
  2015-01-17 18:43       ` Eli Zaretskii
@ 2015-01-17 20:38       ` Perry E. Metzger
  2015-01-17 20:41         ` Eli Zaretskii
  2015-03-21 10:33       ` Eli Zaretskii
  2 siblings, 1 reply; 25+ messages in thread
From: Perry E. Metzger @ 2015-01-17 20:38 UTC (permalink / raw)
  To: Titus von der Malsburg; +Cc: emacs-devel

On Sat, 17 Jan 2015 10:13:27 -0800 Titus von der Malsburg
<malsburg@posteo.de> wrote:
> +** A new function `default-font-width' returns the average width
> of a +character in the current buffer's default font.  If the
> default face +is remapped (see `face-remapping-alist'), the value
> for the remapped +face is returned.  This function complements the
> existing function +`default-font-height'.
> +
> +** New functions `window-font-height' and `window-font-width return
> +the height and average width of characters in a specified face and
> +window.  If FACE is remapped (see `face-remapping-alist'), the
> +function returns the information for the remapped face.
> +
> +** A new function `window-max-chars-per-line' returns the maximal
> +number of characters that can be displayed on one line.  If a face
> +and/or window are provided, these values are used for the
> +calculation.  This function is different from `window-body-width'
> in +that it accounts for (i) continuation glyphs, (ii) the size of
> the +font, and (iii) the specified window.

This all brings to mind: is there a good way now to determine what
the maximum number of lines in a frame would be in a given font on
the user's display?

Perry
-- 
Perry E. Metzger		perry@piermont.com



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] Implement functions for measuring fonts and max chars per line
  2015-01-17 20:38       ` Perry E. Metzger
@ 2015-01-17 20:41         ` Eli Zaretskii
  2015-01-17 22:21           ` Perry E. Metzger
  0 siblings, 1 reply; 25+ messages in thread
From: Eli Zaretskii @ 2015-01-17 20:41 UTC (permalink / raw)
  To: Perry E. Metzger; +Cc: malsburg, emacs-devel

> Date: Sat, 17 Jan 2015 15:38:39 -0500
> From: "Perry E. Metzger" <perry@piermont.com>
> Cc: emacs-devel@gnu.org
> 
> This all brings to mind: is there a good way now to determine what
> the maximum number of lines in a frame would be in a given font on
> the user's display?

You mean window, not frame, right?

See window-screen-lines, which I think does what you want.



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] Implement functions for measuring fonts and max chars per line
  2015-01-17 20:41         ` Eli Zaretskii
@ 2015-01-17 22:21           ` Perry E. Metzger
  2015-01-17 22:24             ` David Kastrup
  2015-01-18  3:42             ` Eli Zaretskii
  0 siblings, 2 replies; 25+ messages in thread
From: Perry E. Metzger @ 2015-01-17 22:21 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: malsburg, emacs-devel

On Sat, 17 Jan 2015 22:41:55 +0200 Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Sat, 17 Jan 2015 15:38:39 -0500
> > From: "Perry E. Metzger" <perry@piermont.com>
> > Cc: emacs-devel@gnu.org
> > 
> > This all brings to mind: is there a good way now to determine what
> > the maximum number of lines in a frame would be in a given font on
> > the user's display?
> 
> You mean window, not frame, right?

No, frame. I'd like to be able to set my default frame height to "full
height" for the display (filling the display from top to bottom) --
right now I do guesswork to do this, and my .emacs breaks when I
switch to a new display.

> See window-screen-lines, which I think does what you want.

I believe that says how many lines are in an emacs window, not in the
frame if it contains a single window, and either way, what I want is
to know "how high exactly, in lines, would the frame have to be in
order to fill the Y axis of the display fully".

I'm perhaps not explaining this well.

Perry
-- 
Perry E. Metzger		perry@piermont.com



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] Implement functions for measuring fonts and max chars per line
  2015-01-17 22:21           ` Perry E. Metzger
@ 2015-01-17 22:24             ` David Kastrup
  2015-01-18  0:08               ` Perry E. Metzger
  2015-01-18  0:11               ` Perry E. Metzger
  2015-01-18  3:42             ` Eli Zaretskii
  1 sibling, 2 replies; 25+ messages in thread
From: David Kastrup @ 2015-01-17 22:24 UTC (permalink / raw)
  To: Perry E. Metzger; +Cc: Eli Zaretskii, malsburg, emacs-devel

"Perry E. Metzger" <perry@piermont.com> writes:

> On Sat, 17 Jan 2015 22:41:55 +0200 Eli Zaretskii <eliz@gnu.org> wrote:
>> > Date: Sat, 17 Jan 2015 15:38:39 -0500
>> > From: "Perry E. Metzger" <perry@piermont.com>
>> > Cc: emacs-devel@gnu.org
>> > 
>> > This all brings to mind: is there a good way now to determine what
>> > the maximum number of lines in a frame would be in a given font on
>> > the user's display?
>> 
>> You mean window, not frame, right?
>
> No, frame. I'd like to be able to set my default frame height to "full
> height" for the display (filling the display from top to bottom) --
> right now I do guesswork to do this, and my .emacs breaks when I
> switch to a new display.

Uh, maximize vertically?  I do that with my window manager, but Emacs
also offers it as a command line option

‘-fh’
‘--fullheight’
     Specify that the height should be the height of the screen.

and probably with some other ways.

-- 
David Kastrup



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] Implement functions for measuring fonts and max chars per line
  2015-01-17 22:24             ` David Kastrup
@ 2015-01-18  0:08               ` Perry E. Metzger
  2015-01-18  0:11               ` Perry E. Metzger
  1 sibling, 0 replies; 25+ messages in thread
From: Perry E. Metzger @ 2015-01-18  0:08 UTC (permalink / raw)
  To: David Kastrup; +Cc: Eli Zaretskii, malsburg, emacs-devel

On Sat, 17 Jan 2015 23:24:15 +0100 David Kastrup <dak@gnu.org> wrote:
> Uh, maximize vertically?  I do that with my window manager, but
> Emacs also offers it as a command line option
> 
> ‘-fh’
> ‘--fullheight’
>      Specify that the height should be the height of the screen.
> 
> and probably with some other ways.
> 



-- 
Perry E. Metzger		perry@piermont.com



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] Implement functions for measuring fonts and max chars per line
  2015-01-17 22:24             ` David Kastrup
  2015-01-18  0:08               ` Perry E. Metzger
@ 2015-01-18  0:11               ` Perry E. Metzger
  2015-01-18  1:01                 ` Michael Heerdegen
  1 sibling, 1 reply; 25+ messages in thread
From: Perry E. Metzger @ 2015-01-18  0:11 UTC (permalink / raw)
  To: David Kastrup; +Cc: Eli Zaretskii, malsburg, emacs-devel

On Sat, 17 Jan 2015 23:24:15 +0100 David Kastrup <dak@gnu.org> wrote:
> > No, frame. I'd like to be able to set my default frame height to
> > "full height" for the display (filling the display from top to
> > bottom) -- right now I do guesswork to do this, and my .emacs
> > breaks when I switch to a new display.
> 
> Uh, maximize vertically?  I do that with my window manager,

I can't.

> but Emacs also offers it as a command line option
> 
> ‘-fh’
> ‘--fullheight’
>      Specify that the height should be the height of the screen.

Yes. What I want to do is do it programatically in elisp, not on the
command line. I would like to put it in my .emacs and such. Right
now I just manually figure out what maximum height is on a given
system with a given font and hard code that. I don't want to hard
code it.

Perry
-- 
Perry E. Metzger		perry@piermont.com



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] Implement functions for measuring fonts and max chars per line
  2015-01-18  0:11               ` Perry E. Metzger
@ 2015-01-18  1:01                 ` Michael Heerdegen
  0 siblings, 0 replies; 25+ messages in thread
From: Michael Heerdegen @ 2015-01-18  1:01 UTC (permalink / raw)
  To: emacs-devel

"Perry E. Metzger" <perry@piermont.com> writes:

> > ‘-fh’
> > ‘--fullheight’
> >      Specify that the height should be the height of the screen.

> Yes. What I want to do is do it programatically in elisp, not on the

How about (set-frame-parameter nil 'fullscreen 'fullheight)?




^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] Implement functions for measuring fonts and max chars per line
  2015-01-17 22:21           ` Perry E. Metzger
  2015-01-17 22:24             ` David Kastrup
@ 2015-01-18  3:42             ` Eli Zaretskii
  2015-01-18  4:08               ` Perry E. Metzger
  1 sibling, 1 reply; 25+ messages in thread
From: Eli Zaretskii @ 2015-01-18  3:42 UTC (permalink / raw)
  To: Perry E. Metzger; +Cc: malsburg, emacs-devel

> Date: Sat, 17 Jan 2015 17:21:22 -0500
> From: "Perry E. Metzger" <perry@piermont.com>
> Cc: malsburg@posteo.de, emacs-devel@gnu.org
> 
> On Sat, 17 Jan 2015 22:41:55 +0200 Eli Zaretskii <eliz@gnu.org> wrote:
> > > Date: Sat, 17 Jan 2015 15:38:39 -0500
> > > From: "Perry E. Metzger" <perry@piermont.com>
> > > Cc: emacs-devel@gnu.org
> > > 
> > > This all brings to mind: is there a good way now to determine what
> > > the maximum number of lines in a frame would be in a given font on
> > > the user's display?
> > 
> > You mean window, not frame, right?
> 
> No, frame.

It's meaningless to ask this question about frames, since frames don't
display text, at least not in GUI sessions.

> I'd like to be able to set my default frame height to "full height"
> for the display (filling the display from top to bottom) -- right
> now I do guesswork to do this, and my .emacs breaks when I switch to
> a new display.

Then you need to maximize the frame vertically.

> > See window-screen-lines, which I think does what you want.
> 
> I believe that says how many lines are in an emacs window, not in the
> frame if it contains a single window

When the frame has a single window, this says exactly what the frame
can display.

> I'm perhaps not explaining this well.

Perhaps.



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] Implement functions for measuring fonts and max chars per line
  2015-01-18  3:42             ` Eli Zaretskii
@ 2015-01-18  4:08               ` Perry E. Metzger
  2015-01-18 15:37                 ` Eli Zaretskii
  0 siblings, 1 reply; 25+ messages in thread
From: Perry E. Metzger @ 2015-01-18  4:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: malsburg, emacs-devel

On Sun, 18 Jan 2015 05:42:49 +0200 Eli Zaretskii <eliz@gnu.org> wrote:
> > > > This all brings to mind: is there a good way now to determine
> > > > what the maximum number of lines in a frame would be in a
> > > > given font on the user's display?
> > > 
> > > You mean window, not frame, right?
> > 
> > No, frame.
> 
> It's meaningless to ask this question about frames, since frames
> don't display text, at least not in GUI sessions.

There is a variables named default-frame-alist where I can do
things like setting 'height to an integer like "55" which
seems to indicate a frame where 55 lines of text may be viewed.
Perhaps my terminology is screwed up because of "default-frame-alist"
and the like, but my goal is to calculate what "55" should be rather
than setting it through trial and error. Regardless, my .emacs
currently includes

(if window-system
    (add-to-list 'default-frame-alist
		 (cons 'height 60)))

and I'd like to compute which "height" is full height for my display
(again, rather than simply figuring a number out by trial and error).

> > I'd like to be able to set my default frame height to "full
> > height" for the display (filling the display from top to bottom)
> > -- right now I do guesswork to do this, and my .emacs breaks when
> > I switch to a new display.
>
> Then you need to maximize the frame vertically.

I'm unclear on how to do that programatically either.

> > > See window-screen-lines, which I think does what you want.
> > 
> > I believe that says how many lines are in an emacs window, not in
> > the frame if it contains a single window
> 
> When the frame has a single window, this says exactly what the frame
> can display.

Yes, but I want to set the height of the frame, not query what it
is. I know what it is since I set it -- but I want to set it to the
largest integer it can be given the display and the font I am using.

Am I being unclear?

Perry
-- 
Perry E. Metzger		perry@piermont.com



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] Implement functions for measuring fonts and max chars per line
  2015-01-18  4:08               ` Perry E. Metzger
@ 2015-01-18 15:37                 ` Eli Zaretskii
  2015-01-18 22:26                   ` Perry E. Metzger
  0 siblings, 1 reply; 25+ messages in thread
From: Eli Zaretskii @ 2015-01-18 15:37 UTC (permalink / raw)
  To: Perry E. Metzger; +Cc: malsburg, emacs-devel

> Date: Sat, 17 Jan 2015 23:08:58 -0500
> From: "Perry E. Metzger" <perry@piermont.com>
> Cc: malsburg@posteo.de, emacs-devel@gnu.org
> 
> On Sun, 18 Jan 2015 05:42:49 +0200 Eli Zaretskii <eliz@gnu.org> wrote:
> > > > > This all brings to mind: is there a good way now to determine
> > > > > what the maximum number of lines in a frame would be in a
> > > > > given font on the user's display?
> > > > 
> > > > You mean window, not frame, right?
> > > 
> > > No, frame.
> > 
> > It's meaningless to ask this question about frames, since frames
> > don't display text, at least not in GUI sessions.
> 
> There is a variables named default-frame-alist where I can do
> things like setting 'height to an integer like "55" which
> seems to indicate a frame where 55 lines of text may be viewed.

That's just a (not so accurate) way of measuring frame's dimensions in
canonical character units, that's all.

> Perhaps my terminology is screwed up because of "default-frame-alist"
> and the like, but my goal is to calculate what "55" should be rather
> than setting it through trial and error. Regardless, my .emacs
> currently includes
> 
> (if window-system
>     (add-to-list 'default-frame-alist
> 		 (cons 'height 60)))
> 
> and I'd like to compute which "height" is full height for my display
> (again, rather than simply figuring a number out by trial and error).

So your actual goal is to maximize the frame's height.

> > > I'd like to be able to set my default frame height to "full
> > > height" for the display (filling the display from top to bottom)
> > > -- right now I do guesswork to do this, and my .emacs breaks when
> > > I switch to a new display.
> >
> > Then you need to maximize the frame vertically.
> 
> I'm unclear on how to do that programatically either.

Didn't you see what Michael wrote:

> From: Michael Heerdegen <michael_heerdegen@web.de>
> Date: Sun, 18 Jan 2015 02:01:46 +0100
> 
> "Perry E. Metzger" <perry@piermont.com> writes:
> 
> > > ‘-fh’
> > > ‘--fullheight’
> > >      Specify that the height should be the height of the screen.
> 
> > Yes. What I want to do is do it programatically in elisp, not on the
> 
> How about (set-frame-parameter nil 'fullscreen 'fullheight)?

Isn't that exactly what you want?




^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] Implement functions for measuring fonts and max chars per line
  2015-01-18 15:37                 ` Eli Zaretskii
@ 2015-01-18 22:26                   ` Perry E. Metzger
  2015-01-19  0:38                     ` Drew Adams
                                       ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Perry E. Metzger @ 2015-01-18 22:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: malsburg, emacs-devel

On Sun, 18 Jan 2015 17:37:41 +0200 Eli Zaretskii <eliz@gnu.org> wrote:
> > Regardless, my .emacs currently includes
> >
> > (if window-system
> >     (add-to-list 'default-frame-alist
> > 		 (cons 'height 60)))
> >
> > and I'd like to compute which "height" is full height for my
> > display (again, rather than simply figuring a number out by trial
> > and error).
>
> So your actual goal is to maximize the frame's height.

No, my goal is that all new emacs frames, including the first one,
start out at a maximum height -- but my broader goal is to know what
that height is programatically. I do things at times like setting up
an elisp function to achieve a particular window layout, for example,
and knowing what the maximum height is comes in use there as well.

> > How about (set-frame-parameter nil 'fullscreen 'fullheight)?
>
> Isn't that exactly what you want?

Not really. That will maximize the current frame only at the moment it
is executed, and it doesn't tell me in advance what the height (in
lines) is going to end up being.

What I want is to know (by calculation) what the maximum height, in
lines, happens to be so I can shove that in for 'height in
default-frame-alist. (There are other uses for such information of
course, see above.)

Perry
-- 
Perry E. Metzger		perry@piermont.com



^ permalink raw reply	[flat|nested] 25+ messages in thread

* RE: [PATCH] Implement functions for measuring fonts and max chars per line
  2015-01-18 22:26                   ` Perry E. Metzger
@ 2015-01-19  0:38                     ` Drew Adams
  2015-01-19  2:56                       ` Perry E. Metzger
  2015-01-19  2:01                     ` Michael Heerdegen
  2015-01-19  3:37                     ` Eli Zaretskii
  2 siblings, 1 reply; 25+ messages in thread
From: Drew Adams @ 2015-01-19  0:38 UTC (permalink / raw)
  To: Perry E. Metzger, Eli Zaretskii; +Cc: malsburg, emacs-devel

> What I want is to know (by calculation) what the maximum height, in
> lines, happens to be so I can shove that in for 'height in
> default-frame-alist. (There are other uses for such information of
> course, see above.)

The max height in pixels is `x-display-pixel-height'.

Divide that by the value returned by `frame-char-height' for your
frame, or by whatever character height you intend to use, if
you know it, to find the number of lines possible for the display.

But that does not count the space needed for these things:

1. menu-bar - you can approximate this by 
`(frame-parameter nil 'menu-bar-lines)'.

2. tool-bar - similar: `tool-bar-lines'.

3. height of the window-mgr title bar and bottom border.

4. any other window-mgr stuff that is outside Emacs's
visibility & control.

So proceeding this way you need to do a little estimating,
especially wrt window-mgr stuff.



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] Implement functions for measuring fonts and max chars per line
  2015-01-18 22:26                   ` Perry E. Metzger
  2015-01-19  0:38                     ` Drew Adams
@ 2015-01-19  2:01                     ` Michael Heerdegen
  2015-01-19  3:37                     ` Eli Zaretskii
  2 siblings, 0 replies; 25+ messages in thread
From: Michael Heerdegen @ 2015-01-19  2:01 UTC (permalink / raw)
  To: emacs-devel

"Perry E. Metzger" <perry@piermont.com> writes:

> What I want is to know (by calculation) what the maximum height, in
> lines, happens to be so I can shove that in for 'height in
> default-frame-alist. (There are other uses for such information of
> course, see above.)

Of course you can

    (add-to-list 'default-frame-alist '(fullscreen . fullheight))

though that's probably not sufficient for what you want.




^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] Implement functions for measuring fonts and max chars per line
  2015-01-19  0:38                     ` Drew Adams
@ 2015-01-19  2:56                       ` Perry E. Metzger
  2015-01-19  3:41                         ` Eli Zaretskii
  0 siblings, 1 reply; 25+ messages in thread
From: Perry E. Metzger @ 2015-01-19  2:56 UTC (permalink / raw)
  To: Drew Adams; +Cc: Eli Zaretskii, malsburg, emacs-devel

On Sun, 18 Jan 2015 16:38:01 -0800 (PST) Drew Adams
<drew.adams@oracle.com> wrote:
> > What I want is to know (by calculation) what the maximum height,
> > in lines, happens to be so I can shove that in for 'height in
> > default-frame-alist. (There are other uses for such information of
> > course, see above.)
> 
> The max height in pixels is `x-display-pixel-height'.
> 
> Divide that by the value returned by `frame-char-height' for your
> frame, or by whatever character height you intend to use, if
> you know it, to find the number of lines possible for the display.
> 
> But that does not count the space needed for these things:
> 
> 1. menu-bar - you can approximate this by 
> `(frame-parameter nil 'menu-bar-lines)'.
> 
> 2. tool-bar - similar: `tool-bar-lines'.
> 
> 3. height of the window-mgr title bar and bottom border.
> 
> 4. any other window-mgr stuff that is outside Emacs's
> visibility & control.
> 
> So proceeding this way you need to do a little estimating,
> especially wrt window-mgr stuff.

I've played these games before, and it is a reasonable stop-gap for
what I'm trying to do, at least much of the time.

What would be nice would be the addition of a function that told one
the true maximum number of lines possible for a frame on the given
display, *or* if there was a non-integer value you could specify for
the "height" component of the frame-alist that simply meant "as much
as possible". (Both might actually be nice things to have.)

-- 
Perry E. Metzger		perry@piermont.com



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] Implement functions for measuring fonts and max chars per line
  2015-01-18 22:26                   ` Perry E. Metzger
  2015-01-19  0:38                     ` Drew Adams
  2015-01-19  2:01                     ` Michael Heerdegen
@ 2015-01-19  3:37                     ` Eli Zaretskii
  2 siblings, 0 replies; 25+ messages in thread
From: Eli Zaretskii @ 2015-01-19  3:37 UTC (permalink / raw)
  To: Perry E. Metzger; +Cc: malsburg, emacs-devel

> Date: Sun, 18 Jan 2015 17:26:33 -0500
> From: "Perry E. Metzger" <perry@piermont.com>
> Cc: malsburg@posteo.de, emacs-devel@gnu.org
> 
> > > How about (set-frame-parameter nil 'fullscreen 'fullheight)?
> >
> > Isn't that exactly what you want?
> 
> Not really. That will maximize the current frame only at the moment it
> is executed, and it doesn't tell me in advance what the height (in
> lines) is going to end up being.
> 
> What I want is to know (by calculation) what the maximum height, in
> lines, happens to be so I can shove that in for 'height in
> default-frame-alist. (There are other uses for such information of
> course, see above.)

Why can't you put this parameter into default-frame-alist?



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] Implement functions for measuring fonts and max chars per line
  2015-01-19  2:56                       ` Perry E. Metzger
@ 2015-01-19  3:41                         ` Eli Zaretskii
  2015-01-19 13:31                           ` Perry E. Metzger
  0 siblings, 1 reply; 25+ messages in thread
From: Eli Zaretskii @ 2015-01-19  3:41 UTC (permalink / raw)
  To: Perry E. Metzger; +Cc: malsburg, drew.adams, emacs-devel

> Date: Sun, 18 Jan 2015 21:56:43 -0500
> From: "Perry E. Metzger" <perry@piermont.com>
> Cc: Eli Zaretskii <eliz@gnu.org>, malsburg@posteo.de, emacs-devel@gnu.org
> 
> What would be nice would be the addition of a function that told one
> the true maximum number of lines possible for a frame on the given
> display, *or* if there was a non-integer value you could specify for
> the "height" component of the frame-alist that simply meant "as much
> as possible". (Both might actually be nice things to have.)

That's what the 'fullscreen frame parameter is for.



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] Implement functions for measuring fonts and max chars per line
  2015-01-19  3:41                         ` Eli Zaretskii
@ 2015-01-19 13:31                           ` Perry E. Metzger
  2015-01-19 16:21                             ` Eli Zaretskii
  0 siblings, 1 reply; 25+ messages in thread
From: Perry E. Metzger @ 2015-01-19 13:31 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: malsburg, drew.adams, emacs-devel

On Mon, 19 Jan 2015 05:41:31 +0200 Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Sun, 18 Jan 2015 21:56:43 -0500
> > From: "Perry E. Metzger" <perry@piermont.com>
> > Cc: Eli Zaretskii <eliz@gnu.org>, malsburg@posteo.de,
> > emacs-devel@gnu.org
> > 
> > What would be nice would be the addition of a function that told
> > one the true maximum number of lines possible for a frame on the
> > given display, *or* if there was a non-integer value you could
> > specify for the "height" component of the frame-alist that simply
> > meant "as much as possible". (Both might actually be nice things
> > to have.)
> 
> That's what the 'fullscreen frame parameter is for.
> 

That will full-height the frame for me, but it won't tell me what the
height *is*, though I suppose I can then get that from the first
window in the frame once it appears.

Perry
-- 
Perry E. Metzger		perry@piermont.com



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] Implement functions for measuring fonts and max chars per line
  2015-01-19 13:31                           ` Perry E. Metzger
@ 2015-01-19 16:21                             ` Eli Zaretskii
  2015-01-19 21:49                               ` Perry E. Metzger
  0 siblings, 1 reply; 25+ messages in thread
From: Eli Zaretskii @ 2015-01-19 16:21 UTC (permalink / raw)
  To: Perry E. Metzger; +Cc: malsburg, drew.adams, emacs-devel

> Date: Mon, 19 Jan 2015 08:31:53 -0500
> From: "Perry E. Metzger" <perry@piermont.com>
> Cc: drew.adams@oracle.com, malsburg@posteo.de, emacs-devel@gnu.org
> 
> > That's what the 'fullscreen frame parameter is for.
> > 
> 
> That will full-height the frame for me, but it won't tell me what the
> height *is*

Why do you need that, having achieved your goal of maximizing the
height?

> I suppose I can then get that from the first window in the frame
> once it appears.

Yes, if you need that.



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] Implement functions for measuring fonts and max chars per line
  2015-01-19 16:21                             ` Eli Zaretskii
@ 2015-01-19 21:49                               ` Perry E. Metzger
  0 siblings, 0 replies; 25+ messages in thread
From: Perry E. Metzger @ 2015-01-19 21:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: malsburg, drew.adams, emacs-devel

On Mon, 19 Jan 2015 18:21:16 +0200 Eli Zaretskii <eliz@gnu.org> wrote:
> > Date: Mon, 19 Jan 2015 08:31:53 -0500
> > From: "Perry E. Metzger" <perry@piermont.com>
> > Cc: drew.adams@oracle.com, malsburg@posteo.de, emacs-devel@gnu.org
> > 
> > > That's what the 'fullscreen frame parameter is for.
> > > 
> > 
> > That will full-height the frame for me, but it won't tell me what
> > the height *is*
> 
> Why do you need that, having achieved your goal of maximizing the
> height?

Because that isn't my sole goal, but given that I have way around the
problem (albeit somewhat awkward) I'll just use that, no point in
stretching this out.

Perry

> > I suppose I can then get that from the first window in the frame
> > once it appears.
> 
> Yes, if you need that.
> 



-- 
Perry E. Metzger		perry@piermont.com



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [PATCH] Implement functions for measuring fonts and max chars per line
  2015-01-17 18:13     ` Titus von der Malsburg
  2015-01-17 18:43       ` Eli Zaretskii
  2015-01-17 20:38       ` Perry E. Metzger
@ 2015-03-21 10:33       ` Eli Zaretskii
  2 siblings, 0 replies; 25+ messages in thread
From: Eli Zaretskii @ 2015-03-21 10:33 UTC (permalink / raw)
  To: Titus von der Malsburg; +Cc: emacs-devel

> From: Titus von der Malsburg <malsburg@posteo.de>
> Cc: Eli Zaretskii <eliz@gnu.org>
> Date: Sat, 17 Jan 2015 10:13:27 -0800
> 
> I signed and submitted the copyright forms a while ago.  As far as I'm
> concerned this patch is ready to be merged.  Below is an updated
> version.

Thanks, I (finally) pushed this.



^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2015-03-21 10:33 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-22 14:39 [PATCH] Implement functions for measuring fonts and max chars per line Titus von der Malsburg
2014-12-22 22:25 ` Titus von der Malsburg
2014-12-23 12:52   ` Titus von der Malsburg
2015-01-17 18:13     ` Titus von der Malsburg
2015-01-17 18:43       ` Eli Zaretskii
2015-01-17 20:38       ` Perry E. Metzger
2015-01-17 20:41         ` Eli Zaretskii
2015-01-17 22:21           ` Perry E. Metzger
2015-01-17 22:24             ` David Kastrup
2015-01-18  0:08               ` Perry E. Metzger
2015-01-18  0:11               ` Perry E. Metzger
2015-01-18  1:01                 ` Michael Heerdegen
2015-01-18  3:42             ` Eli Zaretskii
2015-01-18  4:08               ` Perry E. Metzger
2015-01-18 15:37                 ` Eli Zaretskii
2015-01-18 22:26                   ` Perry E. Metzger
2015-01-19  0:38                     ` Drew Adams
2015-01-19  2:56                       ` Perry E. Metzger
2015-01-19  3:41                         ` Eli Zaretskii
2015-01-19 13:31                           ` Perry E. Metzger
2015-01-19 16:21                             ` Eli Zaretskii
2015-01-19 21:49                               ` Perry E. Metzger
2015-01-19  2:01                     ` Michael Heerdegen
2015-01-19  3:37                     ` Eli Zaretskii
2015-03-21 10:33       ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).