2

I'm using Aquamacs Emacs 3.6 for Mac (I've got Ventura 13.4)

I am setting up an emacs file for my developing environment, with the following contents :

;;; .emacs --- Emacs conf file -*- coding: utf-8 -*-
;; ____________________________________________________________________________

(require 'package)

(with-eval-after-load 'tls 
  (setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3")
  (push "/usr/local/etc/libressl/cert.pem" gnutls-trustfiles))

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

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(diff-switches "-u")
 '(package-selected-packages
   '(learn-ocaml company merlin-iedit merlin-eldoc merlin tuareg magit-gitflow magit yaml-mode markdown-mode helpful discover-my-major which-key tabbar use-package))
 '(tapfa-init-coq nil)
 '(tapfa-init-cua nil))

(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(proof-locked-face ((t (:background "#add8e6"))))
 '(region ((t (:background "gold1" :distant-foreground "dim gray")))))

;; Bootstrap use-package

(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

(eval-when-compile
  (require 'use-package))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Config pour augmenter la découvrabilité

(use-package tabbar
  :ensure t
  :init
  (tabbar-mode t))

(use-package which-key
  :ensure t
  :config
  (which-key-mode))

(use-package discover-my-major
  :ensure t
  :config
  (global-set-key (kbd "C-h C-m") #'discover-my-major)
  (global-set-key (kbd "C-h M-m") #'discover-my-mode))

;; Recall we also have the standard keybinding "C-h m".

(use-package helpful
  :ensure t
  :config
  (global-set-key (kbd "C-h f") #'helpful-callable)
  (global-set-key (kbd "C-h v") #'helpful-variable)
  (global-set-key (kbd "C-h k") #'helpful-key)
  ;;; Look up Functions (excludes macros).
  ;; (global-set-key (kbd "C-h F") #'helpful-function)
  ;;; Look up Commands (= keybindings).
  ;; (global-set-key (kbd "C-h K") #'helpful-command)
  ;;; COMMENTED-OUT as "Info-goto-emacs[-key]-command-node" are more useful.
  (add-hook 'emacs-lisp-mode-hook #'(lambda ()
    (local-set-key (kbd "C-c C-.") #'helpful-at-point))))

;; Note we can also type "C-h" after a prefix to list its expansions.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Config de markdown-mode (to edit README.md files easily!) and yaml-mode

(use-package markdown-mode
  :ensure t)

(use-package yaml-mode
  :ensure t)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Config de Magit
;; Copied-from: https://gist.github.com/erikmd/82c4b2a50a77c98e8fe6318530c531b7

;;; Pour plus d'infos :
;; https://github.com/magit/magit et https://magit.vc (doc officielle)
;; https://youtu.be/mtliRYQd0j4 (tuto vidéo sur git-rebase avec Magit)

(use-package magit
  :ensure t
  :defer t
  :config
  (setq magit-diff-refine-hunk 'all)
  :bind (("C-x g" . magit-status)
         ("C-x M-g" . magit-dispatch-popup)))

(use-package magit-gitflow
  :ensure t
  :after magit
  :config (add-hook 'magit-mode-hook 'turn-on-magit-gitflow))

;; Protect against accident pushes to upstream/pushremote
;; compatible with https://github.com/magit/magit/pull/3813
;; tested with magit-20200927.1644
(defadvice magit-push-current-to-upstream
    (around my-protect-accidental-magit-push-current-to-upstream)
  "Protect against accidental push to upstream.
Causes `magit-run-git-async' to ask the user for confirmation first."
  (let ((my-magit-ask-before-push t))
    ad-do-it))

(defadvice magit-push-current-to-pushremote
    (around my-protect-accidental-magit-push-current-to-pushremote)
  "Protect against accidental push to upstream.
Causes `magit-run-git-async' to ask the user for confirmation first."
  (let ((my-magit-ask-before-push t))
    ad-do-it))

(defun magit-git-to-string (args)
  "Pretty-print the `magit-run-git-async' arguments.
Quote the substrings if need be."
  (cond ((not args)
         "")
        ((stringp args)
         (shell-quote-argument args))
        ((listp args)
         (mapconcat #'magit-git-to-string args " "))
        (t (error "Unrecognized: %s" (pp-to-string args)))))
;(magit-git-to-string '("push" "-v" ("--force-with-lease") "origin" "master:refs/heads/master"))

(defadvice magit-run-git-async (around my-protect-accidental-magit-run-git-async)
  "Maybe ask the user for confirmation before pushing.
Advices to `magit-push-current-to-*' trigger this query."
  (if (bound-and-true-p my-magit-ask-before-push)
      ;; Arglist is (ARGS)
      (if (y-or-n-p (format "Run 'git %s'? "
                               (magit-git-to-string (ad-get-args 0))))
          ad-do-it
        (error "Push aborted by user"))
    ad-do-it))

(setq ad-redefinition-action 'accept)

(ad-activate 'magit-push-current-to-upstream)
(ad-activate 'magit-push-current-to-pushremote)
(ad-activate 'magit-run-git-async)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Config de Tuareg, Merlin et Company

(setq tapfa-opam-available (eq (shell-command "opam var bin") 0))

(if tapfa-opam-available
    (use-package tuareg
      :ensure t
      :defer t
      :init
      (setq tuareg-opam-insinuate t))
  (use-package tuareg
    :ensure t
    :defer t))

;;;  Désactivé car le raccourci associé à <home> est malencontreux
;; (use-package bifocal
;;   :ensure t
;;   :hook
;;   (tuareg-interactive-mode . bifocal-mode))

(if tapfa-opam-available
    (use-package merlin
      :ensure t
      :hook
      ((tuareg-mode caml-mode) . merlin-mode)
      :config
      (setq merlin-command 'opam))
  (use-package merlin
    :ensure t
    :hook
    ((tuareg-mode caml-mode) . merlin-mode)
    :config
    (setq merlin-command "ocamlmerlin")))

(use-package merlin-eldoc
  :ensure t
  :hook
  ((tuareg-mode caml-mode) . merlin-eldoc-setup)
  :bind (:map merlin-mode-map
              ("C-c <C-left>" . merlin-eldoc-jump-to-prev-occurrence)
              ("C-c <C-right>" . merlin-eldoc-jump-to-next-occurrence)))

(use-package merlin-iedit
  :ensure t
  :after merlin-eldoc
  :bind (:map merlin-mode-map
              ("C-c C-o" . merlin-iedit-occurrences)))

(use-package company
  :ensure t
  :hook
  ((tuareg-mode caml-mode) . company-mode)
  :config
  (bind-key "<backtab>" 'company-complete))

(use-package learn-ocaml
  :ensure t)


When I launch Aquamacs I have the following error message. The majority of packages are installed successfully, except for the following ones

Error (use-package): Failed to install discover-my-major: Package ‘discover-my-major-’ is unavailable
Error (use-package): Cannot load discover-my-major
Error (use-package): Failed to install helpful: Package ‘helpful-’ is unavailable
Error (use-package): Cannot load helpful
Error (use-package): Failed to install markdown-mode: Package ‘markdown-mode-’ is unavailable
Error (use-package): Failed to install yaml-mode: Package ‘yaml-mode-’ is unavailable
Error (use-package): Cannot load yaml-mode
Error (use-package): Failed to install magit: Package ‘magit-’ is unavailable
Error (use-package): Failed to install magit-gitflow: Package ‘magit-gitflow-’ is unavailable
Error (use-package): Failed to install tuareg: Package ‘tuareg-’ is unavailable
Error (use-package): Failed to install merlin: Package ‘merlin-’ is unavailable
Error (use-package): Failed to install merlin-eldoc: Package ‘merlin-eldoc-’ is unavailable
Error (use-package): Failed to install merlin-iedit: Package ‘merlin-iedit-’ is unavailable
Error (use-package): Failed to install learn-ocaml: Package ‘learn-ocaml-’ is unavailable
Error (use-package): Cannot load learn-ocaml

package-refresh-contents is executed successfully, I think the error might be because of gnutls ; to see if something was loaded I tried M-x eww RET https://www.wikipedia.org/ RET but I got the error GnuTLS error: #<process www.wikipedia.org>, -430

Thank you if you can help me !

Tariot
  • 23
  • 3
  • 3
    Perhaps you should try to cut out as many unnecessary code snippets as possible in order to make this question easier to analyze and answer. – shynur Apr 05 '23 at 10:23

1 Answers1

0

The issue you reported certainly comes from GnuTLS indeed, the version of which being "too old" in Aquamacs 3.6 (based on Emacs 25).

Hence the following suggestion: uninstall Aquamacs and just install GNU Emacs 28+ instead (e.g., run brew install --cask emacs)

ErikMD
  • 126
  • 5