[Top][All Lists]

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

Support for MacPorts and Homebrew

From: Eduardo Ochs
Subject: Support for MacPorts and Homebrew
Date: Sun, 29 Dec 2019 18:07:47 -0300

Hi list,

eev has some functions for dealing with Debian packages, but at this
moment nothing for MacPorts, Homebrew, or (other) BSD-ish package
managers. I want to change that, but I will need some help.

1. The current support for Debian packages
If you put the point on the name of a Debian package - for example, on


and type `M-h M-d' you get a temporary buffer containing this:

  # (find-debpkg-links "lua5.1")
  # (find-available "lua5.1")

  # (find-status   "lua5.1")
  # (find-vldifile "lua5.1.list")
  # (find-udfile   "lua5.1/")

  # (find-vldifile "lua5.1.postinst")
  # (find-vldifile "lua5.1.prerm")
  # (find-vldifile "lua5.1.md5sums")

  # (find-sh "apt-file search lua5.1")
  # (find-sh "apt-cache dump | grep-dctrl -P lua5.1")
  # (find-sh "apt-cache search lua5.1 | sort")
  # (find-sh "apt-cache showpkg lua5.1")
  # (find-sh "grep-aptavail -P lua5.1")

  sudo apt-get install    lua5.1
  sudo apt-get install -y lua5.1

  # (find-man "8 apt-cache")
  apt-cache show lua5.1
  apt-cache search lua5.1
  apt-cache depends lua5.1
  apt-cache rdepends lua5.1

  apt-cache showpkg lua5.1

  # (find-man "1 dpkg-query")
  apt-file search lua5.1
  dpkg-query --search lua5.1

The first line in that buffer follows a convention that is explained

  (find-links-intro "5. The first line regenerates the buffer")

and note that you can get a lot of information about `M-h M-d' by
running this:

  (eek "M-h M-k  M-h M-d  ;; find-debpkg-links")

For more on `M-h M-k', see:

  (find-eev-quick-intro "4.2. `find-ekey-links' and friends")

Note that `M-h M-k' is listed here:

  (find-emacs-keys-intro "1. Basic keys (eev)")
  (find-emacs-keys-intro "1. Basic keys (eev)" "M-h M-k")

I also have a "wrapping function" for Debian packages that works
similarly to `M-T':

  (find-eev-quick-intro "6.3. Creating eepitch blocks: `M-T'")

If you put the point at the line containing "lua5.1" below


and type `M-D' two times you will get this:

# (find-status   "lua5.1")
# (find-vldifile "lua5.1.list")
# (find-udfile   "lua5.1/")
# (find-status   "lua5.1-doc")
# (find-vldifile "lua5.1-doc.list")
# (find-udfile   "lua5.1-doc/")

For more on `M-D', see:

  (eek "M-h M-k  M-D  ;; eewrap-debian")

At this moment neither `M-h M-d' nor `M-D' are properly documented.

2. How `M-h M-d' is implemented
The code for `M-h M-d' is ugly - see:

  (find-eev "eev-tlinks.el" "find-debpkg-links")

so let's start by a similar function whose code is quite clean:

3. How `find-latex-links' is implemented
If you want to start by _using_ `find-latex-links' a bit, follow these
sections of the main tutorial:

  (find-eev-quick-intro "7.4. Commands with very short names")
  (find-eev-quick-intro "7.5. `find-latex-links'")

Now read the source for the function `ee-template0':

  (find-efunction 'ee-template0)

It is well-documented, and the source is full of executable examples.

Next step: do the same for `find-elinks', at:

  (find-eev "eev-elinks.el" "find-elinks")

Now the source code for `find-latex-links' should be readable:

  (find-efunction 'find-latex-links)

There's one tricky point, though. We use

  (apply 'find-elinks `(BIG BACKQUOTED LIST WITH ,COMMAS) pos-spec-list)

to make the pos-spec-list work correctly, instead of simply:


Pos-spec-lists are explained here:

  (find-refining-intro "1. Pos-spec-lists")

4. How I write my `find-*-links' functions
ALL my `find-*-links' started as quick hacks.
SOME of them were useful enough to deserve being cleaned up.
A FEW of them ended up in:
  (find-eev "eev-elinks.el")
  (find-eev "eev-tlinks.el")

...but there are lots of other `find-*-links' functions in:

They are trivial to write. I start with a skeleton that I obtain by
running `M-x find-find-links-links', and then I modify the first line
in that buffer, regenerate, modify, regenerate, and so on until happy.
Run each of the sexps below with `M-2 M-e' to compare the buffers that
they generate:

  (find-find-links-links "{k}" "{stem}" "{args}")
  (find-find-links-links "\\M-u" "{stem}" "{args}")
  (find-find-links-links "\\M-u" "macports" "{args}")
  (find-find-links-links "\\M-u" "macports" "pkgname")
  (find-find-links-links "\\M-u" "macports" "pkgname anotherarg")

So: start by running something like

  (find-find-links-links "\\M-u" "macports" "pkgname")
  (find-find-links-links "\\M-u" "homebrew" "pkgname")

then copy the

(define-key eev-mode-map "\M-h\M-u" 'find-macports-links)

(defun find-macports-links (&optional pkgname &rest pos-spec-list)
"Visit a temporary buffer containing hyperlinks for foo."
  (setq pkgname (or pkgname "{pkgname}"))
  (apply 'find-elinks
   `((find-macports-links ,pkgname ,@pos-spec-list)
     ;; Convention: the first sexp always regenerates the buffer.
     (find-efunction 'find-macports-links)
     ,(ee-template0 "\

;; Test: (find-macports-links ___)

to your notes, replace the `(interactive)' by

  (interactive (list (ee-debpkgname-ask)))

and start adding things to the string in (ee-template0 "...").

I will try to update this intro in the next days:


Cheers =),
  Eduardo Ochs

reply via email to

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