emacs (orgmode) does not accept links with non-english characters (osx) - emacs

This problem has been partly solved (see below).
I'm using gnu emacs (on OSX) with orgmode and I'm having trouble linking to files with non-english-alphabet characters.
Examples:
this works:
file:~/dor
this doesn't:
file:~/dør
Is it possible to fix this?
PARTIAL SOLUTION:
This problem was partly solved by updating from emacs 23 to 24 (which, at the moment, is "pretest"). (I updated orgmode with package el too but that did not make a difference)
These files now work:
file:~/dør.txt
http://www.dører.no (would open in firefox but with various combinations of symbols for ø)
This still doesn't work:
file:~/dør (file:~/dor works)

Related

Emacs: Using custom regex function in font lock/highlighting

Emacs newbie here. I have recently switched to (Doom) Emacs and decided to add syntax highlighting to V files. There's already a mode that does that (vlang-mode), but I didn't like it, so I decided to make my own one. The problem is, that, as you probably know, Emacs' regex doesn't support lookaround, which I find essential for stuff like (proper) function higlighting, among others.
So, I have found info about Font Lock mode and (in general words) how to use it. Also, I found a solution to regex problem in using visual-regexp-steroids. The only problem is, I can't figure out how to apply highlighting to regions that it finds.
Links to learning resources would be appreciated.

Disable automatic LaTeX symbol replacement in VS Code

When editing RMarkdown files in Visual Studio Code, the editor automatically replaces many LaTeX-style sequences with their unicode 'equivalents'. E.g., when I type \sum followed by a space, it is converted to ∑. While this is convenient in some cases, it is catastrophic when trying to embed LaTeX source into my file for rendering later on. Typing something like $\sum \sqrt {x_i}$ is converted to $∑ √ {x_i}$, which renders quite differently. Even pressing "escape" when the suggested replacements show up does not prevent the substitution.
Is there a way to turn this off? I've looked through the settings quite thoroughly and cannot find a way to do so. Any help would be appreciated!
(The workaround I've come up with is to copy a single space character and paste it after my symbol instead of pressing the space key on the keyboard.)
Visual Studio Code Version: 1.63.2
Mac OS 10.14.6
It turns out I had an extension installed called "Fast Unicode Math Characters" which, true to it's name, was inserting unicode math characters 😅
Disabling this fixed the issue.
(I decided to answer my own question rather than deleting the question in case someone else has a similar issue)

Using emacs in batch mode to dump a file with syntax highlighting?

I'd like to use emacs in some kind of batch mode to just render a file with syntax highlighting and exit. Specifically, I want to dump the fontified buffer with ANSI escape codes so that it shows up reasonably syntax-highlighted on my terminal. Is there any way to do this?
The ansi-lpr.el library seems to be kind of along the lines of what I want, but the output isn't colorified. I can't figure out how to get over that final hurdle — there are a lot of modules to digest ANSI escape codes into Emacs text properties (e.g. ansi-color.el) but I haven't found anything that does the reverse. If anyone can point me to something that does, I think I can piece together the rest.
Alternatively, I've seen some hacky approaches like this answer (using script and capturing the output) but in my experiments that approach has seemed unlikely to be fruitful — you get tons of undesirable control sequences mixed in with the highlighted text.
The overarching motivation here is to use emacs in a $LESSOPEN pipe to get syntax highlighting when I page files. In case you're going to say it, I've tried and "just page files in Emacs" is not acceptable for me.
I'm glad to announce a new package, e2ansi, that (hopefully) does what you asked for.
The package provides a command-line tool e2ansi-cat that starts Emacs in batch mode, opens files, syntax highlight them (using font-lock), and creates ANSI-colored versions of the syntax highlighted files.
You can integrate this into less by setting the following variables to, for example:
export "LESSOPEN=|emacs --batch -Q -l ~/.emacs -l bin/e2ansi-cat %s"
export "LESS=-R"
export MORE=$LESS
The end result looks like the following:
You can vary the colors and attributes like bold, underline, and
italics by using a suitable Emacs theme.
The e2ansi package is located at https://github.com/Lindydancer/e2ansi
Personal note
I would like to thank you for posting this question, it directly inspired me to write e2ansi.

Emacs 23 window.el

I am using emacs 23 on two computers.
On both, dpkg -s emacs outputs the following version number.
However one has window.el and the other not. This make some function such as split-window behave differently. The help page of this function on the computer that apparently has not window.el installed reads that it comes from C source code instead.
Where does this difference comes from?
I prefer the behaviour of the one that says that split-window comes from window.el: it allows to specify the SIDE when splitting window and provide additional function such as window-resize.
I suppose this is the most recent one but I do not know how to check it nor how to upgrade the other to this state.
Library window.el is as old as the hills. Perhaps you meant that one of your Emacs installlations has window.elc but not window.el?
More likely, you are referring only to function split-window. Yes, it used to be a built-in function (i.e., defined in C), and now it is defined in window.el (which file exists also for the older Emacs versions where that function is a built-in).
FYI, lots of window and buffer-display stuff was changed around the same time as split-window was rewritten in Lisp. Lots of behaviors changed, in minor or major ways.
What is not at all clear is what the problem is that you are reporting. You ask, "Where does this difference comes from? How to fix it?" I've explained a bit about the difference. As for how to fix it -- what is the "it" that needs fixing, and what would the fixed behavior be like?
IOW, your question is, so far, unanswerable. If you specify things more exactly, perhaps we can help more.
I'm not certain what's going on with your debian packages, but if memory serves the readable .el(.gz) files are not supplied in the basic package, but in a separate package. This is because all you strictly need is the byte-compiled .elc files, so they can reduce the base package filesize by omitting them (at the expense of enabling you to read the elisp code).
Is M-x load-library RET window RET successful?
Note that Emacs 24 is the current stable version. You might want to upgrade.
Edit:
M-x emacs-version tells you which version of Emacs you're running, which will always give you a definitive answer.
(And if the versions are identical, then run emacs -Q to eliminate and site- and user-specific config files from the picture, as those are always a likely culprit for differing behaviours.)

Date inserted by Emacs org-mode is not readable

I am using org-mode within Emacs.
The problem is after issuing C-c > or C-c .
org-mode insert date like below,
(firstly it appears within the minibuffer, even the editing file is encoded with utf-8)
<2012-12-09 \326\334\310\325>
How to resolve this issue? My OS is Win7 32bit Chinese version.
Basically, I think the fonts emacs is using are not able to display the way the day is spelled in your language. I'd guess you lack some installed fonts, or emacs doesn't know where to find them, but I'm not sure how to fix this.
That being said, inserting such octal escapes into my emacs gives me ÖÜÈÕ, which I don't believe to be how days spell in many languages. The file might be encoded in utf-8, but what about the buffer ? What's the buffer-file-coding-system variable in that buffer (C-h v buffer-file-coding-system) ?
The variables calendar-day-name-array and org-time-stamp-custom-formats might be of interest, and I guess you could override how the timestamps appear right now with org-display-custom-times, that would probably be a workaround. See the manual for more about it.
At last, I have
(set-language-environment "UTF-8")
(prefer-coding-system 'utf-8)
in my config, functions you may want to investigate about.
I met the same problem to yours.
Through a long time searching online, I found (setq system-time-locale "C") work.
I tried to fix this problem in August, 2014.
My solution is adding the following code into your Emacs config file:
(set-locale-environment "zh_CN.utf-8")
Note that the time will be displayed in Chinese. Hope it helps.