alphapapa / org-ql

A searching tool for Org-mode, including custom query languages, commands, saved searches and agenda-like views, etc.
GNU General Public License v3.0
1.42k stars 110 forks source link

Change to `without-restriction` in Emacs 30 requires recompiling `org-ql-find` library #465

Open al3xandru opened 1 month ago

al3xandru commented 1 month ago

OS/platform

macOS

Emacs version and provenance

GNU Emacs 30.0.91 (build 1, aarch64-apple-darwin23.6.0, NS appkit-2487.70 Version 14.6.1 (Build 23G93)) of 2024-09-13

Installed using brew via d12frosted/emacs-plus/emacs-plus@30: stable 30.0.91

Emacs command

Launch Emacs.app

Org version and provenance

Org mode version 9.7.11 (release_9.7.11 @ /opt/homebrew/Cellar/emacs-plus@30/30.0.91/share/emacs/30.0.91/lisp/org/)

org-ql package version and provenance

org-ql-20240829.2138 via elpa using use-package

Actions taken

Using the following code:

  (defun alpo/org-goto-day ()
    "A shortcut function to jump to today entry"
    (interactive)
    (defun alpo/org-ql-find-query-filter (query)
      (message "Query: %s" query)
      (cond ((string-equal "" query)
             (message "heading:%s" (format-time-string "%Y-%m-%d %A")))
            ((string-equal "." query)
             (message "heading:%s" (format-time-string "%Y-%m-%d %A")))
            ((string-match "^-?[0-9]+" query)
             (let* ((days (string-to-number query))
                    (new-time (time-add (current-time) (* 3600 24 days)))
                    (result (format-time-string "%Y-%m-%d %A" new-time)))
               ;; (message "Days: %d, Current time: %s, New time: %s, Result: %s" days (current-time) new-time result)
               (message "heading:%s" result)))
            (t (message "heading:%s" query))
            ))
    (org-ql-find (current-buffer) :query-filter 'alpo/org-ql-find-query-filter :prompt "Enter date:"))

Observed results

org-ql-find: Symbol’s function definition is void: internal--without-restriction

Expected results

The above function works in Emacs 29.x

Backtrace

No response

Etc.

Let me know if additional details are needed. Thank you

alphapapa commented 1 month ago

Thanks for the report, but I can't offer support for unreleased versions of Emacs. As well, the symbol internal--without-restriction is not found in this package's source code. If you think that an in-development version of Emacs has introduced a bug, you should consider asking on emacs-devel or filing an Emacs bug report (but you should be careful to reproduce the problem in an empty Emacs configuration first, using the latest-available versions of all packages; see with-emacs.sh to make it easier).

Note as well that the code you shared appears to be somewhat bogus: you are calling defun within another defun. If you want to define a closure and call it, you should use cl-labels or a lambda.

al3xandru commented 1 month ago

Thanks for the suggestion to improve the code used above.

My understanding is that it is org-ql-find that ends up invoking internal--without-restriction, most probably indirectly. If that's true, that means orq-ql-find won't work in the next version of Emacs.

alphapapa commented 1 month ago

My understanding is that it is org-ql-find that ends up invoking internal--without-restriction, most probably indirectly. If that's true, that means orq-ql-find won't work in the next version of Emacs.

Since that symbol is not included in org-ql's source code, it would seem likely that whatever change is relevant would be found in another library, not in any of org-ql's.

As well, since the docstring of that function in Emacs 29 says that it's a helper for without-restriction, which is a macro, it seems likely that this is a case of running incompatible bytecode across Emacs versions, i.e. you likely need to recompile org-ql-find within the newer Emacs version (that's why I said that it's important to reproduce the problem in a clean Emacs configuration with the latest versions of packages).

alphapapa commented 1 month ago

See https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=c287a0fdc7e3f70d819ef8efd1d7922b33df164c

al3xandru commented 1 month ago

Thank you for looking into it.

How can I recompile org-ql-find? Is this a matter of removing .elc from the package so Emacs recompiles when visiting? thank you

alphapapa commented 1 month ago

See M-x package-recompile.