emacs-auctex refuses to open .tex-files - emacs

After installing emacs 28.1 and auctex 13.1 I can't open .tex-files any longer.
If I enter in emacs Ctrl-x -f Blau-2022-03-20.tex I get
Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
replace-regexp-in-string("\[ \\11\\15\\n%\]" "" nil)
LaTeX-xparse-macro-parse(mac)
LaTeX-xparse-auto-cleanup()
run-hooks(TeX-auto-cleanup-hook)
TeX-auto-parse()
run-hooks(TeX-update-style-hook)
TeX-update-style(t)
#f(compiled-function () #\<bytecode -0x12260f12797895d8\>)()
run-hooks(find-file-hook)
after-find-file(nil t)
find-file-noselect-1(#\<buffer Blau-2022-03-20.tex\> "\~/Desktop/Eigene Dokumente/Briefe/Blau- 2022-03-20...." nil nil "\~/Desktop/Eigene Dokumente/Briefe/Blau-2022-03-20...." (790801 2051))
find-file-noselect("\~/Desktop/Eigene Dokumente/Briefe/Blau-2022-03-20...." nil nil t)
find-file("\~/Desktop/Eigene Dokumente/Briefe/Blau-2022-03-20...." t)
funcall-interactively(find-file "\~/Desktop/Eigene Dokumente/Briefe/Blau-2022-03-20...." t)
call-interactively(find-file nil nil)
command-execute(find-file)
an can't open the file at all. If I click on the four dots, .tex appears.
BTW: It works with .tex~-files.
I have no idea what I could try, it worked for decades...
The question has been asked since 2014, but all solutions I found didn't work for me.
PS: It works if I enter myfile.tex for a second time. So after Ctr-x -f myfile.tex I get the strange message, but after another Ctr-x -f myfile.tex I can open the file as usual.

Related

ido-completing-read interaction with _ and -, hides possible results

When using ido-completing-read
(ido-completing-read "Which tag: " '("DALL-E" "monoidallens") nil t)
it finds both tags when I type "dall" but once I enter "dalle" it no longer finds "DALL-E"
Which tag: dall{DALL-E | monoidallens}
Which tag: dalle[monoidallens]
Whereas if I add an underscore to the "monoidal_lens" tag
(ido-completing-read "Which tag: " '("DALL-E" "monoidal_lens") nil t)
the input "dall" only matches "DALL-E" and while the input "dalle" matches both.
Which tag: dall[DALL-E]
Which tag: dalle{DALL-E | monoidal_lens}
Why does this happen? Is there a way to show all possible suggestions, adding more characters should not make suggestions go away.

Evaluating variables in Racket response/xexpr

I'm trying to make a simple bookmarking web-app in Racket.
It's meant to receive a url as a CGI argument, and right now, I'm just trying to confirm I received it by reflecting it back.
(define (start request)
(response/xexpr
(let* ([bindings (request-bindings request)]
[url (if (exists-binding? 'url bindings)
(extract-binding/single 'url bindings)
"NO URL")])
`(html
(head (title "TITLE"))
(body (h2 "TITLE")
(p "URL = " url))
))))
However, instead of seeing what I expect to see .. which is a page that contains
URL = http://google.com
I'm seeing
URL = &url;
Which suggests that url is being quoted literally in the xexpr (treated as an entity), rather than being evaluated as a variable.
So what am I doing wrong? How do I get url evaluated?
You need to use quasiquote and unquote to inject values into a quoted experession, more often seen as their reader abbreviation equivalents, ` and ,, respectively. When you use unquote/, inside of quasiquote/`, it will evaluate the expression and insert it into the surrounding quotation:
> (define url "http://google.com")
> `(p "URL = " ,url)
(p "URL = " "http://google.com")
You should put , in front of url in your template to unquote it.
For a more detailed explanation of quotation and quasiquotation, see Appendix A of this answer.
Use ,url :
`(html
(head (title "TITLE"))
(body (h2 "TITLE")
(p "URL = " ,url))
))))
Look for unquote in the documentation: http://docs.racket-lang.org/reference/quasiquote.html?q=unquote#%28form.%28%28quote.~23~25kernel%29._unquote%29%29

When creating a customizable value with defcustom, how can I validate users' entries?

I'm writing an elisp file that's evolving into a package, so I'm translating some of its variables into defcustom statements and documenting them. A few of these defcustom variables are related, and I'd like to validate values entered through the Customize system to ensure that the relationships hold true.
Here's an example of what I have:
(defcustom widget-canonical-names '("my_widget" . "widget_assembly 8911_j4")
"Documentation"
:type '(alist :key-type (string :tag "Widget's short name")
:value-type (string :tag "Full widget name"))
:risky nil
:group 'widgets)
(defcustom widget-colors '("my_widget" . "brown")
"Documentation"
:type '(alist :key-type (string :tag "Widget's short name")
:value-type (color :tag "color of the widget"))
:risky nil
:group 'widgets)
(defcustom widget-paths '("my_widget" . "~/widgets")
"Documentation"
:type '(alist :key-type (string :tag "Widget's short name")
:value-type (directory :tag "support files for widget"))
:risky nil
:group 'widgets)
So there are widgets and they have various settings, and I need to be able to access an arbitrary setting for a widget by knowing just the widget's short name. I'd like to make a validation function of some kind (googling around for "emacs defcustom validate" hasn't helped, unfortunately) such that if the user enters a widget name in widget-paths or widget-colors that is not in the widget-canonical-names list, they get an "are you sure?" warning and are cautioned about entering mismatched names. Can I attach such a validation function to my defcustoms? If so, what's the syntax for that?
Of course, what would be ideal would be to just make the user enter the short name once, but I can't figure out how to do that from the 'Composite Types' elisp documentation. So an even better answer to my question would tell me how to arrange a defcustom that sets up a data structure similar to this Python dict:
customized_widgets = {
"my_widget": { "canonical_name": "widget_assembly 8911_j4",
"widget_color": "brown",
"widget_path": "~/widgets",
},
"another_widget": { "canonical_name" : "widget_obsolete 11.0",
"widget_color": "blue",
"widget_path": "~/blue_widgets",
},
}
So: how can I get the behavior I want, where settings are grouped according to the data that'll be used to access them, or where a validation function warns users when they might be entering inconsistent data?
This will define the closest Emacs equivalent of that Python structure, with dicts represented as alists, and fixed keys of the inner dict represented as symbols.
(defcustom my-customized-widgets ()
"My widget customization alist"
:type '(alist
:tag "Widgets"
:key-type (string :tag "Short name")
:value-type
(set
:format "%v"
:entry-format "%b %v"
(cons :format "%v"
(const :format "" widget-canonical-name)
(string :tag "CName"))
(cons :format "%v"
(const :format "" widget-color)
(color :tag "Color"))
(cons :format "%v"
(const :format "" widget-path)
(directory :tag " Path"))))
:group 'widgets)

Libraries for making Eclipse plugin development easier?

I'm just learning Eclipse plugin development, currently for the purpose of adding a few simple custom commands that nobody else has bothered to implement. I've noticed that the Eclipse plugin API... leaves a lot to be desired. Are there any open source libraries which attempt to improve the plug-in development experience? (I've started to idly speculate about writing my own...).
I know Eclipse 4.0 is supposed to fix some of these issues long-term, but I'm unlikely to be able to move to it at work any time soon.
Edit
Here's an example of what I mean. This is an implementation of "hungry delete" functionality for emacs:
(defmacro hungry-delete-backward (&optional limit)
(if limit
`(let ((limit (or ,limit (point-min))))
(while (progn
;; skip-syntax-* doesn't count \n as whitespace..
(skip-chars-backward " \t\n\r\f\v" limit)
(and (eolp)
(eq (char-before) ?\\)
(> (point) limit)))
(backward-char)))
'(while (progn
(skip-chars-backward " \t\n\r\f\v")
(and (eolp)
(eq (char-before) ?\\)))
(backward-char))))
And here is part of an equivalent implementation for Eclipse, not including the manifest file, plugin.xml, or the Activator for the plugin:
#Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editor = HandlerUtil.getActiveEditorChecked(event);
if (!(editor instanceof ITextEditor)) return null;
ITextEditor ite = (ITextEditor) editor;
IDocumentProvider idp = ite.getDocumentProvider();
IDocument doc = idp.getDocument(ite.getEditorInput());
ISelection selection = ite.getSelectionProvider().getSelection();
if (!(editor instanceof ITextSelection)) return null;
ITextSelection its = (ITextSelection) selection;
int currentCursorPosition = its.getOffset();
int deletionStart, deletionEnd;
if (its.getLength() == 0) {
deletionStart = currentCursorPosition - 1;
deletionEnd = currentCursorPosition;
FindReplaceDocumentAdapter frda = new FindReplaceDocumentAdapter(doc);
while (Character.isWhitespace(frda.charAt(deletionStart)) && deletionStart > 0) {
deletionStart--;
}
if (deletionStart != 0 && deletionStart + 1 != deletionEnd) deletionStart++;
} else {
deletionStart = its.getOffset();
deletionEnd = its.getOffset() + its.getLength();
}
int deletionLength = deletionEnd - deletionStart;
try {
doc.replace(deletionStart, deletionLength, "");
} catch (BadLocationException ble) {
// Bad location, just ignore it.
}
return null;
}
The chunk of boilerplate at the top of the Java version, for example, could be easily replaced by a library.
I think you're looking for something like Groovy-Monkey or Eclipse-Monkey, which allow you to do scripting to plug into Eclipse. I don't know much about either project, nor do I know if they are actively maintained (actually I know that Eclipse-Monkey is no longer maintained). But, these allow you to do emacs-like scripting inside of Eclipse.

Emacs, C++ code completion for vectors

I am new to Emacs, and
I have the following code as a sample.
I have installed GNU Emacs 23.1.1 (i386-mingw-nt6.1.7600), installed cedet-1.0pre7.tar.gz. , installed ELPA, and company.
You can find my simple Emacs configuration at the bottom.
The problem is, when I type q[0] in main() and press . (dot), I see the 37 members of the vector, not Person although first_name and last_name are expected. The completion works as expected in the function greet() but it has nothing to do with vector.
My question is, how can I accomplish code completion for vector elements too?
#include <iostream>
#include <vector>
using namespace std;
class Person
{
public:
string first_name;
string last_name;
};
void greet(Person a_person)
{
// a_person.first_name is completed as expected!
cout << a_person.first_name << "|";
cout << a_person.last_name << endl;
};
int main()
{
vector<Person> q(2);
Person guy1;
guy1.first_name = "foo";
guy1.last_name = "bar";
Person guy2;
guy2.first_name = "stack";
guy2.last_name = "overflow";
q[0] = guy1;
q[1] = guy2;
greet(guy1);
greet(guy2);
// cout q[0]. I want to see first_name or last_name here!
}
My Emacs configuration:
;;; This was installed by package-install.el.
;;; This provides support for the package system and
;;; interfacing with ELPA, the package archive.
;;; Move this code earlier if you want to reference
;;; packages in your .emacs.
(when
(load
(expand-file-name "~/.emacs.d/elpa/package.el"))
(package-initialize))
(load-file "~/.emacs.d/cedet/common/cedet.el")
(semantic-load-enable-excessive-code-helpers)
(require 'semantic-ia)
(global-srecode-minor-mode 1)
(semantic-add-system-include "/gcc/include/c++/4.4.2" 'c++-mode)
(semantic-add-system-include "/gcc/i386-pc-mingw32/include" 'c++-mode)
(semantic-add-system-include "/gcc/include" 'c++-mode)
(defun my-semantic-hook ()
(imenu-add-to-menubar "TAGS"))
(add-hook 'semantic-init-hooks 'my-semantic-hook)
This is a known problem with the Semantic analyzer. I currently cannot deal with Template Specialization, which is used in the gcc STL (your problem stems from such a specialization in allocator.h). This has been discussed on the mailing list:
http://thread.gmane.org/gmane.emacs.semantic/2137/focus=2147
GCCSense
An example of completion of a C++ code in Emacs: