arduino-mode Emacs file specification error - emacs

When I try to edit an Arduino Sketch (*.ino file), I get this error:
Eval error in the ‘c-lang-defconst’ for ‘c-constant-kwds’ in arduino-mode:
Eval error in the ‘c-lang-defconst’ for ‘c-basic-matchers-before’ in arduino-mode:
Eval error in the ‘c-lang-defconst’ for ‘c-matchers-2’ in arduino-mode:
File mode specification error: (invalid-function (append (quote (HIGH LOW INPUT OUTPUT INPUT_PULLUP LED_BUILTIN true false)) (c-get-lang-constant (quote c-constant-kwds) (quote (cc-langs)))))
This happens even on the stock examples->basic->Blink.ino file.
My .emacs.d/init.el file contains these lines:
(setq auto-mode-alist (cons '("\\.\\(pde\\|ino\\)$" . arduino-mode) auto-mode-alist))
(autoload 'arduino-mode "arduino-mode" "Arduino editing mode." t)
I can't find a 'c-matchers-2' file.
This is Emacs 26.1.
Can anyone point me in a direction to fix this error?
Thanks in advance for your help and advice.
-Kevin

#nega, you were right, it was a version issue. When I used M-x list-packages, I saw I had installed version 20151017.2335, and the most current was 20180509.36 by stardivirer. arduino-mode packages are in the melpa repository.
Thanks so much for your help in pointing me in the right direction.
-Kevin

Related

ox-hugo github actions : Debugger entered--Lisp error: (void-function org-hugo-export-wim-to-md) Error: Process completed with exit code 255

Im trying to deploy my hugo site on github actions. Im using the following github action which does the following :
1.On Ubuntu
2.Setup up emacs
3.git clone ox-hugo package
4.ox-hugo package should convert my .org files to .md
setup and build using Hugo and deploy
https://gist.github.com/shwetarkadam/d890b7054b65fe21b63609ca03650bdc
I'm facing an issue on step 4 where I encounter the following error on GitHub action :
Run emacs ./config.org --batch -L ./ox-hugo -L ox-hugo.el --eval="(org-hugo-export-wim-to-md t)" --kill
Debugger entered--Lisp error: (void-function org-hugo-export-wim-to-md)
(org-hugo-export-wim-to-md t)
eval((org-hugo-export-wim-to-md t) t)
command-line-1(("./config.org" "-L" "./ox-hugo" "-L" "ox-hugo.el" "--eval=(org-hugo-export-wim-to-md t)" "--kill"))
command-line()
normal-top-level()
Approaches tried till now :
Changing (org-hugo-export-wim-to-md t) to (org-hugo-export-wim-to-md :all-subtrees)
Adding the expression (org-hugo-export-wim-to-md :all-subtrees) in single quotes and double quotes.
I happened to be working on a similar problem today. I had searched for guidance on it and I stumbled across Batch export of org-mode files from the command line which led me to fniessen/orgmk and in orgmk.el in particular.
After experimenting in my *scratch* buffer and asking Emacs' various help facilities a few questions, I bludgeoned my way to a standalone file containing Emacs Lisp code that appears to work independently of my initialization files.
$ touch export.el
$ emacs -q --batch -l export.el
Designating package sites
Designating package site melpa-stable => https://stable.melpa.org/packages/
Designating package site melpa => https://melpa.org/packages/
Designating package site gnu => https://elpa.gnu.org/packages/
Installing package ox-hugo
Setting ‘package-selected-packages’ temporarily since "emacs -q" would overwrite customizations
‘ox-hugo’ is already installed
Exporting org subtrees to hugo from content.org
1 files scanned, 0 files contains IDs, and 0 IDs found.
[ox-hugo] 1/ Exporting ‘Redacted site title’ ..
[ox-hugo] 2/ Exporting ‘Posts’ ..
[ox-hugo] 3/ Exporting ‘Redacted post title’ ..
[ox-hugo] Exported 3 subtrees from content.org in 0.510s (0.170s avg)
Exporting all org subtrees in all files in /redacted/directory
$ find content -newer export.el
content
content/_index.md
content/posts
content/posts/redacted-post-title.md
content/posts/_index.md
(Some names have been changed to protect the guilty er um I mean innocent.)
The file export.el contains:
(defvar my/package-archives
(list
(cons "melpa-stable" "https://stable.melpa.org/packages/")
(cons "melpa" "https://melpa.org/packages/")
(cons "gnu" "https://elpa.gnu.org/packages/")))
(defvar my/packages-to-install '(ox-hugo))
(defun my/designate-package-site (site)
(message "Designating package site %s => %s" (car site) (cdr site))
(add-to-list 'package-archives site t))
(defun my/designate-package-sites ()
(message "Designating package sites")
(mapcar #'my/designate-package-site my/package-archives))
(defun my/install-package (pkg)
(message "Installing package %s" pkg)
(ignore-errors (package-install pkg)))
(when (locate-library "package")
(require 'package)
(my/designate-package-sites)
(package-initialize)
(unless package-archive-contents (package-refresh-contents))
(mapcar #'my/install-package my/packages-to-install))
(defun my/batch-ox-hugo-file (file)
(message "Exporting org subtrees to hugo from %s" file)
(let ((all-subtrees t)
(any-visibility nil))
(with-current-buffer (find-file-noselect file)
(org-hugo-export-wim-to-md all-subtrees any-visibility))))
(defun my/batch-ox-hugo-directory (directory)
(message "Exporting all org subtrees in all files in %s" directory
(let ((default-directory (expand-file-name directory)))
(mapcar #'my/batch-ox-hugo-file
(file-expand-wildcards "*.org")))))
(my/batch-ox-hugo-directory default-directory)
The execution environment where I developed this is Emacs 28.2 on FreeBSD 13.1.
I haven't tried it out with Github Actions yet, but that's my next step.

Cannot open new frames with undo-tree installed

I use undo-tree 0.6.5 (from Elpa), and it works quite well most of the time. However, if I have not yet called C-x-u on a buffer, then from this buffer I can't open a new frame. If I do C-x-5-2, Emacs opens the `Backtrace buffer with this:
Debugger entered--Lisp error: (wrong-type-argument undo-tree nil)
signal(wrong-type-argument (undo-tree nil))
undo-tree-current(nil)
(undo-tree-node-previous (undo-tree-current buffer-undo-tree))
(and undo-tree-mode (not buffer-read-only) (not (eq t buffer-undo-list)) (undo-tree-node-previous (undo-tree-current buffer-undo-tree)))
x-create-frame(((visibility) (vertical-scroll-bars . left) (reverse . t)))
x-create-frame-with-faces(((vertical-scroll-bars . left) (reverse . t)))
#f(compiled-function (params) #<bytecode 0x1fdd4b1bc7bf>)(((vertical-scroll-bars . left) (reverse . t)))
apply(#f(compiled-function (params) #<bytecode 0x1fdd4b1bc7bf>) ((vertical-scroll-bars . left) (reverse . t)))
frame-creation-function(((vertical-scroll-bars . left) (reverse . t)))
make-frame()
make-frame-command()
funcall-interactively(make-frame-command)
call-interactively(make-frame-command nil nil)
command-execute(make-frame-command)
Then, I do C-x-u so the undo-tree buffer related to that buffer is created, and from then on I can create other frames.
Is there a workaround for this?
edit: it also prevents the use of menus. When I try to click on any menu item, the same message shows up.
edit: opening Emacs with this minimalistic startup file gives the same error:
(add-to-list 'load-path
"~/.emacs.d/elpa/undo-tree-0.6.5")
(require 'undo-tree)
(global-undo-tree-mode)
(setq debug-on-error t)
Okay, so I got it working. I was using the ELPA version of undo-tree, which is version 0.6.5. So a couple of days ago I noticed that the developer has a new version in his git repository, 0.6.6. I installed it locally and the problem was gone!
First, get a copy of the git repository:
$ cd ~/.emacs.d
$ git clone http://www.dr-qubit.org/git/undo-tree.git
Then add this to your Emacs config:
(load "~/.emacs.d/undo-tree/undo-tree.el")
(require 'undo-tree)
(global-undo-tree-mode)

Org-journal won't recognize org-journal-dir?

Using the following use-package syntax, Org-journal doesn't recognize the org-journal-dir setting--instead, attempts to create a different directory with query Journal directory ~/Documents/journal not found. Create one?:
(use-package org-journal
:ensure t
:custom
(setq org-journal-dir "~/Dropbox/logs/journal/")
(setq org-journal-file-format "%m.%d.%Y.org"))
I see no error messages--it just seems to ignore the directory setting. Is this a simple syntax error? I'm new to the package and to Org mode.
[Update]: Sometimes, I get the following error message on Emacs start:
Error (use-package): org-journal/:catch: Symbol’s value as variable is void: org-journal-dir
The syntax for :custom is wrong. See https://github.com/jwiegley/use-package#customizing-variables. It should be something like:
:custom
(org-journal-dir "~/Dropbox/logs/journal/")
(org-journal-file-format "%m.%d.%Y.org")
Either that, or use :config (or maybe :init, but probably not) with setq:
:config
(setq org-journal-dir "~/Dropbox/logs/journal/")
(setq org-journal-file-format "%m.%d.%Y.org")

How do I choose/switch Leiningen profiles with Emacs nREPL?

I have a :dev profile set up in my leiningen project file. This defines an :init and :init-ns setting for my repl session. If I launch nrepl in emacs (M-x nrepl-jack-in) with the cursor over the :dev keyword in my project.clj, the repl launches and the :init and :init-ns settings are used. If I have my cursor elsewhere, the initial namespace is different (a test ns, not user), and :init hasn't been evaluated.
I'm guessing it's a feature of some sort, (I'm more inclined to think it's random buggy behaviour now) but can anyone explain it or point me at the docs that do so? Also, is there any way to change the profile once the repl's been launched?
Thanks
Contrary to what commenter #user7610 said, there is no cider-jack-in-with-profile function in cider. Cider pull-request #544 was a bit misleading in that regard.
If you want cider to load your own special-snowflake profile do this in emacs:
M-x set-variable cider-lein-parameters to e.g. with-profile +my-special-snowflake repl :headless
or to set the variable interactively (so you can see it's current value before changing it):
C-h, v cider-lein-parameters and then click or hit enter on "customize" and set it there to e.g. with-profile +my-special-snowflake repl :headless and apply it
That'll cause your next cider-jack-in to load the my-special-snowflake profile in addition to the base profile (which is needed in order to run the nrepl and hence cider).
Try this:
(defun start-cider-repl-with-profile ()
(interactive)
(letrec ((profile (read-string "Enter profile name: "))
(lein-params (concat "with-profile +" profile " repl :headless")))
(message "lein-params set to: %s" lein-params)
(set-variable 'cider-lein-parameters lein-params)
(cider-jack-in)))
Test on CIDER 0.16.0 (Riga)
I'm just searching the same feature and found this open issue in clojure-emacs/nrepl.el "Add argument to nrepl-jack-in to allow specification of profiles" https://github.com/clojure-emacs/nrepl.el/issues/327
it is still open
I try the function author by Jiacai Liu in my computer(GNU Emacs 26.2 (build 1, x86_64-apple-darwin18.2.0, NS appkit-1671.20 Version 10.14.3 (Build 18D109)) of 2019-04-13) . I get a error is:
eval-region: Wrong number of arguments: (1 . 1), 0
And then, I try to elisp function as:
(defun start-cider-repl-with-profile ()
(interactive)
(letrec ((profile (read-string "Enter profile name: "))
(lein-params (concat "with-profile +" profile " repl :headless")))
(message "lein-params set to: %s" lein-params)
(set-variable 'cider-lein-parameters lein-params)
(cider-jack-in '())))
Now it work. Thanks for Jiacai Liu!

cl-pdf output error

I'm trying to use cl-pdf for some fairly basic PDF generation, but I'm getting tripped up at the examples (which is embarassing to say the least).
When I run the first example included in the package
(defun example1 (&optional (file #P"/tmp/ex1.pdf"))
(pdf:with-document ()
(pdf:with-page ()
(pdf:with-outline-level ("Example" (pdf:register-page-reference))
(let ((helvetica (pdf:get-font "Helvetica")))
(pdf:in-text-mode
(pdf:set-font helvetica 36.0)
(pdf:move-text 100 800)
(pdf:draw-text "cl-pdf: Example 1"))
(pdf:translate 230 500)
(loop repeat 150
for i = 0.67 then (* i 1.045)
do (pdf:in-text-mode
(pdf:set-font helvetica i)
(pdf:set-rgb-fill (/ (random 255) 255.0)
(/ (random 255) 255.0)
(/ (random 255) 255.0))
(pdf:move-text (* i 3) 0)
(pdf:show-text "cl-typesetting"))
(pdf:rotate 13)))))
(pdf:write-document file)))
by running (example1 #P"/home/inaimathi/Desktop/ex1.pdf") it gives me this error
#<SB-SYS:FD-STREAM for "file /home/inaimathi/Desktop/test.pdf"
{CF9D931}> is not a binary output stream.
[Condition of type SIMPLE-TYPE-ERROR]
Restarts:
0: [ABORT] Exit debugger, returning to top level.
The same thing happens when I call (example1), or when I do
(with-open-file
(test-file #P"/home/inaimathi/Desktop/ex1.pdf"
:direction :output :if-does-not-exist :create)
(example1 test-file))
Finally, if I try
(with-open-file
(test-file #P"/home/inaimathi/Desktop/ex1.pdf"
:direction :output :if-does-not-exist :create
:element-type '(unsigned-byte 8))
(example1 test-file))
I get the error
#<SB-SYS:FD-STREAM for "file /home/inaimathi/Desktop/test.pdf"
{D197C99}> is not a character output stream.
[Condition of type SIMPLE-TYPE-ERROR]
Restarts:
0: [ABORT] Exit debugger, returning to top level.
Is there a way to declare a binary character stream? How do I get simple output out of cl-pdf? I'm using SBCL straight out of the debian repos (which is 1.0.29, I think), in case it matters.
(setf pdf:*compress-streams* nil) should help. It's trying to write binary data to a character stream, and while that works on LispWorks and some other systems, it doesn't work everywhere and particularly not on SBCL.
EDIT 2: asdf-install is unmaintained and deprecated. It is best to use Quicklisp. To install Quicklisp, you'll need to download it:
$ curl -O https://beta.quicklisp.org/quicklisp.lisp
Then add cl-pdf to your lisp installation:
$ sbcl --load quicklisp.lisp
* (quicklisp-quickstart:install)
* (ql:quickload "vecto")
* (ql:add-to-init-file)
* (exit)
Now all you need to do is add
(load "~/quicklisp/setup.lisp") ; if it installed in the default location
to your .lisp file, and you can then add
(ql:quickload "cl-pdf")
EDIT: This is what I ended up doing. The solution by xach above would also work.
In the end I had to wget http://www.fractalconcept.com/download/cl-pdf-current.tgz and install that.
For the newbs (since I remember how frustrating it is for someone new to Common Lisp to hear "just do a checkout and install it"):
1.Do the checkout as above (I assume you've done this in your home directory from now on)
2.Type in tar xvzf cl-pdf-current.tgz (the point is to get a tarball of the folder. You can do this through the GUI too, it makes no difference)
3.Hop into your SBCL prompt and enter
(require 'asdf)
(require 'asdf-install)
4.If you already installed cl-pdf using (asdf-install:install 'cl-pdf), then you'll need to enter (asdf-install:uninstall 'cl-pdf)
5.Type (asdf-install:install "/home/[your home folder name]/cl-pdf-current.tgz")
I got one compilation error throughout this process, which I just selected [Accept] for. It still seems to work fine.
Hopefully the upcoming release of quicklisp will reduce the need for this sort of package hunting.