all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Testing font things
@ 2022-11-21 13:42 Stefan Monnier
  2022-11-21 14:12 ` Eli Zaretskii
  2022-11-22  0:24 ` Po Lu
  0 siblings, 2 replies; 7+ messages in thread
From: Stefan Monnier @ 2022-11-21 13:42 UTC (permalink / raw)
  To: emacs-devel

I'm trying to write a test for our font choice code (bug#59347)
Here's the situation so far:

- I have not been able to create a GUI frame from a `--batch` process :-(
  The process gets killed by SIGIO.  I tried to change
  `(un)request_sigio` so as to ignore `noninteractive` but without
  any success.

- So I resorted to an `--fg-daemon` (with the patch below to let me
  start a daemon without creating the server socket and waiting for
  connections).

- With this, I'm able to get pretty much what I want with:

      src/emacs -Q --fg-daemon=none -l test/src/font-tests.el \
                 -f ert-run-tests-batch

  The code in font-tests.el looks like:

      (defvar font-tests--gui-frame
        (unless noninteractive ;; I get "killed by SIGIO" in batch mode :-(
          (with-demoted-errors "%S"
            (make-frame-on-display
             (getenv "DISPLAY")
             '((visibility . nil)
               ;; Tell the window manager not to ask the user to
               ;; manually place the frame/window.
               (user-position . t)
               (left . 0)
               (top . 0)
               (no-other-frame . t))))))
      
      (defvar font-tests--dejavu-sans
        (when font-tests--gui-frame
          (list-fonts (font-spec :family "DejaVu Sans")
                      font-tests--gui-frame)))
      
      (defvar font-tests--misc-fixed
        (when font-tests--gui-frame
          (list-fonts
           (font-spec :name "-misc-fixed-*-*-semicondensed-*-13-*-*-*-*-*-*-*")
           font-tests--gui-frame)))
      
      (ert-deftest font-tests--bug59347 ()
        (skip-unless (and font-tests--misc-fixed font-tests--dejavu-sans))
        (face-spec-set
         'default
         '((t :font "-misc-fixed-*-*-semicondensed-*-13-*-*-*-*-*-*-*")))
        (face-spec-set 'font-tests-dejavu '((t :family "DejaVu Sans")))
        (with-temp-buffer
          (let ((w (frame-root-window font-tests--gui-frame)))
            (set-window-buffer w (current-buffer))
            (insert "hello " (propertize "world" 'face 'font-tests-dejavu))
            (should (member (font-at (1+ (point-min)) w)
                            font-tests--misc-fixed))
            (should (member (font-at (1- (point-max)) w)
                            font-tests--dejavu-sans)))))

  But this fails because `fonts-at` gets me a "font-object" whereas
  `list-fonts` gets me "font entities".  How can I convert one to
  the other?


-- Stefan




diff --git a/lisp/startup.el b/lisp/startup.el
index 5e0a47d3f8f..7dc35e2392c 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -390,7 +390,7 @@ user-mail-address
   "The email address of the current user.
 This defaults to either: the value of EMAIL environment variable; or
 user@host, using `user-login-name' and `mail-host-address' (or `system-name')."
-  :initialize 'custom-initialize-delay
+  :initialize #'custom-initialize-delay
   :set-after '(mail-host-address)
   :type 'string
   :group 'mail)
@@ -1613,7 +1613,11 @@ command-line
   ;; processing all command line arguments to allow e.g. `server-name'
   ;; to be changed before the server starts.
   (let ((dn (daemonp)))
-    (when dn
+    (cond
+     ((equal dn "none")
+      (message "Not starting any server; exiting")
+      (kill-emacs 1))
+     (dn
       (when (stringp dn) (setq server-name dn))
       (server-start)
       (if server-process
@@ -1623,7 +1627,7 @@ command-line
 	     "Unable to start daemon: Emacs server named %S already running"
 	     server-name)
 	  (message "Unable to start the daemon.\nAnother instance of Emacs is running the server, either as daemon or interactively.\nYou can use emacsclient to connect to that Emacs process."))
-	(kill-emacs 1))))
+	(kill-emacs 1)))))
 
   ;; Run emacs-session-restore (session management) if started by
   ;; the session manager and we have a session manager connection.




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

end of thread, other threads:[~2022-11-30 13:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-21 13:42 Testing font things Stefan Monnier
2022-11-21 14:12 ` Eli Zaretskii
2022-11-30  3:31   ` Stefan Monnier
2022-11-30  5:06     ` Stefan Kangas
2022-11-30 13:36     ` Eli Zaretskii
2022-11-22  0:24 ` Po Lu
2022-11-30  3:48   ` Stefan Monnier

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.