Hi:

Thanks for using Hyperbole.  Let us know your thoughts and suggestions for
improvements as you have done here; it is very helpful.

Your issue is that a hex number by itself is not a commit/git reference to
Hyperbole, it requires a prefix in either of the two forms below:

commit fdac2a
git#fdac2a

That gives Hyperbole enough context to choose the right implicit button
type and action.  It works in the shell buffer because your git show commit
is printing that 'commit ' prefix.

Give it a try.  Note also that bug#1234 with a proper bug number will take
you right to that GNU Emacs/Hyperbole bug discussion in Gnus.

Cheers,

Bob


On Sat, Apr 17, 2021 at 6:21 AM <wisepeng...@btopenworld.com> wrote:

> Hi Bob,
>
> Thanks to you and Mats for all the work on Hyperbole.
>
>
> I'm fascinated by what it can do as it seems to offer a nice blend of power
>
> and "transparency" making for a more pleasant interaction inside Emacs.
>
>
> My issue is I'm having a hard time understanding the documentation
>
> and getting it to work. It has to be me doing something wrong but I cannot
> see
>
> where.
>
>
> To help me learn and not be overwhelmed, as well as it's what I'm
> interested in
>
> currently, I'm focusing on the "Buttons" - more specifically the the
> implicit buttons,
>
> such as the git reference and I cannot get it to work.
>
>
> My current understanding of implicit buttons are that Hyperbole can be made
>
> to understand that any structured piece of text can have an action
> associated
>
> with it. As git commit hashes are structured one action can be to show
>
> the diff of that commit, and as it happens I believe this is the default
> action
>
> in Hyperbole (more later).
>
>
> This functionality sounds great - but it doesn't work for me. This is what
> I'm doing...
>
>
> * Documentation:
> https://www.gnu.org/software/hyperbole/man/hyperbole.html#Implicit-Button-Types
>
> * Emacs version 27.2
>
> * Hyperbole 7.1.3 - installed from ELPA, then (require 'hyperbole)
>
> * OpenBSD - but any nix system should be the same
>
> * So that we're using the same details to reproduce I cloned
>
> git://git.savannah.gnu.org/hyperbole.git
>
>
> The part of documentation which makes me think git hashes should work are
>
>
> 'git-reference'...
>
> a commit reference given by a hex number, 55a1f0
>
> the commit diff is displayed
>
> I don't understand the difference of 'git-commit-reference' as it seems to
> be handled
>
> by 'git-reference' - but I can't get either to work...
>
>
> Steps to reproduce the issue
>
>
> $ cd $HYPERBOLE_CHECKOUT_ROOT
>
> $ emacs README
>
> M-x shell
>
> *shell* $ git log -n5
> # Choose random git commit such as fdac2afb96980d1c380d6234b5c919a5d220f78f
>
> # then copy/M-w goto README then at the top paste/C-y it
>
> # e.g. See fdac2afb96980d1c380d6234b5c919a5d220f78f for more details
>
>
> The intention here is that inside a git project one of the files may
> reference a
>
> git commit for more details such as why the change was made. I think this
> is
>
> a great use of an implicit button - as we're already inside a git repo
> it's implicit
>
> this hash could be a git commit. Doing M-<RET> on that commit in the README
>
> file does nothing for me...
>
>
> (Hyperbole Action Key): No action defined for this context; try another
> location
>
>
> What is confusing me even more is that go back to the *shell* buffer and do
>
> M-<RET> on that same commit and this time it works, it shows the commit
>
> diff.
>
>
> I'm not sure if this will help...
>
>
> If given, PROJECT overrides any project value in REFERENCE. If no PROJECT
> value is provided, it defaults to the value of
> hibtypes-git-default-project
>
>
> hibtypes-git-default-project is nil, yet it works frrom *shell* but not
>
> from README. I'm also not sure what it needs to be set to, the docs say
>
> it needs to be a "project name". Why would this not be a path to the git
>
> repo - how does Hyperbole map names to paths?
>
>
> On a slightly unrelated note doing these same steps on Windows don't work
> but for
>
> a different reason, and I may be able to provide a patch here. The reason
> is
>
> that doing M-<RET> on the commit ref in *shell* where Hyperbole does kick
> in
>
> then issues...
>
>
> (cd $DIR; git show $REF)
>
>
> this does not work using the default cmd.exe on Windows due to at least 2
> reasons
>
>
> * ; does not work. Using && does
>
> * When $DIR contains "~" it does not work and needs to be expanded first.
>
>
> So on Windows a working command is
>
>
> (cd "/full/path/to/dir" && git show $REF)
>
>
> It's ok to use forward slashes in the path on Windows.
>
>
> The simplest patch would be to always use && on all systems as that should
> work
>
> everywhere. That would leave a remaining patch to handle expanding if
>
> necessary. Any thoughts?
>
>
> To recap
>
>
> * I'm doing something wrong but I don't know where
>
> * M-<RET> works for git commits from *shell* and does not from elsewhere
>
> * Potential patch to use && for M-<RET> on git commits
>
>
> I also have confusion over the HYPB syntax - as to help me learn I wanted
>
> to see if I could write my own implicit git commit show button - but this
>
> email is long enough.
>
>
> Any pointers to documentation that can help clarify where I'm going wrong
>
> would be a great help.
>
>
> Kinds Regards
>
> Richard
>
>
> p.s. Just curious, the latest release on the FTP mirror is 7.1.1, but it
> seems the
>
> latest is 7.1.3. This tripped me up to start with because 7.1.1 has an
> error
>
> just doing (require 'hyperbole) which is resolved in 7.1.3.
>
>
>
>

Reply via email to