Hello friends!
I've moved to a new computer and a new OS (Gentoo) and I'd like to ask a few questions that have come up now that I've copied my configurations over to my new machine.
## `native-ice` error
So one interesting thing I've run across with Emacs Native-Comp on Gentoo is this issue.
Error: native-ice ("failed to compile" "/home/alec/.emacs.d/.local/cache/eln/29.0.50-c02ad32e/subr--trampoline-6d657373616765_message_0.eln" "error invoking gcc driver")
debug-early-backtrace()
debug-early(error (native-ice "failed to compile" "/home/alec/.emacs.d/.local/cache/eln/29.0.50-c02ad32e/subr--trampoline-6d657373616765_message_0.eln" "error invoking gcc driver"))
comp--compile-ctxt-to-file("/home/alec/.emacs.d/.local/cache/eln/29.0.50-c02ad32e/subr--trampoline-6d657373616765_message_0.eln")
comp-compile-ctxt-to-file("/home/alec/.emacs.d/.local/cache/eln/29.0.50-c02ad32e/subr--trampoline-6d657373616765_message_0.eln")
comp-final1()
load-with-code-conversion("/tmp/emacs-int-comp-subr--trampoline-6d657373616765_message_0-E7thlL.el" "/tmp/emacs-int-comp-subr--trampoline-6d657373616765_message_0-E7thlL.el" nil t)
command-line-1(("-l" "/tmp/emacs-int-comp-subr--trampoline-6d657373616765_message_0-E7thlL.el"))
command-line()
normal-top-level()
Very strange. However, looking at the `*Messages*` buffer I *also* find.
Compiling /home/alec/.emacs.d/.local/cache/eln/29.0.50-c02ad32e/subr--trampoline-6d657373616765_message_0.eln...
libgccjit.so: error: bad value 'native' for '-march=' switch
libgccjit.so: note: valid arguments to '-march=' switch are: nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client rocketlake icelake-server cascadelake tigerlake cooperlake sapphirerapids alderlake bonnell atom silvermont slm goldmont goldmont-plus tremont knl knm x86-64 x86-64-v2 x86-64-v3 x86-64-v4 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 znver2 znver3 btver1 btver2 native
Assembler messages:
Error: can't open /tmp/libgccjit-abJtEq/fake.s for reading: No such file or directory
libgccjit.so: error: error invoking gcc driver
Internal native compiler error: "failed to compile", "/home/alec/.emacs.d/.local/cache/eln/29.0.50-c02ad32e/subr--trampoline-6d657373616765_message_0.eln", "error invoking gcc driver"
Interesting. So normally with GCC you can specify `-march=native` and that will be expanded at compile time(?). But here in Emacs in the variable `native-comp-compiler-options` you can't specify `-march=native`?
That also begs the question of what else can you not specify in that variable?
## Ignoring files for Project.el
This I'm asking because it's been a bit since I touched this part of my config. I know there's a way to tell project.el to ignore certain files when searching through a project. However I do have a different search function for project.el that uses consult:
(defun project:project-root (&optional dir)
"Return the current project root of DIR (defaults to ‘default-directory’).
Returns nil if not in a project."
(if dir
(project-root dir)
(project-root (project-current))))
(defun project:search ()
"Find files in ‘project-root’ with ripgrep/grep."
(interactive)
(let ((proot (project:project-root)))
(if (executable-find "rg")
(consult-ripgrep proot)
(consult-grep proot))))
And for ripgrep I have a [configuration file](https://privatebin.net/?cdaf580b58a8bc46#2hrfFVe5N56SRighwULWbo9BhxxC9dD3egaZ3CdeDVfN) to ignore a lot of directories.
Should I still configure project.el to ignore files and, uh, how do I do it again? Somewhere there was a link to either the Emacs manual or someone's blog post about this, but I have no idea where it would be.
## Consulting Eshell History.
I've been meaning to fix this for a bit, but I have the following to use consult to search through Eshell history.
;;; View eshell command histroy with Consult
;;;
;;;###autoload
(defvar consult--eshell-hist nil)
;;;###autoload
(defun consult:eshell-hist-action (cmd)
(let ((buf (if (eq major-mode 'eshell-mode)
(current-buffer))))
(with-current-buffer buf
(goto-char eshell-last-output-end)
(goto-char (line-end-position))
(insert cmd))))
;;;###autoload
(defvar consult:eshell-hist-source
`(:name "Eshell History"
:narrow ?<
:face 'eshell-prompt-face
:histroy 'eshell-history-ring
:action ,#'consult--eshell-hist-action
:items
,(lambda ()
(let ((hist (if (not (ring-empty-p eshell-history-ring))
(delete-dups (ring-elements eshell-history-ring))
(message "No history"))))
hist))))
;;;###autoload
(defun consult:eshell-history ()
(interactive)
(let ((hist (consult--read consult:eshell-hist-source
:prompt "Command: "
:history 'consult--eshell-hist
:require-match t
:sort nil)))
(unless (cdr hist)
(eshell-list-history))))
;;;###autoload
(defun eshell:search-history ()
"Search the eshell command history with consult & selectrum."
(interactive)
(require 'em-hist)
(if (package-installed-p 'consult)
(consult:eshell-history)
(eshell-list-history)))
The error when envoking the last function is:
consult--read: Assertion failed: (or (functionp candidates) (obarrayp candidates) (hash-table-p candidates) (not candidates) (stringp (car candidates)) (and (consp (car candidates)) (stringp (caar candidates))) (and (consp (car candidates)) (symbolp (caar candidates))))
I'm guessing it's because `delete-dups` doesn't return a new list?
## Actually Tab-N-Go with Corfu
I really like Corfu and [Cape]() together. One *tiny* thing that I can't seem to get working though is actual tab-n-go completion. I have the following configurations for Corfu and Cape
(use-package corfu
:hook (after-init . global-corfu-mode)
:general (:keymaps 'corfu-map
"TAB" #'corfu-next
[tab] #'corfu-next
"C-n" #'corfu-next
"S-TAB" #'corfu-previous
[backtab] #'corfu-previous
"C-p" #'corfu-previous
"RET" #'corfu-insert
[return] #'corfu-insert
"M-d" #'corfu-show-documentation
"M-l" #'corfu-show-location)
:preface
(defun corfu:in-minibuffer ()
"Allow for Corfu in the minibuffer."
(unless (or (bound-and-true-p mct--active)
(bound-and-true-p vertico--input))
(setq-local corfu-auto nil)
(corfu-mode +1)))
:custom
(corfu-cycle t)
(corfu-auto t)
(corfu-preselect-first nil)
(corfu-preview-current t)
(corfu-auto-delay 0.25)
(corfu-quit-no-match t)
(corfu-quit-at-boundary t)
(corfu-scroll-margin 6)
(corfu-echo-documentation nil)
:config
(add-hook 'minibuffer-setup-hook #'corfu:in-minibuffer 1))
(use-package cape
:after corfu
:preface
(defvar cape:elisp-capf (list
(cape-capf-buster
(cape-super-capf
#'cape-keyword
#'cape-symbol
#'cape-abbrev
#'cape-dabbrev))
#'cape-file)
"A ‘cape-super-capf’ that’s similar to most simpler Company configurations.
The defacto cape to use for Emacs Lisp.")
(defvar cape:mega-writing-capf (list
(cape-capf-buster
(cape-super-capf #'cape-dict
#'cape-ispell
#'cape-abbrev
#'cape-dabbrev)))
"A ‘cape-super-capf’ for modes for writing.
The defacto cape to use for markup languages for writing.")
:custom
(cape-dict-file (expand-file-name "~/.local/share/dict/words"))
(cape-dabbrev-min-length 2)
:config
(setq-mode-local emacs-lisp-mode
completion-at-point-functions cape:elisp-capf))
However I still have to press enter when on the selection I want in the completion menu to continue typing the next word. Maybe that's what tab-n-go actually is, but I would like to be able to do how it's done in Company and select a completion target by having in selected in the completion menu, and then being able to press space to move on to the next word. Not entirely sure how I'd go about that with Corfu.
Thank you for any advice/tips you give!