GNU bug report logs - #37724
HTML Markdown and Emacs Outline Hash Links in DEMO not working

Previous Next

Package: hyperbole;

Reported by: "Kevin J. McCarthy" <kevin <at> 8t8.us>

Date: Sun, 13 Oct 2019 04:21:01 UTC

Severity: normal

Done: Robert Weiner <rsw <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 37724 in the body.
You can then email your comments to 37724 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-hyperbole <at> gnu.org:
bug#37724; Package hyperbole. (Sun, 13 Oct 2019 04:21:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to "Kevin J. McCarthy" <kevin <at> 8t8.us>:
New bug report received and forwarded. Copy sent to bug-hyperbole <at> gnu.org. (Sun, 13 Oct 2019 04:21:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: "Kevin J. McCarthy" <kevin <at> 8t8.us>
To: bug-hyperbole <at> gnu.org
Subject: HTML Markdown and Emacs Outline Hash Links in DEMO not working
Date: Sun, 13 Oct 2019 12:20:38 +0800
I use:  Editor:      GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.4)

        Hyperbole:   7.0.7
        Sys Type:    x86_64-pc-linux-gnu
        OS Type:     gnu/linux
        Window Sys:  x
        News Reader: Gnus v5.13

In the DEMO file under
* Implicit Buttons
** Implicit Path Links
*** HTML Markdown and Emacs Outline Hash Links

The example "man/hyperbole.html#Smart-Keys" gives me an error message
  (hpath:find): "man/hyperbole.html" does not exist

The same for "README.md#why-was-hyperbole-developed":
  (hpath:find): "README.md" does not exist

If I (find-file) from the DEMO, I see man/hyperbole.html and README.md 
both exist in the path relative to DEMO.

The path and line/column numbers examples work fine: "HY-ABOUT", 
"HY-ABOUT:10", "HY-ABOUT:17:7".

Also, the hash links within the DEMO file are working fine, 
e.g. "#Org-Mode".

Thank you,

-Kevin




Information forwarded to bug-hyperbole <at> gnu.org:
bug#37724; Package hyperbole. (Sun, 13 Oct 2019 11:52:02 GMT) Full text and rfc822 format available.

Message #8 received at 37724 <at> debbugs.gnu.org (full text, mbox):

From: "Kevin J. McCarthy" <kevin <at> 8t8.us>
To: 37724 <at> debbugs.gnu.org
Subject: Re: bug#37724: HTML Markdown and Emacs Outline Hash Links in DEMO
 not working
Date: Sun, 13 Oct 2019 19:51:42 +0800
The patch I posted in bug#37729 seems to have partly fixed this problem 
too:

modified   hbut.el
@@ -1224,6 +1224,7 @@ excluding delimiters, not just one."
 		  (hattr:get 'hbut:current 'lbl-key)
 		(hattr:set 'hbut:current 'loc (save-excursion
 						(hbut:key-src 'full)))
+		(hattr:set 'hbut:current 'dir default-directory)
 		(hattr:set 'hbut:current 'categ is-type)
 		(or (hattr:get 'hbut:current 'args)
 		    (not (listp args))

"README.md#why-was-hyperbole-developed" now seems to work.

"man/hyperbole.html#Smart-Keys" opens the man/hyperbole.html file, but 
it isn't rendered so it gives the error:
  hyperbole.html - Section ‘Smart Keys’ not found in the visible buffer portion

I don't know if that is expected behavior or not.




Reply sent to rswgnu <at> gmail.com:
You have taken responsibility. (Sun, 13 Oct 2019 17:01:01 GMT) Full text and rfc822 format available.

Notification sent to "Kevin J. McCarthy" <kevin <at> 8t8.us>:
bug acknowledged by developer. (Sun, 13 Oct 2019 17:01:03 GMT) Full text and rfc822 format available.

Message #13 received at 37724-close <at> debbugs.gnu.org (full text, mbox):

From: Robert Weiner <rsw <at> gnu.org>
To: "Kevin J. McCarthy" <kevin <at> 8t8.us>
Cc: 37724-close <at> debbugs.gnu.org, Lidell Mats <matsl <at> gnu.org>
Subject: Re: bug#37724: HTML Markdown and Emacs Outline Hash Links in DEMO not
 working
Date: Sun, 13 Oct 2019 12:59:52 -0400
On Sun, Oct 13, 2019 at 12:21 AM Kevin J. McCarthy <kevin <at> 8t8.us> wrote:
>
> I use:  Editor:      GNU Emacs 26.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.4)
>
>          Hyperbole:   7.0.7
>          Sys Type:    x86_64-pc-linux-gnu
>          OS Type:     gnu/linux
>          Window Sys:  x
>          News Reader: Gnus v5.13
>
> In the DEMO file under
> * Implicit Buttons
> ** Implicit Path Links
> *** HTML Markdown and Emacs Outline Hash Links
>
> The example "man/hyperbole.html#Smart-Keys" gives me an error message
>    (hpath:find): "man/hyperbole.html" does not exist
>
> The same for "README.md#why-was-hyperbole-developed":
>    (hpath:find): "README.md" does not exist


Another good catch.  There was a missing file-name-directory call
needed to remove the filename from the 'loc attribute of this type of
button in hpath:find.  Use the following replacement to fix it.

(defun hpath:find (filename &optional display-where noselect)
  "Edit file FILENAME using user customizable settings of display
program and location.
Return the current buffer iff file is displayed within a buffer (not
with an external
program), else nil.

FILENAME may start with a special prefix character that 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.

If FILENAME does not start with a prefix character:

  it may be followed by a hash-style link reference to HTML, Markdown
  or Emacs outline headings of the form, <file>#<anchor-name>,
  e.g. \"~/.bashrc#Alias Section\";

  it may end with a line number and optional column number to which to go,
  of the form, :<line-number>[:<column-number>], e.g. \"~/.bashrc:20:5\";
  normally, this is an absolute line number (disabling buffer restriction),
  but if preceded by a hash-style link reference, it is relative to the
  location of the link anchor;

  if it matches a regular expression in the alist returned by
  \(hpath:get-external-display-alist), invoke the associated external
  display program

  if not, consult `hpath:internal-display-alist' for a specialized internal
  display function to use;

  if no matches are found there, consult `hpath:display-where-alist'
  using the optional second argument, DISPLAY-WHERE (a symbol);

  if that is nil, consult the value of `hpath:display-where', and use the
  matching display function.

Optional third argument, NOSELECT, means simply find the file and return its
buffer but don't display it."
  (interactive "FFind file: ")
  (let ((case-fold-search t)
        (default-directory default-directory)
        modifier loc anchor hash path line-num col-num)
    (setq loc (hattr:get 'hbut:current 'loc)
          default-directory (or (hattr:get 'hbut:current 'dir)
                                ;; Loc may be a buffer without a file
                                (if (stringp loc)
                                    (file-name-directory loc)
                                  default-directory)))
    (when (string-match hpath:prefix-regexp filename)
      (setq modifier (aref filename 0)
            filename (substring filename (match-end 0))))
    (setq path filename) ;; default
    (when (string-match hpath:line-and-column-regexp path)
      (setq line-num (string-to-number (match-string 1 path))
            col-num (when (match-string 3 path)
                      (string-to-number (match-string 3 path)))
            path (substring path 0 (match-beginning 0))))
    (when (string-match hpath:markup-link-anchor-regexp path)
      (setq hash t
            anchor (match-string 3 path)
            path (substring path 0 (match-end 1))))
    (setq path (hpath:substitute-value path)
          filename (hpath:absolute-to path default-directory))
    (if noselect
        (prog1 (find-file-noselect filename)
          (if (or hash anchor) (hpath:to-markup-anchor hash anchor)))
      (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 ((= modifier ?!)
                             (hact 'exec-shell-cmd filename))
                            ((= modifier ?&)
                             (hact 'exec-window-cmd filename))
                            ((= modifier ?-)
                             (hact '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)
                       ((functionp display-executables)
                        (funcall display-executables filename)
                        (current-buffer))
                       ((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))
                          (funcall (hpath:display-path-function
display-where) path)
                          (when (or hash anchor)
(hpath:to-markup-anchor hash anchor))
                          (when line-num
                            ;; With an anchor, goto line relative to
                            ;; anchor location, otherwise use absolute
                            ;; line number within the visible buffer
                            ;; portion.
                            (if (or hash anchor)
                                (forward-line line-num)
                              (hpath:to-line line-num)))
                          (when col-num (move-to-column col-num))
                          (current-buffer)))))))))

This issue is now resolved and will be closed.

Bob




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 11 Nov 2019 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 283 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.