Fossil Forum

vc-mode for Emacs and fossil
Login

vc-mode for Emacs and fossil

vc-mode for Emacs and fossil

(1) By seeg on 2021-09-17 17:50:01 [link] [source]

Hello,

I've been using Emacs for quite some time now and I really like how magit works. I've been somewhat reluctant of using the built-in vc-mode until I saw this nice video:

https://www.youtube.com/watch?v=0YlYX_UjH5Q

With the great vc-fossil package you one can make a very nice Fossil experience in Emacs too :)

Hope that helps someone!

Best, Przemek

(2) By Alfred M. Szmidt (ams) on 2021-09-19 19:35:34 in reply to 1 [link] [source]

Cześć,

If you like that, you might like this as well: https://tumbleweed.nu/r/ams/file?name=vc-fossil-link.el

It’s a hack, but given point or region you get a link to the file. I might put it in vc-fossil at some point if people think it’s a good idea.

(3) By seeg on 2021-09-27 04:38:39 in reply to 2 [link] [source]

That's nice. However I'm getting:

Debugger entered--Lisp error: (void-function vc-fossil-repository-url)
  (vc-fossil-repository-url (buffer-file-name))
  (url-without-authinfo (vc-fossil-repository-url (buffer-file-name)))
  (let* ((repository-url (url-without-authinfo (vc-fossil-repository-url (buffer-file-name)))) (file (vc-fossil--relative-file-name (buffer-file-name))) (tag (vc-fossil-working-revision (buffer-file-name (current-buffer)))) (start (line-number-at-pos (region-beginning))) (end (line-number-at-pos (region-end)))) (if (= start end) (setq link (format "%s/file?ci=%s&name=%s&ln=%s" repository-url tag file start)) (setq link (format "%s/file?ci=%s&name=%s&ln=%s-%s" repository-url tag file start end))) (kill-new link) (message "%s" link))
  (let ((default-directory (file-name-directory (buffer-file-name (current-buffer))))) (if (vc-fossil-registered (buffer-file-name)) nil (error "%s: file is not registerd in vc" (buffer-file-name))) (let* ((repository-url (url-without-authinfo (vc-fossil-repository-url (buffer-file-name)))) (file (vc-fossil--relative-file-name (buffer-file-name))) (tag (vc-fossil-working-revision (buffer-file-name (current-buffer)))) (start (line-number-at-pos (region-beginning))) (end (line-number-at-pos (region-end)))) (if (= start end) (setq link (format "%s/file?ci=%s&name=%s&ln=%s" repository-url tag file start)) (setq link (format "%s/file?ci=%s&name=%s&ln=%s-%s" repository-url tag file start end))) (kill-new link) (message "%s" link)))
  vc-fossil-link(592 613)
  funcall-interactively(vc-fossil-link 592 613)
  call-interactively(vc-fossil-link record nil)
  command-execute(vc-fossil-link record)
  execute-extended-command(nil "vc-fossil-link" nil)
  funcall-interactively(execute-extended-command nil "vc-fossil-link" nil)
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

(4) By hanche on 2021-09-27 14:13:33 in reply to 3 [link] [source]

You need to upgrade your emacs-fossil package. It appears that vc-fossil-repository-url was added in commit 01ad41d61a 2021-09-15.

(5) By Alfred M. Szmidt (ams) on 2021-09-27 14:30:32 in reply to 4 [link] [source]

Very much so -- more importantly, emacs-fossil on github is a mirror of the repository on Chiselapp / Tumbleweed. These are to be considered the most current ones, the Github mirror is updated infrequently / manually. I asked venkat to update it.

The current version of vc-fossil.el now contains vc-fossil-link.

https://tumbleweed.nu/r/vc-fossil/doc/tip/README.md

(6) By seeg on 2021-09-28 06:03:39 in reply to 5 [link] [source]

I use straight.el - is there a way to pull the fossil repo using straight?

(7) By Alfred M. Szmidt (ams) on 2021-09-28 06:30:54 in reply to 6 [link] [source]

Sorry, I don’t know what that is. vc-fossil should be able to install via the usual GNU Emacs package installer — if that’s what you mean by pull the repo.

(8) By hanche on 2021-09-28 11:34:19 in reply to 7 [source]

I think he means raxod502/straight.el: 🍀 Next-generation, purely functional package manager for the Emacs hacker. It's basically a replacement for package.el.

Among the features:

Packages are cloned as Git (or other) repositories, not as opaque tarballs

That “or other” seems promising. Maybe it supports fossil? But later on:

You must install Git in order to use straight.el

So maybe not. In any case that would be a question for the maintainer of straight.el. But I see no reason why he couldn't use it to pull from the clone at github.

(9) By xerusf on 2022-09-19 13:23:08 in reply to 1 [link] [source]

Hey, I am trying to set this up, but my fossil repo is nested under a git repo, and vc seems to ignore the fossil repo now :/

(10) By Alfred M. Szmidt (ams) on 2022-09-20 11:56:57 in reply to 9 [link] [source]

You need to sort vc-handled-backends according to your preferred VC.

E.g.,

(add-to-list 'vc-handled-backends 'Fossil nil) ; Add Fossil to the head of the list.