eev
[Top][All Lists]
Advanced

[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

  lua5.1

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")

  http://packages.debian.org/lua5.1
  http://packages.debian.org/sid/lua5.1
  http://packages.debian.org/source/sid/lua5.1
  http://packages.debian.org/src:lua5.1
  http://ftp.debian.org/debian/pool/main/l/lua5.1/
  http://backports.org/debian/pool/main/l/lua5.1/
  http://bugs.debian.org/cgi-bin/pkgreport.cgi?which=pkg&data=lua5.1&archive=no

  http://packages.ubuntu.org/lua5.1

    (eepitch-shell2)
  sudo apt-get install    lua5.1
  sudo apt-get install -y lua5.1

    (eepitch-shell)
    (eepitch-kill)
    (eepitch-shell)
  # (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
here:

  (find-links-intro "5. The first line regenerates the buffer")
  http://angg.twu.net/eev-intros/find-links-intro.html#5

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")
  http://angg.twu.net/eev-intros/find-eev-quick-intro.html#4.2

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")
  http://angg.twu.net/eev-intros/find-emacs-keys-intro.html#1

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'")
  http://angg.twu.net/eev-intros/find-eev-quick-intro.html#6.3

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

lua5.1
lua5.1-doc

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")
  http://angg.twu.net/eev-current/eev-tlinks.el.html#find-debpkg-links


so let's start by a similar function whose code is quite clean:
`find-latex-links'.




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'")
  http://angg.twu.net/eev-intros/find-eev-quick-intro.html#7.4
  http://angg.twu.net/eev-intros/find-eev-quick-intro.html#7.5

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

  (find-efunction 'ee-template0)
  http://angg.twu.net/eev-current/eev-template0.el.html

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")
  http://angg.twu.net/eev-current/eev-elinks.el.html#find-elinks

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

  (find-efunction 'find-latex-links)
  http://angg.twu.net/eev-current/eev-tlinks.el.html#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:

  (find-elinks `(BIG BACKQUOTED LIST WITH ,COMMAS))

Pos-spec-lists are explained here:

  (find-refining-intro "1. Pos-spec-lists")
  http://angg.twu.net/eev-intros/find-refining-intro.html#1




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:

  http://angg.twu.net/eev-current/eev-elinks.el.html
  http://angg.twu.net/eev-current/eev-tlinks.el.html
  (find-eev "eev-elinks.el")
  (find-eev "eev-tlinks.el")

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

  http://angg.twu.net/.emacs.templates.html

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."
  (interactive)
  (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 "\
")
     )
   pos-spec-list))

;; 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:

  (find-templates-intro)
  http://angg.twu.net/eev-intros/find-templates-intro.html



Cheers =),
  Eduardo Ochs
  http://angg.twu.net/#eev
  http://angg.twu.net/emacsconf2019.html



reply via email to

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