bug#28901: 25.3; Font selector fails to remember current font and size

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#28901: 25.3; Font selector fails to remember current font and size

Faré
  Open the "Options" menu, select the "Set Default Font" action.
  You can select a font, but the default offered is not based on the
  font and size currently in use, which makes it quite a pain to select
  a variant of what is currently used: for instance, you want one size
  less or more while keeping the same font (that you don't know the name
  of), or you want to try another font in the same family (that you
  don't remember the exact name of).

  Relatedly, a very useful yet missing option would be one that filters fonts
  to only display monospace fonts.


In GNU Emacs 25.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21)
 of 2017-10-05 built on localhost
Windowing system distributor 'The X.Org Foundation', version 11.0.11903000
Configured using:
 'configure --disable-dependency-tracking
 --prefix=/nix/store/mzd9pa3gs3hi6qy73w8hqv4zlilfka18-emacs-25.3
 --with-modules --with-x-toolkit=gtk3 --with-xft'

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND DBUS GSETTINGS NOTIFY LIBSELINUX GNUTLS
LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 MODULES

Important settings:
  value of $EMACSLOADPATH:
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp:
  value of $LC_CTYPE: en_US.UTF-8
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8

Major mode: LaTeX

Minor modes in effect:
  diff-auto-refine-mode: t
  shell-dirtrack-mode: t
  global-edit-server-edit-mode: t
  override-global-mode: t
  show-paren-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent messages:
Saving file /home/fare/fare/phdthesis/40-architecture.tex...
Wrote /home/fare/fare/phdthesis/40-architecture.tex
Saving file /home/fare/fare/phdthesis/40-architecture.tex...
Wrote /home/fare/fare/phdthesis/40-architecture.tex
Saving file /home/fare/fare/phdthesis/40-architecture.tex...
Wrote /home/fare/fare/phdthesis/40-architecture.tex
<XF86TouchpadOn> is undefined
Saving file /home/fare/fare/phdthesis/40-architecture.tex...
Wrote /home/fare/fare/phdthesis/40-architecture.tex
funcall-interactively: End of buffer

Load-path shadows:
/home/fare/src/scheme/gambit/misc/gambit hides
/home/fare/.nix-profile/share/emacs/site-lisp/gambit
/home/fare/.nix-profile/share/emacs/site-lisp/git hides
/run/current-system/sw/share/emacs/site-lisp/git
/home/fare/.nix-profile/share/emacs/site-lisp/git-blame hides
/run/current-system/sw/share/emacs/site-lisp/git-blame
/home/fare/.emacs.d/elpa/cider-20160304.1552/nrepl-client hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/nrepl-client
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider-inspector hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider-inspector
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider-scratch hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider-scratch
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider-popup hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider-popup
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider-debug hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider-debug
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider-stacktrace hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider-stacktrace
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider-common hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider-common
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider-macroexpansion
hides /nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider-macroexpansion
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider-classpath hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider-classpath
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider-interaction hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider-interaction
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider-autoloads hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider-autoloads
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider-eldoc hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider-eldoc
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider-test hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider-test
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider-repl hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider-repl
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider-browse-ns hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider-browse-ns
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider-util hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider-util
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider-overlays hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider-overlays
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider-selector hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider-selector
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider-mode hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider-mode
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider-resolve hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider-resolve
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider-grimoire hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider-grimoire
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider-compat hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider-compat
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider-doc hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider-doc
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider-apropos hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider-apropos
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider-client hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider-client
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider
/home/fare/.emacs.d/elpa/cider-20160304.1552/cider-pkg hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/cider-0.15.1/cider-pkg
/home/fare/.emacs.d/elpa/clojure-mode-20160226.956/clojure-mode-autoloads
hides /nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/clojure-mode-5.6.1/clojure-mode-autoloads
/home/fare/.emacs.d/elpa/clojure-mode-20160226.956/clojure-mode-pkg
hides /nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/clojure-mode-5.6.1/clojure-mode-pkg
/home/fare/.emacs.d/elpa/clojure-mode-20160226.956/clojure-mode hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/clojure-mode-5.6.1/clojure-mode
/home/fare/.emacs.d/elpa/epl-20150517.433/epl hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/epl-0.8/epl
/home/fare/.emacs.d/elpa/epl-20150517.433/epl-pkg hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/epl-0.8/epl-pkg
/home/fare/.emacs.d/elpa/epl-20150517.433/epl-autoloads hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/epl-0.8/epl-autoloads
/run/current-system/sw/share/emacs/site-lisp/nix-mode hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/nix-mode-1.2.1/nix-mode
/home/fare/.emacs.d/elpa/pkg-info-20150517.443/pkg-info-autoloads
hides /nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/pkg-info-0.6/pkg-info-autoloads
/home/fare/.emacs.d/elpa/pkg-info-20150517.443/pkg-info-pkg hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/pkg-info-0.6/pkg-info-pkg
/home/fare/.emacs.d/elpa/pkg-info-20150517.443/pkg-info hides
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/pkg-info-0.6/pkg-info
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/site-start
hides /nix/store/mzd9pa3gs3hi6qy73w8hqv4zlilfka18-emacs-25.3/share/emacs/site-lisp/site-start
/home/fare/etc/emacs/abbrev hides
/nix/store/mzd9pa3gs3hi6qy73w8hqv4zlilfka18-emacs-25.3/share/emacs/25.3/lisp/abbrev
/nix/store/js6f93ihr2crmijhi7j0ql9nszdszjsz-emacs-packages-deps/share/emacs/site-lisp/elpa/seq-2.20/seq
hides /nix/store/mzd9pa3gs3hi6qy73w8hqv4zlilfka18-emacs-25.3/share/emacs/25.3/lisp/emacs-lisp/seq

Features:
(shadow sort mail-extr warnings emacsbug message dired format-spec
rfc822 mml mml-sec password-cache epg gnus-util mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util help-fns mail-prsvr mail-utils
misearch multi-isearch vc-git diff-mode tex-mode shell pcomplete
latexenc rainbow-delimiters misterioso-theme term/xterm xterm server
tango-theme mic-paren gambit cmuscheme scheme slime-asdf grep
slime-fancy slime-trace-dialog slime-fontifying-fu slime-package-fu
slime-references slime-compiler-notes-tree slime-presentations bridge
slime-macrostep macrostep slime-mdot-fu slime-enclosing-context
slime-fuzzy slime-fancy-trace slime-fancy-inspector slime-c-p-c
slime-editing-commands slime-autodoc slime-repl elp slime-parse
slime-scratch slime derived lisp-mnt gud apropos compile etags xref
project eieio eieio-core arc-mode archive-mode noutline outline pp
comint ansi-color ring hyperspec thingatpt browse-url slime-autoloads
edit-server-htmlize html2text edit-server advice edmacro kmacro
highlight-chars use-package diminish bind-key easy-mmode paren ido
cl-macs cl-seq cl finder-inf info package epg-config seq seq-25 byte-opt
gv bytecomp byte-compile cl-extra help-mode easymenu cconv cl-loaddefs
pcase cl-lib time-date mule-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
frame cl-generic cham georgian utf-8-lang misc-lang vietnamese tibetan
thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian
slovak czech european ethiopic indian cyrillic chinese charscript
case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote dbusbind inotify
dynamic-setting system-font-setting font-render-setting move-toolbar gtk
x-toolkit x multi-tty make-network-process emacs)

Memory information:
((conses 16 341390 15515)
 (symbols 48 35288 0)
 (miscs 40 319 453)
 (strings 32 77573 12110)
 (string-bytes 1 2172643)
 (vectors 16 34665)
 (vector-slots 8 1499477 204524)
 (floats 8 347 722)
 (intervals 56 1375 0)
 (buffers 976 25))

--
—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org
Any time you're asking the user to make a choice they don't care about,
you have failed the user — Jeff Atwood



Reply | Threaded
Open this post in threaded view
|

bug#28901: 25.3; Font selector fails to remember current font and size

Lars Ingebrigtsen
Faré <[hidden email]> writes:

>   Open the "Options" menu, select the "Set Default Font" action.
>   You can select a font, but the default offered is not based on the
>   font and size currently in use, which makes it quite a pain to select
>   a variant of what is currently used: for instance, you want one size
>   less or more while keeping the same font (that you don't know the name
>   of), or you want to try another font in the same family (that you
>   don't remember the exact name of).

There is unfortunately no way to tell the Gtk font selector to do stuff
like that, so this is currently impossible to do, as far as I can tell.
So I'm closing this bug report.

--
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



Reply | Threaded
Open this post in threaded view
|

bug#28901: 25.3; Font selector fails to remember current font and size

Robert Pluim
>>>>> On Sun, 17 Nov 2019 09:00:14 +0100, Lars Ingebrigtsen <[hidden email]> said:

    Lars> Faré <[hidden email]> writes:
    >> Open the "Options" menu, select the "Set Default Font" action.
    >> You can select a font, but the default offered is not based on the
    >> font and size currently in use, which makes it quite a pain to select
    >> a variant of what is currently used: for instance, you want one size
    >> less or more while keeping the same font (that you don't know the name
    >> of), or you want to try another font in the same family (that you
    >> don't remember the exact name of).

    Lars> There is unfortunately no way to tell the Gtk font selector to do stuff
    Lars> like that, so this is currently impossible to do, as far as I can tell.
    Lars> So I'm closing this bug report.

gtk_font_chooser_set_font? We already use that to set the default family, but we
donʼt remember the size or the style.

Robert



Reply | Threaded
Open this post in threaded view
|

bug#28901: 25.3; Font selector fails to remember current font and size

Lars Ingebrigtsen
Robert Pluim <[hidden email]> writes:

> gtk_font_chooser_set_font? We already use that to set the default
> family, but we donʼt remember the size or the style.

Yes, the problem is that apparently gtk_font_chooser_set_font doesn't
allow you to specify those either.  Or much of anything else, for that
matter.  At least that seemed to be the case when I looked at this some
time back.

--
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



Reply | Threaded
Open this post in threaded view
|

bug#28901: 25.3; Font selector fails to remember current font and size

Robert Pluim
>>>>> On Mon, 18 Nov 2019 10:14:32 +0100, Lars Ingebrigtsen <[hidden email]> said:

    Lars> Robert Pluim <[hidden email]> writes:
    >> gtk_font_chooser_set_font? We already use that to set the default
    >> family, but we donʼt remember the size or the style.

    Lars> Yes, the problem is that apparently gtk_font_chooser_set_font doesn't
    Lars> allow you to specify those either.  Or much of anything else, for that
    Lars> matter.  At least that seemed to be the case when I looked at this some
    Lars> time back.

You canʼt directly specify them, but you can at least remember the
previous settings:

commit ccb763dc743167445c898ba56abeb2fafe1504c3
Author:     Robert Pluim <[hidden email]>
AuthorDate: Mon Nov 18 10:18:25 2019 +0100
Commit:     Robert Pluim <[hidden email]>
CommitDate: Mon Nov 18 10:18:25 2019 +0100

    Remember the full GTK font description
   
    Remember the full font description instead of just the family so that
    size/style/weight settings are preserved.
   
    * gtkutil.c (xg_get_font) [HAVE_GTK3]: Use the pango font
    description to set/get the current font (Bug#28901).

diff --git a/src/gtkutil.c b/src/gtkutil.c
index c4d2ef9d80..3447e86ccd 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -2282,7 +2282,16 @@ xg_get_font (struct frame *f, const char *default_name)
     default_name = x_last_font_name;
 
   if (default_name)
-    gtk_font_chooser_set_font (GTK_FONT_CHOOSER (w), default_name);
+    {
+#ifdef HAVE_GTK3
+      PangoFontDescription *desc
+        = pango_font_description_from_string (default_name);
+      gtk_font_chooser_set_font_desc (GTK_FONT_CHOOSER (w), desc);
+      pango_font_description_free (desc);
+#else
+      gtk_font_chooser_set_font (GTK_FONT_CHOOSER (w), default_name);
+#endif
+    }
 
   gtk_widget_set_name (w, "emacs-fontdialog");
   done = xg_dialog_run (f, w);
@@ -2306,8 +2315,10 @@ xg_get_font (struct frame *f, const char *default_name)
  QCweight, XG_WEIGHT_TO_SYMBOL (weight),
  QCslant, XG_STYLE_TO_SYMBOL (style));
 
+          char *font_desc_str = pango_font_description_to_string (desc);
+          dupstring (&x_last_font_name, font_desc_str);
+          g_free (font_desc_str);
   pango_font_description_free (desc);
-  dupstring (&x_last_font_name, family);
  }
 
 #else /* Use old font selector, which just returns the font name.  */



Reply | Threaded
Open this post in threaded view
|

bug#28901: 25.3; Font selector fails to remember current font and size

Lars Ingebrigtsen
Robert Pluim <[hidden email]> writes:

> You canʼt directly specify them, but you can at least remember the
> previous settings:

[...]

> +#ifdef HAVE_GTK3
> +      PangoFontDescription *desc
> +        = pango_font_description_from_string (default_name);
> +      gtk_font_chooser_set_font_desc (GTK_FONT_CHOOSER (w), desc);
> +      pango_font_description_free (desc);
> +#else
> +      gtk_font_chooser_set_font (GTK_FONT_CHOOSER (w), default_name);
> +#endif

Oh, cool!  Sounds good to me.  (Haven't tested the patch, though.)

--
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



Reply | Threaded
Open this post in threaded view
|

bug#28901: 25.3; Font selector fails to remember current font and size

Robert Pluim
tags 28901 fixed
close 28901 27.1
quit

>>>>> On Mon, 18 Nov 2019 10:36:33 +0100, Lars Ingebrigtsen <[hidden email]> said:

    Lars> Robert Pluim <[hidden email]> writes:
    >> You canʼt directly specify them, but you can at least remember the
    >> previous settings:

    Lars> [...]

    >> +#ifdef HAVE_GTK3
    >> +      PangoFontDescription *desc
    >> +        = pango_font_description_from_string (default_name);
    >> +      gtk_font_chooser_set_font_desc (GTK_FONT_CHOOSER (w), desc);
    >> +      pango_font_description_free (desc);
    >> +#else
    >> +      gtk_font_chooser_set_font (GTK_FONT_CHOOSER (w), default_name);
    >> +#endif

    Lars> Oh, cool!  Sounds good to me.  (Haven't tested the patch, though.)

Closing.
Committed to master as as b6db2ed1ea

Robert