emacs-diffs
[Top][All Lists]
Advanced

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

master 237cadf2468: Properly detect content files in Doc View


From: Po Lu
Subject: master 237cadf2468: Properly detect content files in Doc View
Date: Fri, 8 Sep 2023 04:12:37 -0400 (EDT)

branch: master
commit 237cadf2468e04deefcc69887981b7e144dfb206
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Properly detect content files in Doc View
    
    * lisp/doc-view.el (doc-view-mode): Detect if file name starts
    with /content or /assets, and don't regard it as available to
    subprocesses in that case.
---
 lisp/doc-view.el | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index e25e63a97ee..b856b09c8b7 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -2238,8 +2238,15 @@ toggle between displaying the document or editing it as 
text.
                   ;; supposed to return nil for things like local files 
accessed
                   ;; via `su' or via file://...
                   ((let ((file-name-handler-alist nil))
-                     (not (and buffer-file-name
-                               (file-readable-p buffer-file-name))))
+                     (or (not (and buffer-file-name
+                                   (file-readable-p buffer-file-name)))
+                         ;; If the system is Android and the file name
+                         ;; begins with /content or /assets, it's not
+                         ;; readable by local processes.
+                         (and (eq system-type 'android)
+                              (string-match-p "/\\(content\\|assets\\)[/$]"
+                                              (expand-file-name
+                                               buffer-file-name)))))
                    ;; FIXME: there's a risk of name conflicts here.
                    (expand-file-name
                     (if buffer-file-name



reply via email to

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