]> git.eshelyaron.com Git - emacs.git/commitdiff
Re-enable TTY glyph production for batch mode frames on Android
authorPo Lu <luangruo@yahoo.com>
Mon, 10 Jun 2024 03:56:24 +0000 (11:56 +0800)
committerEshel Yaron <me@eshelyaron.com>
Mon, 10 Jun 2024 07:30:26 +0000 (09:30 +0200)
* lisp/org/ob-core.el (org-babel-execute-src-block): Revert
previous change.

* src/term.c (tty_append_glyph, produce_glyphs) [HAVE_ANDROID]:
Re-enable suppressed code.

(cherry picked from commit bd80717d8e762c7559f66d297cdb6144e3f7f958)

lisp/org/ob-core.el
src/term.c

index c36cfc6384db411cf9966bef11b5fa2797a82007..d1984b2d6fecc817f4962b9de1f59b8778e26455 100644 (file)
@@ -900,49 +900,46 @@ guess will be made."
                             (not (listp r)))
                        (list (list r))
                      r)))
-            ;; XXX: remove this block once the Org Mode issue is
-            ;; resolved.
-            (ignore-errors
-             (let ((file (and (member "file" result-params)
-                              (cdr (assq :file params)))))
-               ;; If non-empty result and :file then write to :file.
-               (when file
-                 ;; If `:results' are special types like `link' or
-                 ;; `graphics', don't write result to `:file'.  Only
-                 ;; insert a link to `:file'.
-                 (when (and result
-                            (not (or (member "link" result-params)
-                                     (member "graphics" result-params))))
-                   (with-temp-file file
-                     (insert (org-babel-format-result
-                              result
-                              (cdr (assq :sep params)))))
-                   ;; Set file permissions if header argument
-                   ;; `:file-mode' is provided.
-                   (when (assq :file-mode params)
-                     (set-file-modes file (cdr (assq :file-mode params)))))
-                 (setq result file))
-               ;; Possibly perform post process provided its
-               ;; appropriate.  Dynamically bind "*this*" to the
-               ;; actual results of the block.
-               (let ((post (cdr (assq :post params))))
-                 (when post
-                   (let ((*this* (if (not file) result
-                                   (org-babel-result-to-file
-                                    file
-                                    (org-babel--file-desc params result)
-                                     'attachment))))
-                     (setq result (org-babel-ref-resolve post))
-                     (when file
-                       (setq result-params (remove "file" result-params))))))
-               (unless (member "none" result-params)
-                 (org-babel-insert-result
-                  result result-params info
-                   ;; append/prepend cannot handle hash as we accumulate
-                   ;; multiple outputs together.
-                   (when (member "replace" result-params) new-hash)
-                   lang
-                   (time-subtract (current-time) exec-start-time)))))
+           (let ((file (and (member "file" result-params)
+                            (cdr (assq :file params)))))
+             ;; If non-empty result and :file then write to :file.
+             (when file
+               ;; If `:results' are special types like `link' or
+               ;; `graphics', don't write result to `:file'.  Only
+               ;; insert a link to `:file'.
+               (when (and result
+                          (not (or (member "link" result-params)
+                                   (member "graphics" result-params))))
+                 (with-temp-file file
+                   (insert (org-babel-format-result
+                            result
+                            (cdr (assq :sep params)))))
+                 ;; Set file permissions if header argument
+                 ;; `:file-mode' is provided.
+                 (when (assq :file-mode params)
+                   (set-file-modes file (cdr (assq :file-mode params)))))
+               (setq result file))
+             ;; Possibly perform post process provided its
+             ;; appropriate.  Dynamically bind "*this*" to the
+             ;; actual results of the block.
+             (let ((post (cdr (assq :post params))))
+               (when post
+                 (let ((*this* (if (not file) result
+                                 (org-babel-result-to-file
+                                  file
+                                  (org-babel--file-desc params result)
+                                   'attachment))))
+                   (setq result (org-babel-ref-resolve post))
+                   (when file
+                     (setq result-params (remove "file" result-params))))))
+             (unless (member "none" result-params)
+               (org-babel-insert-result
+                result result-params info
+                 ;; append/prepend cannot handle hash as we accumulate
+                 ;; multiple outputs together.
+                 (when (member "replace" result-params) new-hash)
+                 lang
+                 (time-subtract (current-time) exec-start-time))))
            (run-hooks 'org-babel-after-execute-hook)
            result)))))))
 
index 351b0a4310cbdf19b4389be86c7963eac8dfebe1..1f524880054f2efdf40b78f10458f90b9ae15951 100644 (file)
@@ -1483,11 +1483,15 @@ term_get_fkeys_1 (void)
 
 \f
 
-#ifndef HAVE_ANDROID
-
 /***********************************************************************
                       Character Display Information
  ***********************************************************************/
+
+/* Glyph production must be enabled on Android despite there being no
+   TTY frames on that platform, as certain packages (and now, through
+   Org, the bootstrap) require that window text measurements be
+   available from the initial frame as in batch mode.  */
+
 static void append_glyph (struct it *);
 static void append_composite_glyph (struct it *);
 static void produce_composite_glyph (struct it *);
@@ -1561,15 +1565,11 @@ append_glyph (struct it *it)
     }
 }
 
-#endif
-
 /* For external use.  */
 void
 tty_append_glyph (struct it *it)
 {
-#ifndef HAVE_ANDROID
   append_glyph (it);
-#endif
 }
 
 /* Produce glyphs for the display element described by IT.  *IT
@@ -1594,7 +1594,6 @@ tty_append_glyph (struct it *it)
 void
 produce_glyphs (struct it *it)
 {
-#ifndef HAVE_ANDROID
   /* If a hook is installed, let it do the work.  */
 
   /* Nothing but characters are supported on terminal frames.  */
@@ -1724,11 +1723,8 @@ produce_glyphs (struct it *it)
     }
   it->ascent = it->max_ascent = it->phys_ascent = it->max_phys_ascent = 0;
   it->descent = it->max_descent = it->phys_descent = it->max_phys_descent = 1;
-#endif
 }
 
-#ifndef HAVE_ANDROID
-
 /* Append glyphs to IT's glyph_row for the composition IT->cmp_id.
    Called from produce_composite_glyph for terminal frames if
    IT->glyph_row != NULL.  IT->face_id contains the character's
@@ -1966,8 +1962,9 @@ produce_glyphless_glyph (struct it *it, Lisp_Object acronym)
 }
 
 \f
+#ifndef HAVE_ANDROID
 /***********************************************************************
-                               Faces
+                               TTY Faces
  ***********************************************************************/
 
 /* Value is non-zero if attribute ATTR may be used.  ATTR should be