racket-mode icon indicating copy to clipboard operation
racket-mode copied to clipboard

racket-documentation-search doesn't work with snap browsers in default configuration

Open rntz opened this issue 2 years ago • 1 comments

On Ubuntu 22.04 LTS and perhaps other Linux distros, Firefox and Chrome get installed as Snap packages, which are isolated in some way I don't fully understand from the local filesystem, and can't read files in /tmp/. So with racket-browse-url-function set to the default racket-browse-url-using-temporary-file, then racket-documentation-search just produces a file not found tab in the browser. This isn't really racket-mode's fault, and it is possible to work around it by eg setting racket-browse-url-function to browse-url, but I figured I'd log an issue so you're aware and in case anyone else has the same issue.

((alist-get 'racket-mode package-alist)
 #s(package-desc racket-mode
                 (20220517 2322)
                 "Racket editing, REPL, and more"
                 ((emacs
                   (25 1)))
                 nil nil "/home/rntz/.emacs.d/elpa/racket-mode-20220517.2322"
                 ((:url . "https://www.racket-mode.com/")
                  (:maintainer "Greg Hendershott")
                  (:authors
                   ("Greg Hendershott"))
                  (:commit . "c6f18e6883c4f48eee2d0d4f5bd7604a2de31753"))
                 nil))
((emacs-version "27.1")
 (system-type gnu/linux)
 (x-gtk-use-system-tooltips t)
 (major-mode racket-mode)
 (racket--el-source-dir "/home/rntz/.emacs.d/elpa/racket-mode-20220517.2322/")
 (racket--rkt-source-dir "/home/rntz/.emacs.d/elpa/racket-mode-20211130.1748/racket/")
 (racket-program "racket")
 (racket-command-timeout 10)
 (racket-path-from-emacs-to-racket-function identity)
 (racket-path-from-racket-to-emacs-function identity)
 (racket-browse-url-function racket-browse-url-using-temporary-file)
 (racket-documentation-search-location "https://docs.racket-lang.org/search/index.html?q=%s")
 (racket-xp-after-change-refresh-delay 1)
 (racket-xp-mode-lighter
  (:eval
   (racket--xp-mode-lighter)))
 (racket-xp-highlight-unused-regexp "^[^_]")
 (racket-repl-buffer-name-function nil)
 (racket-submodules-to-run
  ((test)
   (main)))
 (racket-memory-limit 2048)
 (racket-error-context medium)
 (racket-repl-history-directory "~/.emacs.d/racket-mode/")
 (racket-history-filter-regexp "\\`\\s *\\'")
 (racket-images-inline t)
 (racket-imagemagick-props nil)
 (racket-images-keep-last 100)
 (racket-images-system-viewer "display")
 (racket-pretty-print t)
 (racket-use-repl-submit-predicate nil)
 (racket-pretty-print t)
 (racket-indent-curly-as-sequence t)
 (racket-indent-sequence-depth 0)
 (racket-pretty-lambda t)
 (racket-smart-open-bracket-enable nil)
 (racket-module-forms "\\s(\\(?:module[*+]?\\|library\\)")
 (racket-logger-config
  ((cm-accomplice . warning)
   (GC . info)
   (module-prefetch . warning)
   (optimizer . info)
   (racket/contract . error)
   (sequence-specialization . info)
   (* . fatal)))
 (racket-show-functions
  (racket-show-pseudo-tooltip)))
(enabled-minor-modes
 (auto-composition-mode)
 (auto-compression-mode)
 (auto-encryption-mode)
 (auto-fill-mode)
 (auto-save-mode)
 (blink-cursor-mode)
 (delete-selection-mode)
 (desktop-save-mode)
 (display-line-numbers-mode)
 (file-name-shadow-mode)
 (font-lock-mode)
 (global-display-line-numbers-mode)
 (global-eldoc-mode)
 (global-font-lock-mode)
 (global-hi-lock-mode)
 (global-hl-line-mode)
 (global-visual-line-mode)
 (hi-lock-mode)
 (hs-minor-mode)
 (icomplete-mode)
 (line-number-mode)
 (mouse-wheel-mode)
 (override-global-mode)
 (paredit-mode)
 (semantic-minor-modes-format)
 (shell-dirtrack-mode)
 (show-paren-mode)
 (temp-buffer-resize-mode)
 (tooltip-mode)
 (visual-line-mode)
 (which-function-mode)
 (which-key-mode)
 (whitespace-mode)
 (winner-mode))
(disabled-minor-modes
 (abbrev-mode)
 (archive-subfile-mode)
 (auto-fill-function)
 (auto-save-visited-mode)
 (buffer-face-mode)
 (buffer-read-only)
 (bug-reference-mode)
 (bug-reference-prog-mode)
 (checkdoc-minor-mode)
 (cl-old-struct-compat-mode)
 (column-number-mode)
 (compilation-minor-mode)
 (compilation-shell-minor-mode)
 (completion-in-region-mode)
 (dash-fontify-mode)
 (defining-kbd-macro)
 (diff-auto-refine-mode)
 (diff-minor-mode)
 (dired-hide-details-mode)
 (dired-isearch-filenames-mode)
 (dired-omit-mode)
 (doc-view-minor-mode)
 (doc-view-presentation-mode)
 (eldoc-mode)
 (electric-indent-mode)
 (electric-layout-mode)
 (electric-quote-mode)
 (fido-mode)
 (flymake-mode)
 (global-dash-fontify-mode)
 (global-prettify-symbols-mode)
 (global-semantic-highlight-edits-mode)
 (global-semantic-highlight-func-mode)
 (global-semantic-show-parser-state-mode)
 (global-semantic-show-unmatched-syntax-mode)
 (global-semantic-stickyfunc-mode)
 (global-subword-mode)
 (global-superword-mode)
 (global-whitespace-mode)
 (global-whitespace-newline-mode)
 (gnus-dead-summary-mode)
 (gnus-undo-mode)
 (haskell-collapse-mode)
 (haskell-decl-scan-mode)
 (haskell-indent-mode)
 (haskell-indentation-mode)
 (highlight-uses-mode)
 (hl-line-mode)
 (horizontal-scroll-bar-mode)
 (html-autoview-mode)
 (ibuffer-auto-mode)
 (ido-everywhere)
 (image-minor-mode)
 (interactive-haskell-mode)
 (isearch-mode)
 (jit-lock-debug-mode)
 (latex-electric-env-pair-mode)
 (mail-abbrevs-mode)
 (markdown-live-preview-mode)
 (menu-bar-mode)
 (mml-mode)
 (next-error-follow-minor-mode)
 (org-cdlatex-mode)
 (org-src-mode)
 (orgstruct-mode)
 (outline-minor-mode)
 (overwrite-mode)
 (paragraph-indent-minor-mode)
 (prettify-symbols-mode)
 (racket-smart-open-bracket-mode)
 (racket-xp-mode)
 (rng-validate-mode)
 (semantic-highlight-edits-mode)
 (semantic-highlight-func-mode)
 (semantic-mode)
 (semantic-show-parser-state-mode)
 (semantic-show-unmatched-syntax-mode)
 (semantic-stickyfunc-mode)
 (sgml-electric-tag-pair-mode)
 (sh-electric-here-document-mode)
 (simple-tabs-mode)
 (size-indication-mode)
 (subword-mode)
 (superword-mode)
 (tab-bar-history-mode)
 (tab-bar-mode)
 (tar-subfile-mode)
 (text-scale-mode)
 (tool-bar-mode)
 (transient-mark-mode)
 (transient-resume-mode)
 (unify-8859-on-decoding-mode)
 (unify-8859-on-encoding-mode)
 (url-handler-mode)
 (use-hard-newlines)
 (vc-parent-buffer)
 (view-mode)
 (visible-mode)
 (whitespace-newline-mode)
 (window-divider-mode)
 (xref-etags-mode))

rntz avatar May 23 '22 19:05 rntz

Thank you for reporting this.

IIRC: The motivation for creating a temporary "trampoline" HTML file was that, if you try to browse a URL with an anchor (portion after #), the browser won't necessarily move there (you get the right help page, not the location within it). IIRC, this happens on macOS "because security".

So it seems this feature area is getting squeezed between a security rock and a sandboxing hard place.

I'm not immediately sure what to change, for a better just-works experience on all versions of all platforms, but I'll try to learn more, and maybe someone else will have an idea to contribute.

Meanwhile your report is helpful information for folks -- thanks again!


An off-topic p.s.: My daily driver laptop is still on Ubuntu 18.04 LTS. I've held off upgrading because I'm not sure how I feel about all the snap-izing.

greghendershott avatar May 24 '22 14:05 greghendershott

Revisiting this: Although racket-browse-url-using-temporary-file is desirable and necessary on macOS (to support anchors in URLs), it is unnecessary elsewhere (for anchors), and it turns out to be a bad choice when the browser is sandboxed and can't read /tmp.

I think probably racket-browse-url-function should just default differently depending on the platform. (We already have precedent for picking a default based on platform with racket-program defaulting to "racket" vs. "Racket.exe").

So I plan to merge a commit along those lines...

greghendershott avatar Mar 01 '24 17:03 greghendershott