From 365a91622e093fe0fb74b7fee3ff7cc4a0025611 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Sun, 2 Mar 2025 08:03:04 +0100 Subject: [PATCH 1/4] ; (completion-preview--try-table): Propagate extra properties. * lisp/completion-preview.el (completion-preview--try-table): Let-bind 'completion-extra-properties' to completion properties that the completion backend (capf) provides, so that these properties take effect when querying the completion table. * test/lisp/completion-preview-tests.el (completion-preview-propagates-properties): Add test. --- lisp/completion-preview.el | 1 + test/lisp/completion-preview-tests.el | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/lisp/completion-preview.el b/lisp/completion-preview.el index 505cf45f48d..1c524985f05 100644 --- a/lisp/completion-preview.el +++ b/lisp/completion-preview.el @@ -293,6 +293,7 @@ candidates or if there are multiple matching completions and ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (let* ((pred (plist-get props :predicate)) (string (buffer-substring beg end)) + (completion-extra-properties props) (md (completion-metadata string table pred)) (sort-fn (or (completion-metadata-get md 'cycle-sort-function) (completion-metadata-get md 'display-sort-function) diff --git a/test/lisp/completion-preview-tests.el b/test/lisp/completion-preview-tests.el index d7694492056..b8a45f00cb5 100644 --- a/test/lisp/completion-preview-tests.el +++ b/test/lisp/completion-preview-tests.el @@ -306,4 +306,17 @@ instead." (should exit-fn-called) (should (equal exit-fn-args '("foobar" finished)))))) +(ert-deftest completion-preview-propagates-properties () + "Test the completion metadata handling of Completion Preview mode." + (with-temp-buffer + (setq-local + completion-preview-sort-function #'minibuffer-sort-alphabetically + completion-at-point-functions + (list (completion-preview-tests--capf '("foobaz" "foobar") + :display-sort-function #'identity))) + (insert "foo") + (let ((this-command 'self-insert-command)) + (completion-preview--post-command)) + (completion-preview-tests--check-preview "baz" 'completion-preview-common))) + ;;; completion-preview-tests.el ends here From b09bbf22afda57cbf96870c68eb31264a4ced482 Mon Sep 17 00:00:00 2001 From: Po Lu Date: Tue, 4 Mar 2025 14:24:56 +0800 Subject: [PATCH 2/4] Document requirements respecting XDG MIME databases on Android * doc/emacs/android.texi (Android Software): State that librsvg requires a MIME database to display embedded images, and how to acquire such a database. --- doc/emacs/android.texi | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/doc/emacs/android.texi b/doc/emacs/android.texi index 568fd8022d1..560c348db49 100644 --- a/doc/emacs/android.texi +++ b/doc/emacs/android.texi @@ -1203,3 +1203,45 @@ installation within Emacs's home directory. In addition to the projects mentioned above, statically linked binaries for most Linux kernel-based systems can also be run on Android. + +@cindex XDG MIME database, Android +@cindex displaying SVG images with embeds, Android + Emacs can be configured with support for viewing SVG image files by +means of the @code{librsvg} library. In SVG files, there may be +references to other images on the file-system, whose format +@code{librsvg} cannot detect by default, and which will be rendered as +blank squares unless an XDG-compliant @dfn{MIME database} is installed +into the directory @file{.local/share/mime} within your home directory. + + As the XDG @code{shared-mime-info} tools must be available to generate +such a database, it is recommended to produce this database in a +temporary directory on a GNU/Linux or Unix system, before transferring +the same to the recipient Android device. With the latest release of +@code{shared-mime-info} installed, create a temporary directory in which +to generate the MIME database, copy the default +@file{freedesktop.org.in} MIME catalog to a folder named +@file{packages}, and execute @code{update-mime-info} to generate the +database: + +@example +$ mkdir -p my-mime-database/packages +$ cp /usr/share/mime/packages/freedesktop.org.xml my-mime-database/packages +$ update-mime-info my-mime-database +@end example + +This may print a series of notices stating that the MIME database +specified is not in the search path on your host system, which are of no +consequence. Proceed by transferring the contents of the MIME database +to the recipient system, e.g., to +@code{/sdcard/Download/my-mime-database.tar.gz}: + +@example +$ cd; mkdir -p .local/share +$ tar xfz /sdcard/Download/my-mime-database.tar.gz +$ mv my-mime-database .local/share/mime +$ rm /sdcard/Download/my-mime-database.tar.gz +@end example + +If your Emacs session has already attempted to display an SVG image with +embeds, Emacs must be restarted before the new MIME database will enter +into effect. From dcfbf7d1863fdba0329dcefa73c6ec15eb8046cf Mon Sep 17 00:00:00 2001 From: Po Lu Date: Tue, 4 Mar 2025 14:29:35 +0800 Subject: [PATCH 3/4] ; * etc/PROBLEMS: Document the same problem here. --- etc/PROBLEMS | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/etc/PROBLEMS b/etc/PROBLEMS index 748d712c843..b76c7789e54 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -3849,6 +3849,16 @@ executing: $ adb shell appops set --uid org.gnu.emacs MANAGE_EXTERNAL_STORAGE allow +** Images embedded in SVG files are invisible. + +This is a product of librsvg's failing to locate a suitable MIME +database enabling it automatically to detect image file formats. The +procedure by which to obtain such a database is documented in the node +'(emacs)Android Software' in the Emacs manual; you may also download a +pre-compiled MIME database from this SourceForge repository: + + https://sourceforge.net/projects/android-ports-for-gnu-emacs/files/mime-database.tar.gz/download + * Build-time problems ** Configuration From 1b80bc67aadd01de00b7911ae32bf5d91b262a8a Mon Sep 17 00:00:00 2001 From: Po Lu Date: Tue, 4 Mar 2025 14:30:31 +0800 Subject: [PATCH 4/4] ; * doc/emacs/android.texi (Android Software): Minor markup nits. --- doc/emacs/android.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/emacs/android.texi b/doc/emacs/android.texi index 560c348db49..c318373536a 100644 --- a/doc/emacs/android.texi +++ b/doc/emacs/android.texi @@ -1219,7 +1219,7 @@ temporary directory on a GNU/Linux or Unix system, before transferring the same to the recipient Android device. With the latest release of @code{shared-mime-info} installed, create a temporary directory in which to generate the MIME database, copy the default -@file{freedesktop.org.in} MIME catalog to a folder named +@file{freedesktop.org.in} MIME catalog to a directory named @file{packages}, and execute @code{update-mime-info} to generate the database: @@ -1233,7 +1233,7 @@ This may print a series of notices stating that the MIME database specified is not in the search path on your host system, which are of no consequence. Proceed by transferring the contents of the MIME database to the recipient system, e.g., to -@code{/sdcard/Download/my-mime-database.tar.gz}: +@file{/sdcard/Download/my-mime-database.tar.gz}: @example $ cd; mkdir -p .local/share