I'm running into this error when trying to load an auto generated autoload.el file using loaddefs-generate function. The following is how I did
;;; core-autoload.el -*- lexical-binding: t; -*-
(defvar generated-autoload-file nil
"This is neccessary, otherwise raise error.
`Defining as dynamic an already lexical var`.")
(defvar chidori-autoload-file
(expand-file-name "autoload.el" chidori-cache-dir)
"Autoload file.")
(defun chidori-autoload/generate-define (loaddef &rest DIRS)
"LOADDEF DIRS."
(let ((generated-autoload-file loaddef))
(when (or (not (file-exists-p generated-autoload-file))
noninteractive)
(loaddefs-generate DIRS chidori-autoload-file))))
(defun chidori-autoload/reload ()
"Generate autoload file from `core/autoload'."
(interactive)
(when (file-exists-p chidori-autoload-file)
(delete-file chidori-autoload-file t)
(message "delete old autoload file: %s" chidori-autoload-file))
(chidori-autoload/generate-define chidori-autoload-file chidori-autoload-dir)
(load chidori-autoload-file nil 'nomessage)
(message "generate autoload file: %s done." chidori-autoload-file))
(unless (file-exists-p chidori-autoload-file)
(chidori-autoload/reload))
(load chidori-autoload-file nil 'nomessage)
(provide 'core-autoload)
;; core-autoload.el ends here
And this is part of generated autoload file
;;; autoload.el --- automatically extracted autoloads (do not edit) -*- lexical-binding: t -*-
;; Generated by the `loaddefs-generate' function.
;; This file is part of GNU Emacs.
;;; Code:
;;; Generated autoloads from ../../autoload/package.el
(autoload 'package! "../../autoload/package")
;;; and many other autoloads
However, when I start Emacs, the error occurred saying it (file-missing "Cannot open load file" "No such file or directory" "../../autoload/package"
If I manually edit to absolute path, the issue is gone. But I don't think it's right way to do.
Can anyone help me out?
My draft for further reference:
https://git.sr.ht/~bangedorrunt/chidori-emacs
The following is my system information:
OS: macOS 12.6
Emacs versions: emacs-plus#29
Terminal: Wezterm
Shell: fish
I finally figured out the issue.
In my config, I got
(defvar chidori-etc-dir (expand-file-name "etc/" user-emacs-directory))
(defvar chidori-cache-dir (expand-file-name "cache/" chidori-etc-dir))
The issue is fixed if I replace chidori-etc-dir with the following
(defvar chidori-cache-dir (expand-file-name "cache/" user-emacs-directory))
From my understanding, we couldn't 2 level nested dir for autoload file. This also happen if I write autoload file to user-emacs-directory.
Related
I am using DrRacket and produced a file, hello.scm in emacs with the following content:
#! /usr/bin/env racket
;The first program
(begin
(display "Hello, World!")
(newline))
I then tried to compile the file at the terminal by using le$ racket hello.scm, and received this result:
Le-MacBook-Pro:~le$ racket hello.scm
default-load-handler: expected a `module' declaration, but found
something else
file: /Users/le/hello.scm
context...:
default-load-handler
standard-module-name-resolver
module-path-index-resolve
[repeats 1 more time]
module-declared?
Moreover, when I copy and paste the content of the emacs file into DrRacket and click Run, I receive the following message:
Module Language: only a module expression is allowed, either
#lang <language-name>
or
(module <name> <language> ...)
in: (begin (display "Hello, World!") (newline))
Interactions disabled.
What exactly is the problem?
The problem was solved by adding #lang racket at the top of the emacs file.
I use use-package for my emacs configuration.
Unfortunately I cannot properly configure the flycheck package to work with C++11 extension.
Here what I have so far:
;; == Flycheck ==
(use-package flycheck
:ensure t
:defer t
:init
(global-flycheck-mode)
:config
(setq flycheck-clang-language-standard "c++11"))
Although I set the proper variable, the flycheck gives me an error on c++11 syntax (e.g. auto i = 10).
What am I missing?
I think I had the same problem once. I cannot test it right now (will do it later today) but what I finally did was adding a hook to c++-mode rather than setting flycheck-clang-language-standard variable.
Here is code from my init file.
(add-hook 'c++-mode-hook
(lambda () (setq flycheck-clang-language-standard "c++11")))
You can try to use it in your use-package.
EDIT
Okay, I just checked it. When in my init.el file I have only
(require 'flycheck)
(flycheck-mode)
(setq flycheck-clang-language-standard "c++11")
flycheck highlights auto variable in a cpp file and I can see in the minibuffer following information.
rvalue references are a C++ extension
When I change my init.el file to
(require 'flycheck)
(flycheck-mode)
(add-hook 'c++-mode-hook
(lambda () (setq flycheck-clang-language-standard "c++11")))
There is no error.
I am a complete novice at both OSX and Emacs, so unsurprisingly I'm struggling to install ECB on Aquamacs.
I followed the instructions given at https://docwhat.org/aquamacs-2-3a-and-marmalade/ using Aquamacs 3.0, but when installing the ecb-snapshot package I get the following errors:
ecb-semantic-wrapper.el:41:1:Error: Cannot open load file:
no such file or directory, semantic-ctxt
jn-file-tree.el:31:1:Error: Cannot open load file: no such file or directory,
jn-tree-node
jn-tree-node.el:32:1:Error: Cannot open load file: no such file or directory,
jn-utils
jn-tree-view.el:31:1:Error: Cannot open load file: no such file or directory,
jn-window
jn-window.el:44:25:Error: Invalid lambda variable
(parent jn-window-container)
test.el:31:1:Error: Cannot open load file: no such file or directory,
jn-tree-view
Any help with this would be greatly appreciated.
You shall better rely on el-get to install it.
Here is my personnal config to make it works:
;; =========== EL-Get =============
;; See https://github.com/dimitri/el-get
(add-to-list 'load-path "~/.emacs.d/vendor/el-get")
(unless (require 'el-get nil 'noerror)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.github.com/dimitri/el-get/master/el-get-install.el")
(let (el-get-master-branch)
(goto-char (point-max))
(eval-print-last-sexp))))
(require 'el-get)
(require 'el-get-status)
(setq el-get-byte-compile nil)
;; Load the local recipes
(add-to-list 'el-get-recipe-path "~/.emacs.d/el-get/recipes")
;; (setq el-get-sources '(cedet
;; ))
(setq el-get-sources
'((:name ecb
:type git
:url "https://github.com/alexott/ecb.git"
:load "ecb.el"
:compile ("ecb.el"))
))
(setq my-packages
(append '(el-get)
(mapcar 'el-get-source-name el-get-sources)))
(el-get 'sync my-packages)
Hy Guys, I still have a problem running my emacs in the terminal on osx. Now when I open a new file I get this error message:
Warning (initialization): An error occurred while loading `/Users/den/.emacs.d/init.el':
error: Mac native windows are not in use or not initialized
when I run emacs --debug-init I get this output:
Debugger entered--Lisp error: (error "Mac native windows are not in use or not initialized")
x-display-pixel-width()
(- (x-display-pixel-width) 918)
(defvar emacs-min-left (- (x-display-pixel-width) 918))
(if running-alternate-emacs (progn (defvar emacs-min-top (if (= 1050 (x-display-pixel-heigh$
(if noninteractive nil (if running-alternate-emacs (progn (defvar emacs-min-top (if (= 1050$
eval-buffer(#<buffer *load*> nil "/Users/den/.emacs.d/init.el" nil t) ; Reading at buffer$
load-with-code-conversion("/Users/den/.emacs.d/init.el" "/Users/den/.emacs.d/init.el" t t)
load("/Users/den/.emacs.d/init" t t)
#[0 "^H\205\262^# \306=\203^Q^#\307^H\310Q\202;^# \311=\204^^^#\307^H\312Q\202;^#\313\3$
command-line()
normal-top-level()
I check my init.el file could not find a mistake, but to be honest I do not really understand the debug output. I could not find any context about this error on either google or stackoverflow.
Your init.el file calls x-display-pixel-width unconditionally, but that function doesn't work when running Emacs in a terminal.
Change init.el to only use x-display-pixel-width if window-system is non-nil, e.g.:
(when window-system
... include the piece of code defining emacs-min-left here
)
I am receiving this error.
Error (flymake): Flymake: Failed to launch syntax check process 'php' with args (-f test_flymake.php -l): Searching for program: no such file or directory, php. Flymake will be switched OFF
I am on windows 7 with emacs 24 GNU Emacs 24.1.1 (i386-mingw-nt6.1.7601)
There is an article which highlights this error but it is referring to checking /etc in linux however I am on windows. http://sachachua.com
This is the currently relevant part of my .emacs, what can I do to get it working.
(add-to-list 'load-path "C:/Users/renshaw family/AppData/Roaming/.emacs.d/elpa/flymake-0.4.11")
(require 'flymake)
(global-set-key [f3] 'flymake-display-err-menu-for-current-line)
(global-set-key [f4] 'flymake-goto-next-error)
;;(require 'flymake-php)
(require 'zencoding-mode)
(add-hook 'sgml-mode-hook 'zencoding-mode) ;; Auto-start on any markup modes
(defun flymake-php-init ()
"Use php to check the syntax of the current file."
(let* ((temp (flymake-init-create-temp-buffer-copy 'flymake-create-temp-inplace))
(local (file-relative-name temp (file-name-directory buffer-file-name))))
(list "php" (list "-f" local "-l"))))
(add-to-list 'flymake-err-line-patterns
'("\\(Parse\\|Fatal\\) error: +\\(.*?\\) in \\(.*?\\) on line \\([0-9]+\\)$" 3 4 nil 2))
(add-to-list 'flymake-allowed-file-name-masks '("\\.php$" flymake-php-init))
;; Drupal-type extensions
(add-to-list 'flymake-allowed-file-name-masks '("\\.module$" flymake-php-init))
(add-to-list 'flymake-allowed-file-name-masks '("\\.install$" flymake-php-init))
(add-to-list 'flymake-allowed-file-name-masks '("\\.inc$" flymake-php-init))
(add-to-list 'flymake-allowed-file-name-masks '("\\.engine$" flymake-php-init))
(add-hook 'php-mode-hook (lambda () (flymake-mode 1)))
(define-key php-mode-map '[M-S-up] 'flymake-goto-prev-error)
(define-key php-mode-map '[M-S-down] 'flymake-goto-next-error)
Edit:
I have now tried this in ubuntu 12.04 as well and receive the same error.
It looks like flymake can't find the PHP interpreter. Try adding an explicit hint about where to find PHP.
One way you could do this is by adding the following defun to your .emacs:
(defun my-flymake-get-php-cmdline (source base-dir)
"Gets the command line invocation needed for running a flymake
session in a PHP buffer. This gets called by flymake itself."
(list "C:\Path\to\PHP\php.exe"
;; Or the path to the PHP CLI executable on the Ubuntu machine you mentioned.
(list "-f" source "-l")))
Then modifying the flymate-php-init you're using now into this:
(defun flymake-php-init ()
"Use php to check the syntax of the current file."
(let* (
(temp
(flymake-init-create-temp-buffer-copy 'flymake-create-temp-inplace))
(local
(file-relative-name temp (file-name-directory buffer-file-name))))
(get-cmdline-f 'my-flymake-get-php-cmdline)))
This advice is heavily based on this answer from someone else using flymake on Windows for PHP. You might also find that answer helpful, since their situation is similar to yours.