[请教]在dired怎么用默认程序打开包含中文名字的文件

在dired buffer按W (browse-url-of-dired-file)可以用系统默认工具打开文件,但如果文件包含中文字符,就无法打开,也没有错误信息。

试了一下,我这里没有问题。而且这个应该只是用浏览器打开,不是用系统默认工具打开。感觉问题可能出在实际被调用的那个工作是不是编码解析有问题,或是 browse-url-browser-function 是你自己写的,里面有什么锅。

这个是Emacs自带的函数,可以用默认程序打开文件 (dired - Windows: Open files by default application - Emacs Stack Exchange

我用consult-file-externally,包了个函数,绑定到 e 上

1 个赞

可以用,已抄配制,感谢!

除了在Dired里通过一个按键来实现之外,还有一种更爽的工作流。基本思路是:

  1. consult-locate 从整个硬盘里找到你要的文件(类似Alfred,Everything)
  2. 在 minibuffer 选中某个文件后用 embark 来调用consult-file-externally

consult-locate确实也好用,之前用过,不知道为什么我后来又注释掉了。

我觉得用 consult 或者 embark 解决这个问题有点怪异。我觉得就应该给一个选项让 find-file 自己判断什么文件用什么程序打开。我自己的使用情况是,除了音频/视频和一些特定的工程文件(比如 inkscape 打开 svg 之类的), 其他文件我都是 dired/dirvish 处理的。

dirvish 有一个选项长这样:

(defcustom dirvish-open-with-programs
  '(("video/" . ("mpv" "%f"))
    ("audio/" . ("mpv" "%f"))
    (("html") . ("firefox" "%f")))
  "Association list of mimetype and external program for `find-file'.
Each element is of the form (TYPE . (CMD . ARGS)).  TYPE can be a
 string that stands for a mimetype or a list of file name
 extensions.  Once the TYPE is matched with FILENAME in
 `find-file', a subprocess according to CMD and its ARGS is
 issued to open the file outside of Emacs.  The special
 placeholder \"%f\" in the ARGS is replaced by the FILENAME at
 runtime.  Set it to nil disables this feature."
  :group 'dirvish
  :type '(alist :key-type ((choice string (repeat string)) :tag "File mimetype or extensions")
                :value-type ((repeat string) :tag "External command and args")))

通过这个选项,我开视频文件就是无脑回车。朋友们,体会一下。 Peek 2022-05-26 21-10

2 个赞

其实我选择用 consult 的方案是因为本身就装了 consult,可以直接用。另外,目前我个人也不追求文件都在 Emacs 里面管理,操作系统的文件管理器还是会用的。

所以在 dired 目录下手动按键触发打开外部文件,还是比较适合的,因为我自己知道哪些文件需要外部打开。如果自动判断的话,也没法解决全部问题,比如 .txt 和 .md 的文件,直接回车就是 Emacs 打开了,有时我需要用外部的 notepad3 typora 打开。

对于喜欢都在 Emacs 进行管理和预览文件的话,dirvish 是值得一试的。

PS:Windows 系统上,如果喜欢在 dired 里面通过外部图像器浏览图片的话,推荐安装一个 Honeyview,在 dired 中按 e 打开图片,在图片中 按x 关闭,很方便,支持的格式又多(RAW 格式都支持),性能又好,比Emacs 内置的强多了。

也不一定要用 dirvish, 这其实只是一个思路。在写 dirvish 之前我也就是一直这么用的,也就是包裹一下 find-file.

比如 .txt 和 .md 的文件,直接回车就是 Emacs 打开了,有时我需要用外部的 notepad3 typora 打开

确实,我在用 Emacs 之前有过类似的情况。后来逐渐统一了,一种文件就一种打开方式,我觉得这样比较省心。其他的情况 M-! 也够我用了。

Edit: 编辑了半天编辑到老贴上去了,蛋疼。

自动打开的话,其实有个很老的包 openwith 就实现了,支持 find-file 的。

10年都没更新了,还能用,我之前用过。 :smile:

这种好多年不更新的包我都不太敢用,怕出问题了没人管,哈哈。不过这个也不需要装什么包,50行左右就搞定了。

如果喜欢在 dired 里面通过外部图像器浏览图片的话,推荐安装一个 Honeyview,在 dired 中按 e 打开图片,在图片中 按x 关闭

你说到这个,我就很想展示一下 dirvish 的性能,最近又优化了一下。

不过我不知道 windows 上效果怎么样,说不准根本用不了。

后面有空我再加几个放大缩小旋转的功能,就不需要什么外部的图片浏览器了。

3 个赞

你这个图像预览真的强,比 ranger 厉害了 :+1:

回头用 Linux 系统时候再体验一下。

1 个赞

试了一下dirvish,感觉还不错,不过Emacs老崩溃,不知道是不是dirvish的原因。

Process:               Emacs [38864]
Path:                  /opt/homebrew/*/Emacs.app/Contents/MacOS/Emacs
Identifier:            org.gnu.Emacs
Version:               Version 28.1 (9.0)
Code Type:             ARM-64 (Native)
Parent Process:        launchd [1]
User ID:               501

Date/Time:             2022-05-27 13:17:24.0266 +0800
OS Version:            macOS 12.4 (21F79)
Report Version:        12
Anonymous UUID:        75548F30-FE51-464E-A529-3BB5F24AE882

Sleep/Wake UUID:       83140321-4B9B-41EC-B8E7-1B04379BCC53

Time Awake Since Boot: 150000 seconds
Time Since Wake:       1310 seconds

System Integrity Protection: disabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGABRT)
Exception Codes:       KERN_INVALID_ADDRESS at 0x00000000000008fb
Exception Codes:       0x0000000000000001, 0x00000000000008fb
Exception Note:        EXC_CORPSE_NOTIFY

VM Region Info: 0x8fb is not in any region.  Bytes before following region: 105553518917381
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      MALLOC_NANO (reserved)   600018000000-600020000000 [128.0M] rw-/rwx SM=NUL  ...(unallocated)

Kernel Triage:
VM - pmap_enter failed with resource shortage


Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	       0x1b6496d98 __pthread_kill + 8
1   libsystem_pthread.dylib       	       0x1b64cbee0 pthread_kill + 288
2   libsystem_c.dylib             	       0x1b63ce680 raise + 32
3   Emacs                         	       0x104c96220 terminate_due_to_signal + 204
4   Emacs                         	       0x104c9689c emacs_abort + 20
5   Emacs                         	       0x104c67b24 ns_term_shutdown + 132
6   Emacs                         	       0x104b7dad0 shut_down_emacs + 328
7   Emacs                         	       0x104c961e8 terminate_due_to_signal + 148
8   Emacs                         	       0x104b9867c handle_fatal_signal + 16
9   Emacs                         	       0x104b986f8 deliver_thread_signal + 124
10  Emacs                         	       0x104b970e0 deliver_fatal_thread_signal + 12
11  Emacs                         	       0x104b98738 handle_sigsegv + 64
12  libsystem_platform.dylib      	       0x1b64e34a4 _sigtramp + 56
13  Emacs                         	       0x104bbb67c find_newline + 444
14  Emacs                         	       0x104bbbe64 find_before_next_newline + 56
15  Emacs                         	       0x104be1394 Fline_end_position + 192
16  dired-6a3ae2bc-4d19216a.eln   	       0x17a44eed0 F64697265642d6d6f76652d746f2d66696c656e616d65_dired_move_to_filename_0 + 268
17  Emacs                         	       0x104beeb68 funcall_subr + 284
18  Emacs                         	       0x104bee334 Ffuncall + 600
19  dired-6a3ae2bc-4d19216a.eln   	       0x17a44e1fc F64697265642d6765742d66696c656e616d65_dired_get_filename_0 + 1100
20  Emacs                         	       0x104beeb68 funcall_subr + 284
21  Emacs                         	       0x104bee334 Ffuncall + 600
22  dirvish-cdf30b1c-405155b7.eln 	       0x17a3c72f8 F646972766973682d73796d6c696e6b2d6d6c_dirvish_symlink_ml_0 + 276
23  Emacs                         	       0x104beb08c eval_sub + 1064
24  Emacs                         	       0x104beda80 Feval + 100
25  Emacs                         	       0x104beeb68 funcall_subr + 284
26  Emacs                         	       0x104bee334 Ffuncall + 600
27  Emacs                         	       0x104becee8 internal_condition_case_n + 120
28  Emacs                         	       0x104afe33c safe__call + 344
29  Emacs                         	       0x104afe3f4 safe__call1 + 36
30  Emacs                         	       0x104b0be30 display_mode_element + 800
31  Emacs                         	       0x104b0d450 display_mode_element + 6464
32  Emacs                         	       0x104b0b730 Fformat_mode_line + 760
33  Emacs                         	       0x104beb194 eval_sub + 1328
34  Emacs                         	       0x104bebeac FletX + 136
35  Emacs                         	       0x104beb0b4 eval_sub + 1104
36  Emacs                         	       0x104beda80 Feval + 100
37  Emacs                         	       0x104beeb68 funcall_subr + 284
38  Emacs                         	       0x104bee334 Ffuncall + 600
39  Emacs                         	       0x104becee8 internal_condition_case_n + 120
40  Emacs                         	       0x104afe33c safe__call + 344
41  Emacs                         	       0x104afe3f4 safe__call1 + 36
42  Emacs                         	       0x104b0be30 display_mode_element + 800
43  Emacs                         	       0x104b0d450 display_mode_element + 6464
44  Emacs                         	       0x104af8794 display_mode_line + 368
45  Emacs                         	       0x104b21554 display_mode_lines + 404
46  Emacs                         	       0x104b29734 redisplay_window + 16988
47  Emacs                         	       0x104b254cc redisplay_window_0 + 44
48  Emacs                         	       0x104becb98 internal_condition_case_1 + 100
49  Emacs                         	       0x104b24aac redisplay_windows + 168
50  Emacs                         	       0x104b041ec redisplay_internal + 4652
51  Emacs                         	       0x104b83bbc read_char + 2104
52  Emacs                         	       0x104b81ea8 read_key_sequence + 1084
53  Emacs                         	       0x104b80afc command_loop_1 + 768
54  Emacs                         	       0x104becb0c internal_condition_case + 96
55  Emacs                         	       0x104b807e8 command_loop_2 + 52
56  Emacs                         	       0x104bec618 internal_catch + 88
57  Emacs                         	       0x104c96534 command_loop.cold.1 + 80
58  Emacs                         	       0x104b80178 command_loop + 156
59  Emacs                         	       0x104b80078 recursive_edit_1 + 120
60  Emacs                         	       0x104b802b0 Frecursive_edit + 288
61  Emacs                         	       0x104b7f6f0 main + 7116
62  dyld                          	       0x10522508c start + 520

Thread 1:: gmain
0   libsystem_kernel.dylib        	       0x1b6499598 __select + 8
1   libglib-2.0.0.dylib           	       0x10597dc74 g_poll + 424
2   libglib-2.0.0.dylib           	       0x105970f10 g_main_context_iterate + 336
3   libglib-2.0.0.dylib           	       0x105970fd8 g_main_context_iteration + 60
4   libglib-2.0.0.dylib           	       0x10597241c glib_worker_main + 48
5   libglib-2.0.0.dylib           	       0x105994cd4 g_thread_proxy + 68
6   libsystem_pthread.dylib       	       0x1b64cc26c _pthread_start + 148
7   libsystem_pthread.dylib       	       0x1b64c708c thread_start + 8

Thread 2:
0   libsystem_kernel.dylib        	       0x1b6499598 __select + 8
1   Emacs                         	       0x104c68ecc -[EmacsApp fd_handler:] + 200
2   Foundation                    	       0x1b747363c __NSThread__start__ + 808
3   libsystem_pthread.dylib       	       0x1b64cc26c _pthread_start + 148
4   libsystem_pthread.dylib       	       0x1b64c708c thread_start + 8

Thread 3:: com.apple.NSEventThread
0   libsystem_kernel.dylib        	       0x1b648e8b0 mach_msg_trap + 8
1   libsystem_kernel.dylib        	       0x1b648ed20 mach_msg + 76
2   CoreFoundation                	       0x1b65992b0 __CFRunLoopServiceMachPort + 372
3   CoreFoundation                	       0x1b6597760 __CFRunLoopRun + 1180
4   CoreFoundation                	       0x1b6596b24 CFRunLoopRunSpecific + 600
5   AppKit                        	       0x1b926a374 _NSEventThread + 196
6   libsystem_pthread.dylib       	       0x1b64cc26c _pthread_start + 148
7   libsystem_pthread.dylib       	       0x1b64c708c thread_start + 8

Thread 4:
0   libsystem_pthread.dylib       	       0x1b64c7078 start_wqthread + 0

Thread 5:
0   libsystem_pthread.dylib       	       0x1b64c7078 start_wqthread + 0

Thread 6:
0   libsystem_pthread.dylib       	       0x1b64c7078 start_wqthread + 0


Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000000   x1: 0x0000000000000000   x2: 0x0000000000000000   x3: 0x00000001b62db04c
    x4: 0x000060000158b200   x5: 0x0000000000000000   x6: 0x0000000000001400   x7: 0x0000000000000600
    x8: 0x2d92efc205dc47b5   x9: 0x2d92efc300f5c235  x10: 0x0000000000000001  x11: 0x020000020ee9696d
   x12: 0x0000000000000191  x13: 0x00000000b7073929  x14: 0x00000000b7274000  x15: 0x00000000000000e8
   x16: 0x0000000000000148  x17: 0x0000000210557680  x18: 0x0000000000000000  x19: 0x0000000000000006
   x20: 0x0000000105298580  x21: 0x0000000000000103  x22: 0x0000000105298660  x23: 0x00000000000000e3
   x24: 0x00000000000002c5  x25: 0x0000000000000000  x26: 0x0000000000000000  x27: 0x0000000000000001
   x28: 0x00000000000000e3   fp: 0x00000001050e2060   lr: 0x00000001b64cbee0
    sp: 0x00000001050e2040   pc: 0x00000001b6496d98 cpsr: 0x40001000
   far: 0x00000000000008fb  esr: 0x56000080  Address size fault

Binary Images:
       0x1b648d000 -        0x1b64c4fff libsystem_kernel.dylib (*) <03f48dc5-caa7-3678-af61-1a3c7fa8b06e> /usr/lib/system/libsystem_kernel.dylib
       0x1b64c5000 -        0x1b64d1fff libsystem_pthread.dylib (*) <42166a2c-89a9-3c38-a215-f028544cea23> /usr/lib/system/libsystem_pthread.dylib
       0x1b638c000 -        0x1b640dfff libsystem_c.dylib (*) <86746b94-88e3-342d-b2b2-54303404e492> /usr/lib/system/libsystem_c.dylib
       0x104ad8000 -        0x104cd7fff org.gnu.Emacs (Version 28.1) <267914ca-10d1-3d61-b4ff-d60b1392d3c5> /opt/homebrew/*/Emacs.app/Contents/MacOS/Emacs
       0x1b64df000 -        0x1b64e6fff libsystem_platform.dylib (*) <d7aba99f-ba00-36e9-945d-48acf57fc568> /usr/lib/system/libsystem_platform.dylib
       0x17a444000 -        0x17a45ffff dired-6a3ae2bc-4d19216a.eln (*) <49dc7e96-17e2-31bb-aa2a-bd0edd429038> /Users/USER/*/dired-6a3ae2bc-4d19216a.eln
       0x17a3b4000 -        0x17a3d3fff dirvish-cdf30b1c-405155b7.eln (*) <dea6ab57-1934-32ef-9f87-1bdd5a8ae640> /Users/USER/*/dirvish-cdf30b1c-405155b7.eln
       0x105220000 -        0x10527ffff dyld (*) <d9c2a46e-8dc4-3950-9d6a-f799e8ccb683> /usr/lib/dyld
       0x10593c000 -        0x105a1ffff libglib-2.0.0.dylib (*) <397aee53-70e4-3b62-a470-46c9de77d6f7> /opt/homebrew/*/libglib-2.0.0.dylib
       0x1b7417000 -        0x1b7808fff com.apple.Foundation (6.9) <a2e534d9-cdf0-397f-a41e-147559c83893> /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
       0x1b6514000 -        0x1b6a5afff com.apple.CoreFoundation (6.9) <994db908-11a1-3e43-b7df-25c09d51368a> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
       0x1b90bc000 -        0x1b9f73fff com.apple.AppKit (6.9) <a773dd23-b1c8-3c9b-9175-9a71d210ace0> /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
               0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=928.8M resident=0K(0%) swapped_out_or_unallocated=928.8M(100%)
Writable regions: Total=2.7G written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=2.7G(100%)

                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Accelerate framework               384K        3 
Activity Tracing                   256K        1 
CG backing stores                 3520K        4 
CG image                           256K       13 
ColorSync                          496K       24 
CoreAnimation                      160K        9 
CoreGraphics                        16K        1 
CoreUI image data                 1504K       10 
Foundation                          16K        1 
Kernel Alloc Once                   32K        1 
MALLOC                           585.3M      131 
MALLOC guard page                  192K       10 
MALLOC_MEDIUM (reserved)         744.0M        7         reserved VM address space (unallocated)
MALLOC_NANO (reserved)           384.0M        1         reserved VM address space (unallocated)
STACK GUARD                         96K        6 
Stack                             11.2M        7 
Stack (reserved)                  1616K        1         reserved VM address space (unallocated)
Stack Guard                       54.4M        1 
VM_ALLOCATE                        224K       14 
__AUTH                            1917K      183 
__AUTH_CONST                      11.3M      345 
__CTF                               756        1 
__DATA                             1.0G      996 
__DATA_CONST                      19.4M      697 
__DATA_DIRTY                       856K      116 
__FONT_DATA                          4K        1 
__LINKEDIT                       609.4M      563 
__OBJC_CONST                      1760K      154 
__OBJC_RO                         83.0M        1 
__OBJC_RW                         3152K        1 
__TEXT                           319.4M      921 
__UNICODE                          592K        1 
dyld private memory               1024K        1 
mapped file                        2.1G      607 
shared memory                      864K       15 
===========                     =======  ======= 
TOTAL                              5.9G     4848 
TOTAL, minus reserved VM space     4.8G     4848 



-----------
Full Report
-----------

{"app_name":"Emacs","timestamp":"2022-05-27 13:17:24.00 +0800","app_version":"Version 28.1","slice_uuid":"267914ca-10d1-3d61-b4ff-d60b1392d3c5","build_version":"9.0","platform":1,"bundleID":"org.gnu.Emacs","share_with_app_devs":0,"is_first_party":0,"bug_type":"309","os_version":"macOS 12.4 (21F79)","incident_id":"90ED164E-02AD-4B2D-A423-25F2EFB74A9E","name":"Emacs"}
{
  "uptime" : 150000,
  "procLaunch" : "2022-05-27 13:09:50.1708 +0800",
  "procRole" : "Foreground",
  "version" : 2,
  "userID" : 501,
  "deployVersion" : 210,
  "modelCode" : "MacBookPro18,3",
  "procStartAbsTime" : 3668997968401,
  "coalitionID" : 1206,
  "osVersion" : {
    "train" : "macOS 12.4",
    "build" : "21F79",
    "releaseType" : "User"
  },
  "captureTime" : "2022-05-27 13:17:24.0266 +0800",
  "incident" : "90ED164E-02AD-4B2D-A423-25F2EFB74A9E",
  "bug_type" : "309",
  "pid" : 38864,
  "procExitAbsTime" : 3679889103978,
  "translated" : false,
  "cpuType" : "ARM-64",
  "procName" : "Emacs",
  "procPath" : "\/opt\/homebrew\/*\/Emacs.app\/Contents\/MacOS\/Emacs",
  "bundleInfo" : {"CFBundleShortVersionString":"Version 28.1","CFBundleVersion":"9.0","CFBundleIdentifier":"org.gnu.Emacs"},
  "storeInfo" : {"deviceIdentifierForVendor":"C4F05C8D-7DC5-58AA-9C05-DBF43789EC38","thirdParty":true},
  "parentProc" : "launchd",
  "parentPid" : 1,
  "coalitionName" : "org.gnu.Emacs",
  "crashReporterKey" : "75548F30-FE51-464E-A529-3BB5F24AE882",
  "wakeTime" : 1310,
  "sleepWakeUUID" : "83140321-4B9B-41EC-B8E7-1B04379BCC53",
  "sip" : "disabled",
  "vmRegionInfo" : "0x8fb is not in any region.  Bytes before following region: 105553518917381\n      REGION TYPE                    START - END         [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n      UNUSED SPACE AT START\n--->  \n      MALLOC_NANO (reserved)   600018000000-600020000000 [128.0M] rw-\/rwx SM=NUL  ...(unallocated)",
  "isCorpse" : 1,
  "exception" : {"codes":"0x0000000000000001, 0x00000000000008fb","rawCodes":[1,2299],"type":"EXC_BAD_ACCESS","signal":"SIGABRT","subtype":"KERN_INVALID_ADDRESS at 0x00000000000008fb"},
  "ktriageinfo" : "VM - pmap_enter failed with resource shortage\n",
  "vmregioninfo" : "0x8fb is not in any region.  Bytes before following region: 105553518917381\n      REGION TYPE                    START - END         [ VSIZE] PRT\/MAX SHRMOD  REGION DETAIL\n      UNUSED SPACE AT START\n--->  \n      MALLOC_NANO (reserved)   600018000000-600020000000 [128.0M] rw-\/rwx SM=NUL  ...(unallocated)",
  "extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
  "faultingThread" : 0,
  "threads" : [{"triggered":true,"id":1095742,"threadState":{"x":[{"value":0},{"value":0},{"value":0},{"value":7351414860,"symbolLocation":0,"symbol":"nanov2_free_definite_size"},{"value":105553138856448},{"value":0},{"value":5120},{"value":1536},{"value":3283950694907529141},{"value":3283950699120280117},{"value":1},{"value":144115196915968365,"symbolLocation":144115188075855877,"symbol":"OBJC_CLASS_$__CFXPreferences"},{"value":401},{"value":3070703913},{"value":3072802816},{"value":232},{"value":328},{"value":8863970944},{"value":0},{"value":6},{"value":4381574528,"symbolLocation":0,"symbol":"_main_thread"},{"value":259},{"value":4381574752,"symbolLocation":224,"symbol":"_main_thread"},{"value":227},{"value":709},{"value":0},{"value":0},{"value":1},{"value":227}],"flavor":"ARM_THREAD_STATE64","lr":{"value":7353450208},"cpsr":{"value":1073745920},"fp":{"value":4379779168},"sp":{"value":4379779136},"esr":{"value":1442840704,"description":" Address size fault"},"pc":{"value":7353232792,"matchesCrashFrame":1},"far":{"value":2299}},"queue":"com.apple.main-thread","frames":[{"imageOffset":40344,"symbol":"__pthread_kill","symbolLocation":8,"imageIndex":0},{"imageOffset":28384,"symbol":"pthread_kill","symbolLocation":288,"imageIndex":1},{"imageOffset":272000,"symbol":"raise","symbolLocation":32,"imageIndex":2},{"imageOffset":1827360,"symbol":"terminate_due_to_signal","symbolLocation":204,"imageIndex":3},{"imageOffset":1829020,"symbol":"emacs_abort","symbolLocation":20,"imageIndex":3},{"imageOffset":1637156,"symbol":"ns_term_shutdown","symbolLocation":132,"imageIndex":3},{"imageOffset":678608,"symbol":"shut_down_emacs","symbolLocation":328,"imageIndex":3},{"imageOffset":1827304,"symbol":"terminate_due_to_signal","symbolLocation":148,"imageIndex":3},{"imageOffset":788092,"symbol":"handle_fatal_signal","symbolLocation":16,"imageIndex":3},{"imageOffset":788216,"symbol":"deliver_thread_signal","symbolLocation":124,"imageIndex":3},{"imageOffset":782560,"symbol":"deliver_fatal_thread_signal","symbolLocation":12,"imageIndex":3},{"imageOffset":788280,"symbol":"handle_sigsegv","symbolLocation":64,"imageIndex":3},{"imageOffset":17572,"symbol":"_sigtramp","symbolLocation":56,"imageIndex":4},{"imageOffset":931452,"symbol":"find_newline","symbolLocation":444,"imageIndex":3},{"imageOffset":933476,"symbol":"find_before_next_newline","symbolLocation":56,"imageIndex":3},{"imageOffset":1086356,"symbol":"Fline_end_position","symbolLocation":192,"imageIndex":3},{"imageOffset":44752,"symbol":"F64697265642d6d6f76652d746f2d66696c656e616d65_dired_move_to_filename_0","symbolLocation":268,"imageIndex":5},{"imageOffset":1141608,"symbol":"funcall_subr","symbolLocation":284,"imageIndex":3},{"imageOffset":1139508,"symbol":"Ffuncall","symbolLocation":600,"imageIndex":3},{"imageOffset":41468,"symbol":"F64697265642d6765742d66696c656e616d65_dired_get_filename_0","symbolLocation":1100,"imageIndex":5},{"imageOffset":1141608,"symbol":"funcall_subr","symbolLocation":284,"imageIndex":3},{"imageOffset":1139508,"symbol":"Ffuncall","symbolLocation":600,"imageIndex":3},{"imageOffset":78584,"symbol":"F646972766973682d73796d6c696e6b2d6d6c_dirvish_symlink_ml_0","symbolLocation":276,"imageIndex":6},{"imageOffset":1126540,"symbol":"eval_sub","symbolLocation":1064,"imageIndex":3},{"imageOffset":1137280,"symbol":"Feval","symbolLocation":100,"imageIndex":3},{"imageOffset":1141608,"symbol":"funcall_subr","symbolLocation":284,"imageIndex":3},{"imageOffset":1139508,"symbol":"Ffuncall","symbolLocation":600,"imageIndex":3},{"imageOffset":1134312,"symbol":"internal_condition_case_n","symbolLocation":120,"imageIndex":3},{"imageOffset":156476,"symbol":"safe__call","symbolLocation":344,"imageIndex":3},{"imageOffset":156660,"symbol":"safe__call1","symbolLocation":36,"imageIndex":3},{"imageOffset":212528,"symbol":"display_mode_element","symbolLocation":800,"imageIndex":3},{"imageOffset":218192,"symbol":"display_mode_element","symbolLocation":6464,"imageIndex":3},{"imageOffset":210736,"symbol":"Fformat_mode_line","symbolLocation":760,"imageIndex":3},{"imageOffset":1126804,"symbol":"eval_sub","symbolLocation":1328,"imageIndex":3},{"imageOffset":1130156,"symbol":"FletX","symbolLocation":136,"imageIndex":3},{"imageOffset":1126580,"symbol":"eval_sub","symbolLocation":1104,"imageIndex":3},{"imageOffset":1137280,"symbol":"Feval","symbolLocation":100,"imageIndex":3},{"imageOffset":1141608,"symbol":"funcall_subr","symbolLocation":284,"imageIndex":3},{"imageOffset":1139508,"symbol":"Ffuncall","symbolLocation":600,"imageIndex":3},{"imageOffset":1134312,"symbol":"internal_condition_case_n","symbolLocation":120,"imageIndex":3},{"imageOffset":156476,"symbol":"safe__call","symbolLocation":344,"imageIndex":3},{"imageOffset":156660,"symbol":"safe__call1","symbolLocation":36,"imageIndex":3},{"imageOffset":212528,"symbol":"display_mode_element","symbolLocation":800,"imageIndex":3},{"imageOffset":218192,"symbol":"display_mode_element","symbolLocation":6464,"imageIndex":3},{"imageOffset":133012,"symbol":"display_mode_line","symbolLocation":368,"imageIndex":3},{"imageOffset":300372,"symbol":"display_mode_lines","symbolLocation":404,"imageIndex":3},{"imageOffset":333620,"symbol":"redisplay_window","symbolLocation":16988,"imageIndex":3},{"imageOffset":316620,"symbol":"redisplay_window_0","symbolLocation":44,"imageIndex":3},{"imageOffset":1133464,"symbol":"internal_condition_case_1","symbolLocation":100,"imageIndex":3},{"imageOffset":314028,"symbol":"redisplay_windows","symbolLocation":168,"imageIndex":3},{"imageOffset":180716,"symbol":"redisplay_internal","symbolLocation":4652,"imageIndex":3},{"imageOffset":703420,"symbol":"read_char","symbolLocation":2104,"imageIndex":3},{"imageOffset":695976,"symbol":"read_key_sequence","symbolLocation":1084,"imageIndex":3},{"imageOffset":690940,"symbol":"command_loop_1","symbolLocation":768,"imageIndex":3},{"imageOffset":1133324,"symbol":"internal_condition_case","symbolLocation":96,"imageIndex":3},{"imageOffset":690152,"symbol":"command_loop_2","symbolLocation":52,"imageIndex":3},{"imageOffset":1132056,"symbol":"internal_catch","symbolLocation":88,"imageIndex":3},{"imageOffset":1828148,"symbol":"command_loop.cold.1","symbolLocation":80,"imageIndex":3},{"imageOffset":688504,"symbol":"command_loop","symbolLocation":156,"imageIndex":3},{"imageOffset":688248,"symbol":"recursive_edit_1","symbolLocation":120,"imageIndex":3},{"imageOffset":688816,"symbol":"Frecursive_edit","symbolLocation":288,"imageIndex":3},{"imageOffset":685808,"symbol":"main","symbolLocation":7116,"imageIndex":3},{"imageOffset":20620,"symbol":"start","symbolLocation":520,"imageIndex":7}]},{"id":1095748,"name":"gmain","frames":[{"imageOffset":50584,"symbol":"__select","symbolLocation":8,"imageIndex":0},{"imageOffset":269428,"symbol":"g_poll","symbolLocation":424,"imageIndex":8},{"imageOffset":216848,"symbol":"g_main_context_iterate","symbolLocation":336,"imageIndex":8},{"imageOffset":217048,"symbol":"g_main_context_iteration","symbolLocation":60,"imageIndex":8},{"imageOffset":222236,"symbol":"glib_worker_main","symbolLocation":48,"imageIndex":8},{"imageOffset":363732,"symbol":"g_thread_proxy","symbolLocation":68,"imageIndex":8},{"imageOffset":29292,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":1},{"imageOffset":8332,"symbol":"thread_start","symbolLocation":8,"imageIndex":1}]},{"id":1095766,"frames":[{"imageOffset":50584,"symbol":"__select","symbolLocation":8,"imageIndex":0},{"imageOffset":1642188,"symbol":"-[EmacsApp fd_handler:]","symbolLocation":200,"imageIndex":3},{"imageOffset":378428,"symbol":"__NSThread__start__","symbolLocation":808,"imageIndex":9},{"imageOffset":29292,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":1},{"imageOffset":8332,"symbol":"thread_start","symbolLocation":8,"imageIndex":1}]},{"id":1095772,"name":"com.apple.NSEventThread","frames":[{"imageOffset":6320,"symbol":"mach_msg_trap","symbolLocation":8,"imageIndex":0},{"imageOffset":7456,"symbol":"mach_msg","symbolLocation":76,"imageIndex":0},{"imageOffset":545456,"symbol":"__CFRunLoopServiceMachPort","symbolLocation":372,"imageIndex":10},{"imageOffset":538464,"symbol":"__CFRunLoopRun","symbolLocation":1180,"imageIndex":10},{"imageOffset":535332,"symbol":"CFRunLoopRunSpecific","symbolLocation":600,"imageIndex":10},{"imageOffset":1762164,"symbol":"_NSEventThread","symbolLocation":196,"imageIndex":11},{"imageOffset":29292,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":1},{"imageOffset":8332,"symbol":"thread_start","symbolLocation":8,"imageIndex":1}]},{"id":1097882,"frames":[{"imageOffset":8312,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":1}]},{"id":1099088,"frames":[{"imageOffset":8312,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":1}]},{"id":1099118,"frames":[{"imageOffset":8312,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":1}]}],
  "usedImages" : [
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 7353192448,
    "size" : 229376,
    "uuid" : "03f48dc5-caa7-3678-af61-1a3c7fa8b06e",
    "path" : "\/usr\/lib\/system\/libsystem_kernel.dylib",
    "name" : "libsystem_kernel.dylib"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 7353421824,
    "size" : 53248,
    "uuid" : "42166a2c-89a9-3c38-a215-f028544cea23",
    "path" : "\/usr\/lib\/system\/libsystem_pthread.dylib",
    "name" : "libsystem_pthread.dylib"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 7352139776,
    "size" : 532480,
    "uuid" : "86746b94-88e3-342d-b2b2-54303404e492",
    "path" : "\/usr\/lib\/system\/libsystem_c.dylib",
    "name" : "libsystem_c.dylib"
  },
  {
    "source" : "P",
    "arch" : "arm64",
    "base" : 4373446656,
    "CFBundleShortVersionString" : "Version 28.1",
    "CFBundleIdentifier" : "org.gnu.Emacs",
    "size" : 2097152,
    "uuid" : "267914ca-10d1-3d61-b4ff-d60b1392d3c5",
    "path" : "\/opt\/homebrew\/*\/Emacs.app\/Contents\/MacOS\/Emacs",
    "name" : "Emacs",
    "CFBundleVersion" : "9.0"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 7353528320,
    "size" : 32768,
    "uuid" : "d7aba99f-ba00-36e9-945d-48acf57fc568",
    "path" : "\/usr\/lib\/system\/libsystem_platform.dylib",
    "name" : "libsystem_platform.dylib"
  },
  {
    "source" : "P",
    "arch" : "arm64",
    "base" : 6346260480,
    "size" : 114688,
    "uuid" : "49dc7e96-17e2-31bb-aa2a-bd0edd429038",
    "path" : "\/Users\/USER\/*\/dired-6a3ae2bc-4d19216a.eln",
    "name" : "dired-6a3ae2bc-4d19216a.eln"
  },
  {
    "source" : "P",
    "arch" : "arm64",
    "base" : 6345670656,
    "size" : 131072,
    "uuid" : "dea6ab57-1934-32ef-9f87-1bdd5a8ae640",
    "path" : "\/Users\/USER\/*\/dirvish-cdf30b1c-405155b7.eln",
    "name" : "dirvish-cdf30b1c-405155b7.eln"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 4381081600,
    "size" : 393216,
    "uuid" : "d9c2a46e-8dc4-3950-9d6a-f799e8ccb683",
    "path" : "\/usr\/lib\/dyld",
    "name" : "dyld"
  },
  {
    "source" : "P",
    "arch" : "arm64",
    "base" : 4388536320,
    "size" : 933888,
    "uuid" : "397aee53-70e4-3b62-a470-46c9de77d6f7",
    "path" : "\/opt\/homebrew\/*\/libglib-2.0.0.dylib",
    "name" : "libglib-2.0.0.dylib"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 7369486336,
    "CFBundleShortVersionString" : "6.9",
    "CFBundleIdentifier" : "com.apple.Foundation",
    "size" : 4136960,
    "uuid" : "a2e534d9-cdf0-397f-a41e-147559c83893",
    "path" : "\/System\/Library\/Frameworks\/Foundation.framework\/Versions\/C\/Foundation",
    "name" : "Foundation",
    "CFBundleVersion" : "1863"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 7353745408,
    "CFBundleShortVersionString" : "6.9",
    "CFBundleIdentifier" : "com.apple.CoreFoundation",
    "size" : 5533696,
    "uuid" : "994db908-11a1-3e43-b7df-25c09d51368a",
    "path" : "\/System\/Library\/Frameworks\/CoreFoundation.framework\/Versions\/A\/CoreFoundation",
    "name" : "CoreFoundation",
    "CFBundleVersion" : "1863"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 7399522304,
    "CFBundleShortVersionString" : "6.9",
    "CFBundleIdentifier" : "com.apple.AppKit",
    "size" : 15433728,
    "uuid" : "a773dd23-b1c8-3c9b-9175-9a71d210ace0",
    "path" : "\/System\/Library\/Frameworks\/AppKit.framework\/Versions\/C\/AppKit",
    "name" : "AppKit",
    "CFBundleVersion" : "2113.50.132"
  },
  {
    "size" : 0,
    "source" : "A",
    "base" : 0,
    "uuid" : "00000000-0000-0000-0000-000000000000"
  }
],
  "sharedCache" : {
  "base" : 7350124544,
  "size" : 3136077824,
  "uuid" : "513553bb-5ca5-3b9e-a613-b0603ffe3038"
},
  "vmSummary" : "ReadOnly portion of Libraries: Total=928.8M resident=0K(0%) swapped_out_or_unallocated=928.8M(100%)\nWritable regions: Total=2.7G written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=2.7G(100%)\n\n                                VIRTUAL   REGION \nREGION TYPE                        SIZE    COUNT (non-coalesced) \n===========                     

从这个日志来看,有这个可能性。不过这种崩溃更可能是涉及到你的 Emacs build (比如是不是加了 --with-no-title-bar 之类的) 或者 macOS 本身。

我用的Emacs-plus, 好像只用了 --with-native-comp这个选项。另外我的HEIC格式的图片几乎都没法预览,需要额外配制的?

因为 Emacs 自己打不开 :crying_cat_face: 除了这个格式还有吗? heic 的我刚刚加上了,现在应该可以了。

好像还是不可以,有错误

Type C-c C-c or C-c C-x to view the image as text or hex.
Error during redisplay: (eval (let* ((dv (dirvish-curr)) (buf (alist-get (dv-index-dir dv) (dv-root-dir-buf-alist dv) nil nil #'equal)) (scale 1) (win-width (floor (/ (window-width) scale))) (str-l (format-mode-line '((:eval (dirvish-path-ml dv))) nil nil buf)) (str-r (format-mode-line 'nil nil nil buf)) (len-l (1- (length str-l))) (len-r (string-width str-r)) (str-width (+ (string-width str-l) len-r)) (filling-spaces (propertize " " 'display `((space :align-to (- (+ right right-fringe right-margin) ,(ceiling (* scale (string-width str-r))))))))) (concat (dirvish--bar-image (dv-layout dv) t) (if (< str-width win-width) str-l (let ((trim (1- (- win-width len-r)))) (if (>= trim 0) (substring str-l 0 (min trim len-l)) ""))) filling-spaces str-r))) signaled (wrong-type-argument dirvish nil) [2 times]

是怎么个不行啊? 这个报错和预览没关系。

你能把你界面截个图看看吗

其他格式可以,就HEIC不行,是不是需要额外配制。左边的窗口还有点大,覆盖了部分modelline.