Wilfred / helpful

A better Emacs *help* buffer
1.1k stars 62 forks source link

"Note: file is write protected" message when source file is read-only #338

Open l2dy opened 6 months ago

l2dy commented 6 months ago

When I try to run helpful-callable(let*) for the first time, I get a "Note: file is write protected" message in minibuffer. The backtrace captured shows that helpful--open-if-needed is trying to open a file in /nix/store, which is read-only by design in Nix package manager.

  after-find-file(nil t)
  find-file-noselect-1(#<buffer eval.c> "/nix/store/wl840kj5v3f17ns5p685g1p61xdk7sc0-emacs-..." nil nil "/nix/store/wl840kj5v3f17ns5p685g1p61xdk7sc0-emacs-..." (55171408 64512))
  find-file-noselect("/nix/store/wl840kj5v3f17ns5p685g1p61xdk7sc0-emacs-nox-29.1/share/emacs/29.1/src/eval.c")
  helpful--open-if-needed("/nix/store/wl840kj5v3f17ns5p685g1p61xdk7sc0-emacs-...")
  helpful--definition(let* t)
  #<subr helpful-update>()
  apply(#<subr helpful-update> nil)
  helpful-update()
  helpful--update-and-switch-buffer(let* t)
  helpful-callable(let*)
  funcall-interactively(helpful-callable let*)
  command-execute(helpful-callable)

I have applied the following workaround in my config to suppress this message, but overriding noninteractive could have side effects, so I'm looking for a proper fix upstream.

(after! helpful
  (defadvice! doomd--supress-helpful-open-buffer-noise (fn &rest args)
    :around #'helpful--open-if-needed
    (let ((noninteractive t))
      (apply fn args))))