bug-hyperbole
[Top][All Lists]
Advanced

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

bug#36107: Global Buttons Stop Functioning When Current Working Director


From: Robert Weiner
Subject: bug#36107: Global Buttons Stop Functioning When Current Working Directory Changes (Forgot the Subject!)
Date: Thu, 6 Jun 2019 02:21:20 -0400

This is indeed a bug.  Evaluate this function after loading Hyperbole and I believe this will resolve it.  The default-directory was not set properly in this function.

(defun hpath:find (filename &optional display-where)
  "Edits file FILENAME using user customizable settings of display program and location.

FILENAME may start with a special prefix character which is
handled as follows:
  !filename  - execute as a non-windowed program within a shell;
  &filename  - execute as a windowed program;
  -filename  - load as an Emacs Lisp program.

Otherwise, if FILENAME matches a regular _expression_ in the alist returned by
\(hpath:get-external-display-alist), the associated external display program is invoked.
If not, `hpath:internal-display-alist' is consulted for a specialized internal
display function to use.  If no matches are found there,
`hpath:display-where-alist' is consulted using the optional argument,
DISPLAY-WHERE (a symbol) or if that is nil, the value of
`hpath:display-where', and the matching display function is used.

Allows for hash-style link references to HTML, Markdown or Emacs outline
headings of the form, <file>#<anchor-name>.

Returns non-nil iff file is displayed within a buffer (not with an external
program)."
  (interactive "FFind file: ")
  (let ((case-fold-search t)
modifier loc default-directory anchor hash path)
    (if (string-match hpath:prefix-regexp filename)
(setq modifier (aref filename 0)
      filename (substring filename (match-end 0))))
    (setq path (hpath:substitute-value
(if (string-match hpath:markup-link-anchor-regexp filename)
    (progn (setq hash t
anchor (match-string 3 filename))
   (substring filename 0 (match-end 1)))
  filename))
  loc (hattr:get 'hbut:current 'loc)
  default-directory (file-name-directory
     ;; Loc may be a buffer without a file
     (if (stringp loc) loc default-directory))
  filename (hpath:absolute-to path default-directory))
    (let ((remote-filename (hpath:remote-p path)))
      (or modifier remote-filename
  (file-exists-p filename)
  (error "(hpath:find): \"%s\" does not exist" filename))
      (or modifier remote-filename
  (file-readable-p filename)
  (error "(hpath:find): \"%s\" is not readable" filename))
      ;; If filename is a remote file (not a directory, we have to copy it to
      ;; a temporary local file and then display that.
      (when (and remote-filename (not (file-directory-p remote-filename)))
(copy-file remote-filename
   (setq path (concat hpath:tmp-prefix
      (file-name-nondirectory remote-filename)))
   t t)
(setq filename (cond (anchor (concat remote-filename "#" anchor))
     (hash   (concat remote-filename "#"))
     (t path)))))
    (cond (modifier (cond ((eq modifier ?!)
   (hact 'exec-shell-cmd filename))
  ((eq modifier ?&)
   (hact 'exec-window-cmd filename))
  ((eq modifier ?-)
   (load filename)))
    nil)
  (t (let ((display-executables (hpath:find-program path))
   executable)
       (cond ((stringp display-executables)
      (hact 'exec-window-cmd
    (hpath:command-string display-executables
  filename))
      nil)
     ((hypb:functionp display-executables)
      (funcall display-executables filename)
      t)
     ((and (listp display-executables) display-executables)
      (setq executable (hpath:find-executable
display-executables))
      (if executable
  (hact 'exec-window-cmd
(hpath:command-string executable
      filename))
(error "(hpath:find): No available executable from: %s"
       display-executables)))
     (t (setq path (hpath:validate path))
(if (null display-where)
    (setq display-where hpath:display-where))
(funcall
(car (cdr (or (assq display-where
     hpath:display-where-alist)
       (assq 'other-window
     hpath:display-where-alist))))
path)
(if (or hash anchor) (hpath:to-markup-anchor hash anchor))
t)))))))

On Wed, Jun 5, 2019 at 5:20 PM <address@hidden> wrote:
>
>
> I just realized I didn't put a subject on my report -- oops! Sorry!
>
> etb
>
> _______________________________________________
> Bug-hyperbole mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/bug-hyperbole

reply via email to

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