1

I'm trying to install markdown-mode using instructions on https://jblevins.org/projects/markdown-mode/, according to which I put into my init.el file

(require 'package)
(add-to-list 'package-archives
         '("melpa-stable" . "https://stable.melpa.org/packages/"))
(package-initialize)

and evaluating it, then evaluating

M-x package-install RET markdown-mode RET

but it gives the message, "[Not found]".

I tried package-refresh-contents but it didn't fix the problem. Also, the list returned by package-list-packages doesn't contain "markdown".

I've spent about an hour googling and reading but haven't found a solution so far.

I'm using Aquamacs 3.4 GNU Emacs 25.3.50.1, which "Check for updates…" claims is the current version. (I guess there's a delay between Emacs releases and downstream integration; hopefully my issue is not version-specific.) This distribution has some built-in markdown functionality but not (apparently) markdown-mode. Also, somewhere I read that there are additional packages (markdown2 and a couple of others) that I'd also like to try but which are likewise missing from my list-packages.

6
  • @Drew It is: stable.melpa.org/#/markdown-mode
    – Tobias
    Commented Jun 18, 2019 at 9:43
  • @Tobias: I used the URL you provided to download the .el file, then used package-install-file on the downloaded file. Emacs appeared to be doing stuff, then a Markdown menu appeared, so I guess markdown-mode is now installed. Thank you. Oddly, however, markdown still doesn't appear in M-x: list-packages. Also, this result implies that there are probably other packages that are not appearing in the list—e.g., markdown2, as I mentioned in the question.
    – 76 Pinto
    Commented Jun 18, 2019 at 15:23
  • Are there any mepla-stable packages listed in the output of package-list-packages? Sometimes there is an issue with the secure protocol and one has to use http in place of https.
    – Tobias
    Commented Jun 18, 2019 at 16:08
  • See these two discussions: melpa-issue, aquamacs-issue. In the second thread there are some solutions proposed.
    – Tobias
    Commented Jun 18, 2019 at 16:10
  • @Tobias: That appears to be it. The threads you linked to inspired me to check the Messages buffer, which confirmed that download of the ELPA list fails while trying to open a TLS connection. The latter thread is very long. I tried a workaround from near the bottom of it but without success, so I'll have to find time to pore through the thread carefully.<br /><br /> Edit: I used the link from your first comment to download the .el file and install it manually. It seems to work. I had for a while been fooled into thinking it had not worked because installed packages are sorted separately.
    – 76 Pinto
    Commented Jun 18, 2019 at 20:53

2 Answers 2

1

Every time this has happened to me, it's because you are trying to install an outdated package (i.e. the package has been updated in melpa, but not on your system, so you are asking melpa for an old package).

Try M-x: list-packages and it should be solved. (it will also inform you if you have any packages to update with u and execute with x.

Hope this helps.

7
  • I did M-x: list-packages but markdown-mode is not there.
    – 76 Pinto
    Commented Jun 18, 2019 at 14:51
  • No its only the installed packages. Upgrade them all and try package install again
    – Wolfeius
    Commented Jun 18, 2019 at 14:55
  • How do I do so? I thought that's what I accomplished when I did M-x: package-refresh-contents.
    – 76 Pinto
    Commented Jun 18, 2019 at 15:00
  • No, that function just refreshed the list. To upgrade run list-packages then hit U and then X as in my answer above
    – Wolfeius
    Commented Jun 18, 2019 at 15:03
  • I hit U and it just says No packages to upgrade. For what it's worth, every time I list-packages, it appears to be querying a remote URL.
    – 76 Pinto
    Commented Jun 18, 2019 at 15:07
1

I finally figured out a solution, and it's simple.

Tl;dr:

  1. Configure by editing ~/Library/Preferences/Aquamacs Emacs/Preferences.el as opposed to ~/init.el, which is where I had been hacking before. Aquamacs appears to ignore it.

  2. I configured startup like this:

    (setenv "PATH" (concat "~/bin.sh:/usr/local/bin:" (getenv "PATH")))
    (require 'gnutls)
    (add-to-list 'gnutls-trustfiles "/usr/local/etc/openssl/cert.pem")
    (require 'package)
    (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/"))
    (package-initialize)
    
    (That startup file might be messy in ways that I don't recognize because I'm new to emacs and elisp. In particular, I didn't know whether `(package-initialize)` belonged after each of the `(require)`s or just the last one.)

The longer story:

It might also be significant to note some of the steps I took prior to stumbling across the present solution, as they affected the state of the system. In particular, history | grep brew reveals

1718  brew install gnutls
1719  brew upgrade gnutls
1722  brew link --overwrite --dry-run gnupg
1723  brew link  gnupg
1726  sudo brew services start unbound
1727  brew install gnutls-cli
1729  brew install libffi
1730  brew link libffi
1734  brew uninstall libffi
1735  brew install libffi
1737  brew install libressl

I suspect that some of these are relevant because my solution only works when /usr/local/bin is present in PATH (the first line of Preferences.el).

I apologize that this answer is more recipe than insight but I hope it can help someone.

Thanks to all who engaged me on this question, especially @Tobias for pointing me in the direction of the TLS bug; also for the links, which taught me to look in the Messages buffer. I found the part with the cert.pm file in a short post by Stewart V. Wright on Vifortech Solutions' blog about this very problem but not specific to Aquamacs. The first line (the one that prepends to PATH) is from.

2
  • ~/.init.el isn't recognized by any version of Emacs. You want ~/.emacs.d/init.el which Emacs will read if ~/.emacs isn't found. Aquamacs will read ~/.emacs.d/init.el just fine (or ~/.emacs), and it will also read ~/Library/Preferences/Aquamacs Emacs/Preferences.el
    – nega
    Commented Jun 24, 2019 at 4:35
  • If you're using Homebrew, you should already have your shell setup to include /usr/local/bin as part of your path. ;) The Homebrew package, gnutls is now a soft dependency for Emacs as it contains gnutls-cli which the package system uses to open TLS connections. This is "new" as of Emacs v25 (I think... someone can correct me with the proper version number), and not very well documented except on mailing lists and SE, as far as I've seen.
    – nega
    Commented Jun 24, 2019 at 4:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.