emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/hyperbole 7cacbce103: Fix issues with batch native comp


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 7cacbce103: Fix issues with batch native compiling (make eln)
Date: Sun, 19 Jun 2022 16:57:34 -0400 (EDT)

branch: externals/hyperbole
commit 7cacbce103d1f9dfa5685156161b096f8d2302c0
Author: Bob Weiner <rsw@gnu.org>
Commit: Bob Weiner <rsw@gnu.org>

    Fix issues with batch native compiling (make eln)
    
    Add load-hyperbole target to test loading every hyperbole .el file.
    
    Fix key series shell cmd delay issue.
---
 ChangeLog          | 17 +++++++++++++++++
 Makefile           | 29 ++++++++++++++++++++---------
 hui-treemacs.el    | 18 +++++++++++++-----
 hypb.el            | 11 +++++------
 test/demo-tests.el | 11 +++++++----
 5 files changed, 62 insertions(+), 24 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0763f54b87..c4d5604869 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2022-06-19  Bob Weiner  <rsw@gnu.org>
+
+* hui-treemacs.el: Change to load and compile only when the treemacs package is
+    installed (rather than triggering an error if this is loaded when treemacs
+    is missing, since this can happen when building/compiling Hyperbole).
+
+* Makefile (BATCHFLAGS): Output emacs version, sys and path information.
+           (LOAD_EL): Add to gen cmd line args to load all Hyperbole .el files.
+           (load-hyperbole): Add to allow testing of loading all of Hyperbole.
+           (eln): Use LOAD_EL and remove autoloads loading prior to native 
compiling.
+
+* test/demo-tests.el (fast-demo-key-series-shell-apropos): Fix to handle shell 
startup delay.
+
+* hypb.el (hypb:function-copy): Since many functions may become primitives
+    when using the native compiler, return the primitive function in such
+    cases rather than triggering an error.
+
 2022-06-19  Mats Lidell  <matsl@gnu.org>
 
 * hui-select.el: Remove mention of Emacs versions in comment.
diff --git a/Makefile b/Makefile
index 81cff66916..7bb7abadf8 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@
 # Author:       Bob Weiner
 #
 # Orig-Date:    15-Jun-94 at 03:42:38
-# Last-Mod:     19-Jun-22 at 10:55:03 by Bob Weiner
+# Last-Mod:     19-Jun-22 at 15:47:27 by Bob Weiner
 #
 # Copyright (C) 1994-2022  Free Software Foundation, Inc.
 # See the file HY-COPY for license information.
@@ -58,6 +58,8 @@
 #                    make src     - setup to run directly from .el files
 #                  or
 #                    make bin     - setup to build and run from .elc files
+#                  or
+#                    make eln     - setup to build and run from .eln natively 
compiled files
 #
 #               The Hyperbole Manual is included in the package in four forms:
 #                  "man/hyperbole.info"   - GNU browsable version
@@ -86,7 +88,8 @@
 HYPB_VERSION = 8.0.1pre
 
 # Emacs executable used to byte-compile .el files into .elc's.
-# Possibilities include: emacs, infodock, etc.
+# To override which executable is used from the commandline, do something like 
this:
+#  make EMACS=/Applications/Emacs28-nativecomp.app/Contents/MacOS/Emacs bin
 EMACS = \emacs
 
 # Site-specific Emacs Lisp libraries to load before byte-compiling any files
@@ -162,7 +165,9 @@ HYPB_WEB_REPO_LOCATION = "../hyweb/hyperbole/"
 PRELOADS = $(SITE_PRELOADS) -l ./hload-path.el -l ./hversion.el -l 
./hyperbole.el 
 
 # Compile in batch mode.  Load site-lisp/site-start.el, which may set 
load-path.
-BATCHFLAGS = -batch -Q --eval "(setq debug-on-error t)"
+# Show complete expression; do not abbreviate any exprs in batch logs with ...
+BATCHFLAGS = -batch -Q --eval "(progn (setq debug-on-error t) (setq 
backtrace-line-length 0) \
+                                 (message \"  emacs-version = %s\n  
system-configuration = %s\n  emacs = %s%s\" emacs-version system-configuration 
invocation-directory invocation-name))"
 
 EMACS_BATCH=$(EMACS) $(BATCHFLAGS) $(PRELOADS)
 
@@ -303,14 +308,20 @@ bin: src
        $(RM) *.elc kotl/*.elc
        $(EMACS_BATCH) --eval="(setq-default byte-compile-warnings '(not 
docstrings))" \
                -f batch-byte-compile $(EL_KOTL) $(EL_COMPILE)
+
+# Create -l "file.el" load-file command-line args for each Hyperbole .el file 
for use in
+# eln native compile target below.
+LOAD_EL = $(shell echo "$(EL_KOTL) $(EL_COMPILE)" | sed - -e 's+ +" -l "./+g' 
-e 's+^+-l "+')"
+
+load-hyperbole:
+       $(EMACS_BATCH) \
+          $(LOAD_EL)
+
 eln: src
        $(EMACS_BATCH) \
-         --eval="(progn \
-                   (setq-default byte-compile-warnings '(not docstrings)) \
-                   (load \"hyperbole-autoloads\") \
-                    (load \"kotl/kotl-autoloads\") \
-                   (mapc #'load-file '($(EL_COMPILE) $(EL_KOTL)))" \
-               -f batch-native-compile $(EL_KOTL) $(EL_COMPILE)
+          $(LOAD_EL) \
+         --eval="(setq-default byte-compile-warnings '(not docstrings))" \
+         -f batch-native-compile $(EL_KOTL) $(EL_COMPILE)
 
 # Byte compile files but apply a filter for either including or
 # removing warnings.  See variable {C-hv byte-compile-warnings RET} for
diff --git a/hui-treemacs.el b/hui-treemacs.el
index a107dac8b7..efcb80733b 100644
--- a/hui-treemacs.el
+++ b/hui-treemacs.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:    19-Nov-17
-;; Last-Mod:     24-Jan-22 at 00:18:48 by Bob Weiner
+;; Last-Mod:     19-Jun-22 at 13:58:47 by Bob Weiner
 ;;
 ;; Copyright (C) 2017-2021  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -11,18 +11,25 @@
 ;; This file is part of GNU Hyperbole.
 
 ;;; Commentary:
+;; Ignore loading of this file unless the Treemacs package v2 or
+;; greater has been installed.
 
 ;;; Code:
 ;;; ************************************************************************
 ;;; Other required Elisp libraries
 ;;; ************************************************************************
 
-(eval-and-compile (require 'treemacs nil t))
+(when (or (require 'treemacs nil t)
+         (and (require 'package)
+              (package-installed-p 'treemacs)
+              (package-activate 'treemacs)))
+
+(require 'treemacs)
 
 (defvar treemacs-version)
 
-(unless (and (featurep 'treemacs) (string-greaterp treemacs-version "v2"))
-  (error "(hui-treemacs): Hyperbole requires Treemacs package version 2.0 or 
greater"))
+(unless (string-greaterp treemacs-version "v2")
+  (error "(hui-treemacs): Hyperbole requires Treemacs package version 2.0 or 
greater, not %s" treemacs-version))
 
 ;;; ************************************************************************
 ;;; Public declarations
@@ -92,7 +99,7 @@ If key is pressed:
 
 ;;;###autoload
 (defun smart-treemacs-modeline ()
-  "Toggle display of Treemacs file viewer based on Smart Action Key click on a 
modeline.
+  "Toggle display of Treemacs from Smart Action Key click on a modeline.
 
 When pressed on the Treemacs buffer modeline or Treemacs is displaying
 the default directory of the buffer modeline clicked upon, then
@@ -122,3 +129,4 @@ Suitable for use as a value of 
`action-key-modeline-buffer-id-function'."
 
 (provide 'hui-treemacs)
 ;;; hui-treemacs.el ends here
+)
diff --git a/hypb.el b/hypb.el
index 32d9724cc7..38c24f6a5f 100644
--- a/hypb.el
+++ b/hypb.el
@@ -3,7 +3,7 @@
 ;; Author:       Bob Weiner
 ;;
 ;; Orig-Date:     6-Oct-91 at 03:42:38
-;; Last-Mod:      5-Jun-22 at 17:59:19 by Bob Weiner
+;; Last-Mod:     19-Jun-22 at 14:50:52 by Bob Weiner
 ;;
 ;; Copyright (C) 1991-2022  Free Software Foundation, Inc.
 ;; See the "HY-COPY" file for license information.
@@ -357,12 +357,11 @@ Return either the modified string or the original ARG 
when not modified."
     arg))
 
 (defun hypb:function-copy (func-symbol)
-  "Copy FUNC-SYMBOL's body for overloading.  Return a copy of the body."
+  "Copy FUNC-SYMBOL's body for overloading.  Return a copy of the body or the 
original if a subr/primitive."
   (if (fboundp func-symbol)
       (let ((func (hypb:indirect-function func-symbol)))
        (cond ((listp func) (copy-sequence func))
-             ((subrp func) (error "(hypb:function-copy): `%s' is a primitive; 
can't copy body"
-                                  func-symbol))
+             ((subrp func) func)
              ((and (hypb:emacs-byte-code-p func) (fboundp 'make-byte-code))
               (let ((new-code (append func nil))) ; turn it into a list
                 (apply 'make-byte-code new-code)))
@@ -375,8 +374,8 @@ Return either the modified string or the original ARG when 
not modified."
   (let ((old-func-sym (intern
                        (concat "hypb--old-"
                                (symbol-name func-sym)))))
-    (or (fboundp old-func-sym)
-       (defalias old-func-sym (hypb:function-copy func-sym)))
+    (unless (fboundp old-func-sym)
+      (defalias old-func-sym (hypb:function-copy func-sym)))
     (let* ((old-func (hypb:indirect-function old-func-sym))
           (old-param-list (action:params old-func))
           (param-list (action:param-list old-func))
diff --git a/test/demo-tests.el b/test/demo-tests.el
index 2191e6d0ff..055557f684 100644
--- a/test/demo-tests.el
+++ b/test/demo-tests.el
@@ -580,10 +580,13 @@ enough files with matching mode loaded."
           (action-key)
           (hy-test-helpers:consume-input-events)
           (with-current-buffer shell-buffer-name
-            (with-timeout (5 (ert-fail "Test timed out"))
-              (while (not (string-match-p "\ngrep \(1\).*-" 
(buffer-substring-no-properties (point-min) (point-max))))
-                (accept-process-output (get-buffer-process 
shell-buffer-name))))
-            (should (string-match-p "\ngrep \(1\).*-" 
(buffer-substring-no-properties (point-min) (point-max))))))
+           (let ((buf-len (point-max)))
+             (sleep-for 0.1)
+             (while (/= buf-len (point-max))
+               (setq buf-len (point-max))
+               (accept-process-output)
+               (sleep-for 0.1)))
+            (should (string-match-p "\ngrep\(1\).*-" 
(buffer-substring-no-properties (point-min) (point-max))))))
       (set-process-query-on-exit-flag (get-buffer-process shell-buffer-name) 
nil)
       (kill-buffer shell-buffer-name))))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]