[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#71270: 30.0.50; Execute dired-do-shell-command will encounter 'wrong
From: |
Eli Zaretskii |
Subject: |
bug#71270: 30.0.50; Execute dired-do-shell-command will encounter 'wrong-type-argument stringp nil' error |
Date: |
Thu, 30 May 2024 09:52:05 +0300 |
> From: Yuwei Tian <fishtai0@gmail.com>
> Date: Thu, 30 May 2024 14:24:35 +0800
>
> After commit 74f15ad72d937b309dafecba872bccd1a880181e, it will
> encounter 'wrong-type-argument string nil' error when executing
> dired-do-shell-command.
>
> Here is the backtrace:
>
> string-match("/" nil 0)
> split-string(nil "/")
> xdg-mime-apps(nil)
> shell-command-guess-xdg(nil ("xxxxxxx"))
>
> The shell-command-guess-xdg is being called in the chain of
> shell-command-guess-functions. Here is the definition of
> shell-command-guess-xdg function:
>
> (defun shell-command-guess-xdg (commands files)
> "Populate COMMANDS by XDG configuration for FILES."
> (require 'xdg)
> (let* ((xdg-mime (when (executable-find "xdg-mime")
> (string-trim-right
> (shell-command-to-string
> (concat "xdg-mime query filetype "
> (shell-quote-argument (car files)))))))
> (xdg-mime-apps (unless (string-empty-p xdg-mime)
> (xdg-mime-apps xdg-mime)))
> (xdg-commands
> (mapcar (lambda (desktop)
> (setq desktop (xdg-desktop-read-file desktop))
> (propertize
> (replace-regexp-in-string
> " .*" "" (gethash "Exec" desktop))
> 'name (gethash "Name" desktop)))
> xdg-mime-apps)))
> (append xdg-commands commands)))
>
> xdg-mime will be nil if xdg-mime not found, string-empty-p returns
> nil and xdg-mime-apps will be called with nil.
Thanks, I'm adding Juri to this discussion.