texts: Scroll bar area remains, blacked out, after launching with `scroll-bar-mode` disabled

texts:
I'm using Emacs in dwm window manager of suckless.org, with the following init.el:

(menu-bar-mode 0)
(scroll-bar-mode 0)
(tool-bar-mode 0)

When I launch Emacs, with the command $ emacs, my scroll bar thumb vanishes, as it should because I have used scroll-bar-mode 0 in my init file. But the scroll-bar space remains, colored black, on the right side of the main window.

I can quickly go into floating mode and back into tiling mode to fix the problem and I don't exit emacs that often. So, it's not a big problem, but it is certainly annoying. I haven't have gotten a chance to test if this also happens in other window managers.

And if I launch Emacs with $ emacs -Q, and evaluate the codes in my init file, similar thing happens. Only this time, instead of the scroll-bar area being blacked out, it just gets messed up.

Does anyone know what is going on there?  I have Emacs latest release version 26.1

GNU Emacs 26.1
Copyright (C) 2018 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

Edit

I have just found out that the problem is fixed by putting (scroll-bar-mode 0) after (tool-bar-mode 0) and not before! Why is that?


texts: Symbol's function definition is void on built-in variables?

texts:
For some reason I am getting errors for built-in variables that are available in the documentation.

For instance, evaluating in the scratch buffer the following all return:

Symbol's function definition is void:

emacs-major-version
emacs-minor-version
display-time-24hr-format

This is so weird because there is documentation for all of these, they show up in auto-complete and I see other users using them.

I can not use these in my .emacs or anywhere else.  Interestingly however, I can set some of them using customize.  For instance:

(display-time-24hr-format t) does work in the customize block

Does anyone have any advice?


texts: How do I include non-code resources as part of an Emacs package?

texts:
I have a project that wants to play a sound file. I'd like to distribute this project in MELPA. There are two issues I'm having with that. They're both part of the question "how do I use resources in an Emacs package", so I'm asking this as one question.
1. Package setup
How do I set it up so I can distribute it through ELPA? Obviously the sound file needs to be included. Is there anything I need to do in the package, or is that something that needs to happen upon someone creating the package download?
2. Referencing the file
I'm having a problem referencing the sound file from the Emacs Lisp file. There's the function expand-file-name, but if I open a new Emacs and load-file the elisp file, during the call to expand-file-name for the sound file, the path is expanded relative to the location of the Emacs executable.
There's an argument to expand-file-name that is the default directory to start with, but I'm not sure how to get the directory the file is in when the file is being loaded. During the execution of load-file, default-directory gets the value of the folder that holds the Emacs executable. How can I get the file to load without hardcoding the full path?


texts: Odd behavior of forward slashes in helm-buffers-list patterns

texts:
When filtering the results of helm-buffers-list or helm-for-files, as soon as I type a forward slash, Helm seems to switch from filtering results as expected to showing all buffers:

It seems to highlight some letters in the buffers list, but I don't see any logic or pattern behind this behavior.

I'm not sure why this happens. Is it a bug? Is it some special syntax I'm not aware of? Fuzzy matching is off as far as I can tell.


texts:
I need to read a char at a time to interactively build a filter string while I show the results in a regular buffer. And what I've written works, except when a cursor key is pressed  - then bang, I get a "non-character input event message" and my code exits.

Here's an example. If I run the following command, and hit one of the arrow keys, I get an error.

(defun foobar ()
  (interactive)
  (setq r (read-char)))

I've tried read-char, read-event and read-char-exclusive with and without ignore-errors. I've tried read-char-choice and logic that looks for the vector result a cursor key would give. Nothing works (although I can handle return and backspace perfectly.)

What do I need to do? I don't need the cursor keys to do anything; I just need to make it safe to press them.


texts: Apply a background to code with font-lock

texts: I have a command file that uses syntax such as -TAG <ARGS> -TAG- to pass arguments to a sub program. I want to Highlight everything between the opening and closing tags with specific background color to make then easy to find, but not change the faces used for the foreground. Is there a way to do this with Emacs font locks without having to define two faces for everything (one with a background and one without)?


texts:
I have the following in my code to customize eshell:

(setq eshell-prompt-function (lambda nil
    (concat
     (propertize (eshell/pwd) 'face `(:foreground "blue"))
     (propertize " $ " 'face `(:foreground "green")))))
(setq eshell-highlight-prompt nil)

taken from here.  For some reason through, my eshell goes to all white.  This code used to work for me so I must have changed something else, but I can not see why my prompt is all white. Does this have anything to do with my ~/.bashrc or can somebody else suggest a reason why that would not color my prompt?

I am working with the GUI version on MS Windows and this all used to work.


texts: After a command terminates in shell-mode, I want to execute an additional command conditional on stdout. How can this be automated?


texts: How to customize scrolling for any action that moves the point?

texts:
Say I have an action that moves the point (adds 100 to it for example).
It should be possible to wrap this with a function or macro that gives additional behavior, eg:
(global-set-key (kbd "<f5>")
  'move-point-plus-100)

Say I want to animate the motion with smooth scrolling and recenter the view. This should be possible using a macro, for example.
(global-set-key (kbd "<f5>")
  (with-fancy-scroll-motion 'move-point-plus-100))

Then I can separate scrolling behavior from the actions that move the point, allowing for separate configuration & control.
Does something like this exist already? Or would it need to be written?

I'm aware of scroll locking & smooth scroll mode, but I'd rather have the ability to apply this per key binding, then adding a global mode which might run when I don't want it to.


texts: Cycle through agenda files list not working

texts:
I am using emacs with org-mode on OSX. Since I have a lot of .org files added to my agenda and it would be good for clean-up purpose if I could cycle through them and maybe also remove them if not needed.

For this, I tried using org-cycle-agenda-files

It only goes to the file that is at the top of the agenda list and does not cycle through remaining files.

Is there some configuration change that I can do to fix it?

On evaluation of expression

(org-agenda-files t)

I can see the list of my agenda files

("~/work/pubsub/onCall/File4OnCall.org" "~/work/pubsub/tasks/DocumentExistingAlarms/DocumentExistingAlarms.org" "~/work/pubsub/tasks/1739_alarmCBOpen/TaskAnalysis.org"
"~/work/docs/workNotes/OfficsTasks.org" "~/work/docs/workNotes/GeneralTodos.org" "~/work/pubsub/documents/notes/general/CodeLooks.org" "~/work/pubsub/documents/notes/general/Tasks2Do.org" ...)


texts: Byte-compilation and "uninterned" function names

texts:
Not quite a duplicate: this appears to be very similar to the situation described in an existing question. But my question is not "why does it happen", but rather "is there any way to keep using uninterned symbols".

Let's say certain macro generates an expansion that is an invocation of a private, runtime-generated function. This function has an "uninterned" name (or, rather, interned in a non-default obarray). When evaluated directly, this works fine.

However, byte-compiled code using said macro and, in effect, the function, won't work, because after write-to-.elc-and-read-back function name symbol becomes truly uninterned, i.e. is not identical to what I have in my internal obarray.

Is there any way to keep function names out of the default obarray, yet still have them work when invoked from .elc files? (I did make some investigations of Emacs source code and haven't found any, but still ask in case I've missed something obvious.)


texts: How to install a specific version of package?

texts:
When I do M-x package-install RET magit it installs the latest version of magit which is 2.1.0.

I want to install magit 1.4.2. I don't want to do it manually by downloading and loading package.

For example, if I am downloading a python package, I can specify version number while installing.

pip install django==1.8

How can I do something like that and install magit=1.4.2?


texts: Link to mu4e search queries not available

texts:
Although I'm perfectly able to store an org mode link to a particular email, linking to a query somehow doesn't work.
The described[0] option mu4e-org-link-query-in-headers-mode is missing at all:

mu (mail indexer/searcher) version 1.0
GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.22, cairo version 1.17.3) of 2020-08-28
[0] https://www.djcbsoftware.nl/code/mu/mu4e/Org_002dmode-links.html


texts: unable to display SVG file containing utf-8 charactersI

texts: I like to edit SVG drawings directly in Emacs. It is very convenient to toggle display of source versus drawing with the sequence Ctrl-C ctrl-C. But, when the file contains text in utf-8, Emacs cannot display the drawing, unless the file has just been read or saved. Everytime I modify the buffer, I must save it if I want to display the drawing. Is this a bug or is there some setting to solve it?


texts: how to implement a simple lookup table in lisp

texts:
I want to write an elisp function, when a country name is given, it returns the short code for the country.

I've been reading about hash tables, but still not sure how to hashify my data set and make the function work:

Afghanistan,AF
Albania,AL
Algeria,DZ
American Samoa,AS
Andorra,AD
Angola,AO
Anguilla,AI
Antarctica,AQ
Antigua and Barbuda,AG
Argentina,AR
Armenia,AM
Aruba,AW
Australia,AU
Austria,AT
Azerbaijan,AZ
Bahamas,BS
Bahrain,BH
Bangladesh,BD
Barbados,BB
Belarus,BY
Belgium,BE
Belize,BZ
Benin,BJ
Bermuda,BM
Bhutan,BT
"Bolivia, Plurinational State of",BO
"Bonaire, Sint Eustatius and Saba",BQ
Bosnia and Herzegovina,BA
Botswana,BW
Bouvet Island,BV
Brazil,BR
British Indian Ocean Territory,IO
Brunei Darussalam,BN
Bulgaria,BG
Burkina Faso,BF
Burundi,BI
Cambodia,KH
Cameroon,CM
Canada,CA
Cape Verde,CV
Cayman Islands,KY
Central African Republic,CF
Chad,TD
Chile,CL
China,CN
Christmas Island,CX
Cocos (Keeling) Islands,CC
Colombia,CO
Comoros,KM
Congo,CG
"Congo, the Democratic Republic of the",CD
Cook Islands,CK
Costa Rica,CR
CÃ´te d'Ivoire,CI
Croatia,HR
Cuba,CU
CuraÃ§ao,CW
Cyprus,CY
Czech Republic,CZ
Denmark,DK
Djibouti,DJ
Dominica,DM
Dominican Republic,DO
Ecuador,EC
Egypt,EG
El Salvador,SV
Equatorial Guinea,GQ
Eritrea,ER
Estonia,EE
Ethiopia,ET
Falkland Islands (Malvinas),FK
Faroe Islands,FO
Fiji,FJ
Finland,FI
France,FR
French Guiana,GF
French Polynesia,PF
French Southern Territories,TF
Gabon,GA
Gambia,GM
Georgia,GE
Germany,DE
Ghana,GH
Gibraltar,GI
Greece,GR
Greenland,GL
Grenada,GD
Guadeloupe,GP
Guam,GU
Guatemala,GT
Guernsey,GG
Guinea,GN
Guinea-Bissau,GW
Guyana,GY
Haiti,HT
Heard Island and McDonald Islands,HM
Holy See (Vatican City State),VA
Honduras,HN
Hong Kong,HK
Hungary,HU
Iceland,IS
India,IN
Indonesia,ID
"Iran, Islamic Republic of",IR
Iraq,IQ
Ireland,IE
Isle of Man,IM
Israel,IL
Italy,IT
Jamaica,JM
Japan,JP
Jersey,JE
Jordan,JO
Kazakhstan,KZ
Kenya,KE
Kiribati,KI
"Korea, Democratic People's Republic of",KP
"Korea, Republic of",KR
Kuwait,KW
Kyrgyzstan,KG
Lao People's Democratic Republic,LA
Latvia,LV
Lebanon,LB
Lesotho,LS
Liberia,LR
Libya,LY
Liechtenstein,LI
Lithuania,LT
Luxembourg,LU
Macao,MO
"Macedonia, the Former Yugoslav Republic of",MK
Madagascar,MG
Malawi,MW
Malaysia,MY
Maldives,MV
Mali,ML
Malta,MT
Marshall Islands,MH
Martinique,MQ
Mauritania,MR
Mauritius,MU
Mayotte,YT
Mexico,MX
"Micronesia, Federated States of",FM
"Moldova, Republic of",MD
Monaco,MC
Mongolia,MN
Montenegro,ME
Montserrat,MS
Morocco,MA
Mozambique,MZ
Myanmar,MM
Namibia,NA
Nauru,NR
Nepal,NP
Netherlands,NL
New Caledonia,NC
New Zealand,NZ
Nicaragua,NI
Niger,NE
Nigeria,NG
Niue,NU
Norfolk Island,NF
Northern Mariana Islands,MP
Norway,NO
Oman,OM
Pakistan,PK
Palau,PW
"Palestine, State of",PS
Panama,PA
Papua New Guinea,PG
Paraguay,PY
Peru,PE
Philippines,PH
Pitcairn,PN
Poland,PL
Portugal,PT
Puerto Rico,PR
Qatar,QA
RÃ©union,RE
Romania,RO
Russian Federation,RU
Rwanda,RW
Saint BarthÃ©lemy,BL
"Saint Helena, Ascension and Tristan da Cunha",SH
Saint Kitts and Nevis,KN
Saint Lucia,LC
Saint Martin (French part),MF
Saint Pierre and Miquelon,PM
Saint Vincent and the Grenadines,VC
Samoa,WS
San Marino,SM
Sao Tome and Principe,ST
Saudi Arabia,SA
Senegal,SN
Serbia,RS
Seychelles,SC
Sierra Leone,SL
Singapore,SG
Sint Maarten (Dutch part),SX
Slovakia,SK
Slovenia,SI
Solomon Islands,SB
Somalia,SO
South Africa,ZA
South Georgia and the South Sandwich Islands,GS
South Sudan,SS
Spain,ES
Sri Lanka,LK
Sudan,SD
Suriname,SR
Svalbard and Jan Mayen,SJ
Swaziland,SZ
Sweden,SE
Switzerland,CH
Syrian Arab Republic,SY
"Taiwan, Province of China",TW
Tajikistan,TJ
"Tanzania, United Republic of",TZ
Thailand,TH
Timor-Leste,TL
Togo,TG
Tokelau,TK
Tonga,TO
Trinidad and Tobago,TT
Tunisia,TN
Turkey,TR
Turkmenistan,TM
Turks and Caicos Islands,TC
Tuvalu,TV
Uganda,UG
Ukraine,UA
United Arab Emirates,AE
United Kingdom,GB
United States,US
United States Minor Outlying Islands,UM
Uruguay,UY
Uzbekistan,UZ
Vanuatu,VU
"Venezuela, Bolivarian Republic of",VE
Viet Nam,VN
"Virgin Islands, British",VG
"Virgin Islands, U.S.",VI
Wallis and Futuna,WF
Western Sahara,EH
Yemen,YE
Zambia,ZM
Zimbabwe,ZW


texts: Using helm to create a file while in a helm session

texts:
I often find myself in a command that queries for a filename e.g. diff-tell-file-name. This command asks me what file to apply a diff to.

In my case, often the file does not exist and I would like to create it. helm-find-file allows for creating new files just by typing in their name. However lots of helmified commands DO NOT allow you to do so and just echoes the error: [No match]

I would want to run helm-find-file while inside the minibuffer prompt but that apparently is not allowed and gives the error helm: Error: Trying to run helm within a running helm session.

Is there a way to "suspend" a query and then get back to it?
Is there a way to modify or advise a helmified command to allow it to accept non-existent files create them on the go.

I feel I am missing how to effectively use helm. Thanks


texts: Replace org link description with org link output (shell type)

texts:
I've stored several links to various shell commands and I would like to update each link description with the output of the correspoding shell command. For example:
View in text-mode: [[shell:echo "hello"][xxx]]
View in org-mode:  xxx

after running some post-processing function, I would get:
View in text-mode: [[shell:echo "hello"][hello]]
View in org-mode:  hello

I know how to parse the different links and get the underlying shell command:
(org-element-map (org-element-parse-buffer) 'link
  (lambda (link)
    (when (string= (org-element-property :type link) "shell")
        (org-element-property :path link))))

but then I don't know how to modify the description using (org-element-context link)


texts: How can i define a keybinding, which can't be modified, once it is set?

texts:
vim has a really great feature for defining keybindings.

from the vim docs:

:cno[remap] {lhs} {rhs}     |mapmode-c| *:cno* *:cnoremap*
            Map the key sequence {lhs} to {rhs} for the modes
            where the map command applies.  Disallow mapping of
            {rhs}, to avoid nested and recursive mappings.  Often
            used to redefine a command.

Basically, the :cnoremap command creates a keybinding, but forbids any further redefinitions of it. This made defining keybindings in vim always easy for me. However, in emacs i don't know such a command - currently I use commands like (global-set-key [f8] 'my/copy-to-clipboard) to define my keybindings. Unfortunately, this is really a pain, because other packages can easily remap that (in my case, the evil package).

How can i define a keybinding in emacs, which can't be modified, once it is set?

Important edit: I don't want to restrict what can be done to lhs - I want just prevent a redefinition/modification of rhs.


texts:
(defvar-local hash-entries nil)
(put 'hash-entries "key" "val")
(message "%S" hash-entries)

I try to add a key-value pair to the hash variable, hash-entries using the function put.

But when i print it, it prints nil instead of its contents, (key . val)


texts: How to quickly convert text to org-mode table?


texts: Evil mode send escape before Alt/Meta-command

texts:
In vim one can escape normal mode by pressing Alt or Meta then pretty much any key, e.g. Met-j to escape insert mode and move down a line. Holding alt before typing would send an <Esc> key before the command.

I found it was the fastest was of escaping normal mode and has become muscle memory. I have been researching how to do this with evil mode, but haven't figured it out as there is lots of documentation about how to make evil mode quit various emacs states.


texts: auctex preview at point shows equations for the entire document

texts:
I am using the latex-layer (auctex) in spacemacs. When I use preview-at-point it renders all of the equations in the document. Is there a way to really make it render on the equation at the cursor?

Also the preview-clearout works in a weird way. It toggles the images back to text but only for the equations which are before the cursor (not including the one under the cursor). On the other hand preview-clearout-buffer works fine.


texts: org-structure-template-alist: Chasing a ghost entry

texts:
yesterday I realize that the entries in my org-structure-template-alist were not working. I found that it was due to the update to Org 9.2, and I decided to comment the personalized structures in my .emacs.

The problem is that, even after commenting the code, I'm getting the following warning:

Warning (org):
Please update the entries of `org-structure-template-alist'.

In Org 9.2 the format was changed from something like

    ("s" "#+BEGIN_SRC ?\n#+END_SRC")

to something like

    ("s" . "src")

Please refer to the documentation of `org-structure-template-alist'.

The following entries must be updated:

(("n" "#+BEGIN_NOTES\n?\n#+END_NOTES"))

I rechecked my .emacs, but strangely I don't have a note structure defined. I've looked for it in org.el and org-tempo.el but no luck!

I don know what is happening, Do you have any ideas?


texts: How can I find corresponding balanced parentheses?

texts:
I have this LaTeX code:

\caption{Lorem ipsum dolor sit amet: foo), bar), baz) and qux) consectetuer adipiscing elit.}

I want to put a marker immediately before the first { and one immediately after its corresponding }.

forward-list is my usual choice in order to find balanced parentheses, but in this case it is not suitable because it moves cursor immediately after the first ) (as its standard behaviour).

How can I do this?

;; my standard way
(while (re-search-forward "\\\\\\<caption\\>" nil t)
  (setq pos1 (point-marker))
  (set-marker-insertion-type pos1 t)
  (forward-list)
  (setq pos2 (point-marker))
  (set-marker-insertion-type pos2 t)
  (save-excursion
    (save-restriction
      (narrow-to-region pos1 pos2)
      (goto-char (point-min))
      ;; do something
      )))

Updates

I have found an answer here:

Strict parenthesis matching

Function forward-pexp does the trick.


texts:
When I try to export a .org or .tex file to pdf with the command org-latex-export-to-pdf, I get the following error in *Messages* buffer:

Processing LaTeX file ./test.tex...
org-latex-compile: PDF file ./test.pdf wasn't produced: [LaTeX error]

I couldn't find anymore debug info. I already tried to install texlive-core and texlive-bin package from archlinux repo, but it didn't help.

EDIT: After digging further into the problem, I saw that org runs the command pdflatex file.tex, and it returned it couldn't find the file utf8x.def


texts:
I have a repo for my dotfiles and update it here and there on various computers. Sometimes I forget to git pull before editting and git push. This creates conflicts or trigger git merge, or I just forget that I wrote a new feature somewhere else already. So, how do I do the following:

check every n minutes for remote repo changes and give a message
to the current frame so I can pull the changes before doing something
else.
When opening (find-file) on the repo, do the same check changes and notification.
(expansion for other use cases) if I am not working on the repo, but I still want to get notitfy about changes on a list of repos something like this:

((repo1 "git@host:/path/to/repo1")
(repo2 "git@github.com:user/repo2"))

if there are changes on repo1 then I will get a notification saying "There are changes on repo1. Check it out!"


texts: How to auto prefix with comment char when inserting code ref label with org-store-link

texts:
There is a way to link to a specific link of code in org babel src block. with org-store-link.

Here is an example:

 ;;; This is comment | line. |
 (describe-char | (point)) ; | comment |
 (message | "hello, world") |

NOTE: The vertical bar (|) is the point positions.
I need a way to auto detect current position, whether it is in comment area.
If yes, then don't add comment char. If no, then auto add comment char like at
the third line.

An advice for elisp or some way else.


texts: How to indicate the end of a subheading's content?

texts:
Below I show a toy example, consisting of two headings, the first of which contains a subheading:

* HEADING 1

  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis
  lobortis, lectus sed tincidunt condimentum, justo ligula vestibulum
  ligula, eget mollis nisl erat vitae turpis.

** subheading 1.1

   Fusce ut auctor purus, vel suscipit nulla. Nulla aliquet lectus ut
   efficitur fermentum. Aliquam placerat sodales neque, sit amet
   ultricies tortor pulvinar et.

  Mauris tincidunt diam nec dui interdum tincidunt. Duis vel augue eu
  eros semper semper et sed augue. Mauris a tellus leo. Pellentesque
  ac erat quis turpis vulputate dapibus.

* HEADING 2

  Curabitur sed nibh sed nibh accumsan aliquet a et quam. Curabitur
  eget semper ante. Vivamus sed velit suscipit, finibus ante in,
  aliquam est. Sed a porttitor est, nec consectetur urna. Suspendisse
  potenti. Aenean pulvinar pretium molestie.

Note that the normal text of HEADING 1 both precedes and follows subheading 1.1.  In particular, the paragraph that begins with Mauris tincidunt diam ... does not belong to subheading 1.1, but rather it belongs to HEADING 1.

Unfortunately, as written above, org-mode will treat this paragraph as part of subheading 1.1.  For example, if I attempt to collapse that subheading, my screen looks like this:

* HEADING 1

  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis
  lobortis, lectus sed tincidunt condimentum, justo ligula vestibulum
  ligula, eget mollis nisl erat vitae turpis.

** subheading 1.1...
* HEADING 2

  Curabitur sed nibh sed nibh accumsan aliquet a et quam. Curabitur
  eget semper ante. Vivamus sed velit suscipit, finibus ante in,
  aliquam est. Sed a porttitor est, nec consectetur urna. Suspendisse
  potenti. Aenean pulvinar pretium molestie.

...whereas I want it to look like this:

* HEADING 1

  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis
  lobortis, lectus sed tincidunt condimentum, justo ligula vestibulum
  ligula, eget mollis nisl erat vitae turpis.

** subheading 1.1...

  Mauris tincidunt diam nec dui interdum tincidunt. Duis vel augue eu
  eros semper semper et sed augue. Mauris a tellus leo. Pellentesque
  ac erat quis turpis vulputate dapibus.

* HEADING 2

  Curabitur sed nibh sed nibh accumsan aliquet a et quam. Curabitur
  eget semper ante. Vivamus sed velit suscipit, finibus ante in,
  aliquam est. Sed a porttitor est, nec consectetur urna. Suspendisse
  potenti. Aenean pulvinar pretium molestie.

I am thinking of the content under subheading 1.1 as secondary/background/supporting detail for the material under HEADING 1; as such I want to be able to hide it so as not to obscure the main content.  (In a more realistic situation, the content under subheading 1.1 could be much lengthier, hence much more obtrusive, than what I show in the toy example above.  I'm thinking of a functionality similar to the "inline footnotes" one finds in, e.g., fivethirtyeight articles.)

How can I indicate that subheading 1.1 ends right after the sentence that ends with ultricies tortor pulvinar et?


texts: Calendar: symbols-function-definition is void: "appt-make-list"

texts:
When in the "calendar", typing "d", which runs (diary-view-entries), gives me an error Symbols-function-definition is void: "appt-make-list".
It shows the (one) entry for this date correctly, though.
The allegedly "void" function is well present in appt.el.gz, from where I could do "Ctrl-x Ctrl-e".
Pressing "d" again, I get the same error. Calling (appt-make-list) explicitly gives me another error.
My guess is that from my latest working version to my current version (25.2.2) there have been lot of more changes than I can trace down but need some advice on how to do this right with the current version.
On the net, there is a lot information about "appt-make-list", but most of it outdated.
Question is: what have I do so I can see my diary entries from calendar without errors?

This is what is in my .emacs about calendar:
(require 'appt)
(setq calendar-mark-diary-entries-flag t)
(calendar);;;(mark-diary-entries)(kill-buffer "diary")

where the first two lines are edited and activated by Ctrl-x Crtl-e without restarting emacs.

Lines that include "Diary" are:
    749:(add-hook 'diary-hook 'fancy-diary-display)
    750:(add-hook 'diary-hook 'appt-make-list)
   1331:(setq calendar-mark-diary-entries-flag t)
   1332:(calendar);;;(mark-diary-entries)(kill-buffer "diary")


texts: C-x requires to look down at keyboard, interrupting flow

texts:
I'm trying to get used to emacs (really trying).

I use a small apple keyboard.

I can't see (in physical terms) how I will ever be able to do C-x without dropping my gaze from the screen and what I am thinking about, to look down at the keyboard, to move left thumb to the left to hit C, then first finger to x (or even use two hands, completely interrupting touch typing and flow). Right now this feels like a serious problem for productivity and flow.

To crystallise the point, C-x seems incompatible with touch typing. Would that be a fair point to make? That's what my personal experience points to at this point.

Is there a solution? I notice that on the small apple keyboard the C-x are not immediately diagonally adjacent, unlike on some large keyboards. So, rebinding C-x to C-` would certainly be a bit less painful if that's a feasible option. But that key combination still requires complete interruption of the 'home' position for touch typing, requiring me to look down at hands.

I found How to use a Mac's Command key as a Control key? which suggests rebinding Cmd to control, and that would certainly be more ergonomic. But I don't want to override the systems cut command. I don't actually use the right Cmd much, so wonder about that. Surely others have had this problem, and I'd love to know what the best solution is.


texts: How do I search and replace over a set of files?

texts:
I'd like to define a set of files within which I can search and replace text.

To clarify:

I would like to be able to search, e.g., in all files xk*.tex in a given directory (and excluding backup files). I would also like to be able to change the expression, e.g., "uncertainty", to "indeterminacy" in all files dd*.sh and ee*.cls .

What is the standard way to do this?


texts: Can not connect to remote MS Windows machine from local MS Windows machine

texts:
Windows 10 (64 bit), Emacs 25.1

I want to connect from my local Windows machine to remote Windows machine.
But Tramp does not support connecting a remote MS Windows host from a local MS Windows host.

So how I can do this?


texts: Trying to make control-f search exactly like control-s does!

texts:
I am trying to configure Emacs to not only use CUA, but also for control-f to search exactly like control-s does in the standard configuration.

What I have achieved is that I can key in control-f and search for something and find it. However, when I press control-f twice, I do not find the next occurrence of the search string. (Like what happens when I in the original configuration press control-s twice.

Also, with control-s control-w I could mark a word and then search for it. This does not work either with control-f.

My configuration:

(global-set-key [(control f)] 'isearch-forward)

I am on Windows, if that matters. But ideally I would like to apply this to Mac and Linux too so I get the same keybindings on all my computers.


texts: Pop up new frame (with only one window and frame) to show specific buffers

texts:
I'm trying to add functionality to my spacemacs config. I want to show allAlchemist buffers in another frame. For example Alchemist Test Report or Alchemist Mix. So when I use M-RET t b, spacemacs should open a new frame if it does not already exist.

I have this in my config right now:

(add-to-list 'display-buffer-alist
             `(,(rx bos "*alchemist*" eos)
                (display-buffer-reuse-window
                   display-buffer-pop-up-frame)
               (reusable-frames     . visible)
                 ))

It works, but only partially. If I have more than one buffer opened in the current frame, the new frame is opened with the Alchemist buffer, but with other buffers too (Neotree for example).

The other problem is that some Alchemist frames, like those with mix or iex, are not using the Alchemist frame already opened, and they are opening a new frame.

In resume, and to simplify, I want to have one frame at the same time, with only one buffer and one window with Alchemist stuff.

Is it possible? How?


texts: I would like to call a subprocess, and that subprocess has some interactive behavior. Thus, I would emacs to parse the output of the subprocess, ask the user for input, and then hand that input back to the subprocess.


texts:
(get-char-code-property ?ἀ 'decomposition) returns a list of
two characters into which the given character is decomposed.  Is
it possible, given these characters, to recompose the original?
Is there a function for that?


texts:
I want to run the Emacs.app in daemon mode on Mac OS X. I can run emacs in daemon mode via the terminal, but instructions for running the app in a client-server pattern do not work (e.g.: http://overtone.github.io/emacs-live/doc-starting.html, yet /Applications/Emacs.app/Contents/MacOS/bin/emacsclient does not exist) with the latest versions of Emacs.

How can I run Emacs 24.x app on Mac OS X in daemon mode?

My goals are to start the server on start up (which I know how to do), and, when I launch a client, to launch a new frame in the app version of Emacs which is already running.


texts: Shell-mode execute script every time a shell is invoked

texts:
I have changed the emacs-shell mode shell to WSL ubuntu but however, the prompt is not very user-readable. For this reason I would like to execute a script that changes it so that its more readable using:

PS1='\u@\h:\w\$'

every time I enter M-x shell
At the same time, I would like to keep my prompt as is outside of emacs as it has color coding etc enabled so I want the change to only affect emacs hence my question. Is it possible?


texts: How to make evil-mode tab key indent? (not re-indent based on context)

texts:
Currently pressing TAB in evil insert mode, runs indent-for-tab-command

I'm not sure of the exact details, but from what I can tell this is performing some kind of re-indentation, which does nothing if emacs consideres the text already indented.

I would like this to behave (like vim) where.

When tabs are enabled a \t is inserted *.
When tabs are disabled, insert n spaces, aligning to the tab-width.

Is this possible?

* by tabs enabled I mean (setq indent-tabs-mode t).


texts: (De)activate a flycheck checker without disturbing those currently active

texts:
I'm working on fulfilling a feature request for my package ten-hundred-mode - specifically, that it provide a "permissive" option where it merely highlights impermissible words, rather than immediately removing them in the fashion of Cleartext. I thought Flycheck would be a good method of doing this highlighting, and indeed it didn't take much effort to write a checker. But then I ran into some trouble.

Specifically, it is not clear to me that a method exists of enabling this checker while not affecting whatever other checkers the user currently has active. That's important because I want to fulfill the same use case as flyspell-prog-mode, and provide a minor mode which can identify and operate on only comments, strings, and docstrings in source code. To do that with a Flycheck checker, I need to be able to activate it without in any way modifying whatever collection of checkers, or none, the user has configured for herself.

I can see several ways of activating my checker when someone activates my minor mode. I haven't been able to find one which I'm certain will do so without potentially breaking the user's configuration. No doubt many people here know more than I do about Flycheck's internals. (That's not a high bar to clear.) If a way exists, perhaps such a person will point me in its direction.


texts: Generate/use etags for compressed (.el.gz) libraries?

texts:
I wanted to generate a tags table for the lisp libraries that my Emacs came with, located in

/path/to/emacs/25.1/lisp/

There's a mix of compressed and uncompressed files in that directory, so I ran etags *.el{.gz,} to build the TAGS file.

Now find-tag works, but xref-find-definitions only works for the uncompressed libraries.

For example, if I run xref-find-definitions with copy-to-buffer, which lives in simple.el.gz, it reports:

user-error: Rerun etags: ‘^(defun copy-to-buffer ’ not found in /path/to/emacs/25.1/lisp/simple.el

and inspecting the buffer-list shows a newly-created empty buffer named simple.el.

If I have simple.el.gz open before running the above command, it works correctly.

Looking in the TAGS file itself, I see that all the filenames end in .el, even those whose files on disk end in .el.gz, and I assume this related.

How can I properly build/use tags for these compressed files? Also, if I delete the TAGS file I generated, xref-find-definitions just works, whereas find-tag prompts me for a tags table to visit, so I'm curious how xref is finding references: is it using a TAGS file located elsewhere, or some other mechanism?


texts: How to make evil-mode completion case sensitive?

texts:
While this answer (How to make auto-completion case sensitive? - ac-ignore-case) works in some cases.

Using evil mode on its own.
Adding (setq ac-ignore-case nil) to ~/.emacs doesn't make completion case sensitive. (Pressing Ctrl-N in evil mode).

From looking into it this calls evil-complete-next.

Checked the source but didn't see any options to adjust.

Can this be made to be case sensitive?


texts: How to merge two buffers containing questions and answers

texts:
In my line of work, I often have one document containing questions and another document containing answers.  How can I merge these documents in the form of Question/Answer.

BUFFER #1:

Q1:  Do you like green eggs and ham?
Q2:  Would you like them here or there?
Q3:  Would you like them in a house?

BUFFER #2:

A1:  I do not like them, Sam-I-am.
A2:  I would not like them here or there.
A3:  I do not like them in a house.

DESIRED RESULT -- BUFFER #3:

Q1:  Do you like green eggs and ham?
A1:  I do not like them, Sam-I-am.
Q2:  Would you like them here or there?
A2:  I would not like them here or there.
Q3:  Would you like them in a house?
A3:  I do not like them in a house.


texts: Ignoring newline changes in smerge-diff-mine-other

texts:
For me, smerge-diff-mine-other seems to ignore changes in the number of whitespace characters where there is whitespace, but I would sometimes like it to ignore all whitespace, including newlines - even if a newline was inserted where the was no newline before. How can I achieve that?

C-c C-w in the *vc-diff buffer created by smerge-diff-mine-other doesn't seem to do anything.


texts: Key bound to string does not handle some chars in string correctly

texts:
(I ask this question after reading this one.)

The form

(global-set-key (kbd "M-e") "e")

is, as far as I can tell, equivalent to

(global-set-key (kbd "M-e") (lambda () (interactive) (insert "e")))

However, after evaluating

(global-set-key (kbd "M-e") "abcdeéfghij")

pressing M-e inserts

abcde   fghij

(3 spaces instead of é). Looking up the keybinding, it appears that M-e is not really bound to (insert ...), but rather to a keyboard macro inserting all these chars... except that the é became a M-i. With a ê it's a linefeed (M-j). With a à it enters some menu (M-backtick), and so on.

But there isn't any problem if I create a macro using the keys for these characters.

So, the question is simple: what is going on here?


texts:
I have following text which are expressed in level 5

***** It's better to be first than it is to be better.
***** The basic issue in marketing is creating a category you can be first in. It’s the law of leadership: It’s
      better to be first than it is to be better.
***** It’s much easier to get into the mind first than to try to convince someone you have a better product than the
      one that did get there first.

........

I want to change into list

00001 It's better to be first than it is to be better.
00002 The basic issue in marketing is creating a category you can be first in. It’s the law of leadership: It’s
      better to be first than it is to be better.
00003 It’s much easier to get into the mind first than to try to convince someone you have a better product than the
      one that did get there first.

Is there any quick way to do that?


texts: Inferior Python shows not output, or input

texts:
I have the symptoms described here Input and Output does not show up in python mode, except this happens with python3 as interpreter as well as ipython, and I've tried the suggestions there for fixing ipython and have no improvement. show output from python-shell-send-region

With Ubuntu Linux, Emacs-25.2.2, the Python Inferior Shell does not show either the input nor the output I expect. I've tested with both python3 and ipython3, and I have the same symptom.  Because I use R with Emacs-ESS, I had some expectation that Python with an inferior session would be similar, but, well, this seems to do nothing.

My init.el file has custom-set-variables so I use python3

(python-shell-interpreter "python3")

When I open a python code file, the Emacs status line says (Python) and to launch the interpreter, I either can use pull down menu Python -> Start Interpreter or M-x run-python. Either way, new buffer starts, looks like this:

In the python code buffer, I highlight some lines of code and use the pull down menu Python -> Eval Region.  Emacs minibuffer says "Sent: import re ..."
but, when using python3, the Inferior shell does not change at all. It displays neither input nor output.

I'll be specific. I'm using BeautifulSoup to read in an HTML file I saved. My Python region:

import re
from bs4 import BeautifulSoup

filename = "../workingdata/wp039-910.html"
soup = BeautifulSoup(open(filename, encoding='windows-1251'), "html.parser")

links = soup.find_all("a")
type(links)

type(links[4])

The Shell looks like this:

Python 3.6.3 (default, Oct  3 2017, 21:45:48)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> python.el: native completion setup loaded
>>>

THat does not change when I highlight new code regions and run them, even
if commands do trigger output

However, I can type a line into the shell and it shows the session did run those line.

      type(links[4])

I notice, however, that the history of the Python shell does not include the lines that were submitted by python mode, only the one I manually typed in.

What I want is for this to behave like Emacs-ESS, where the code I run fills in the output buffer, and the output also appears there.

When I change the shell to ipython3 with this insertion in the init file:

(setq python-shell-interpreter "ipython3"
   python-shell-interpreter-args "--simple-prompt --pprint")

The problem is slightly different. I can see the prompt incrementing
in the shell when I send a region, but never see any input or output. Here I highlighted a block of lines and use pull down Python -> Eval Region, and I see the counter increments from 1 to 2:

Python 3.6.3 (default, Oct  3 2017, 21:45:48)
Type "copyright", "credits" or "license" for more information.

IPython 5.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]:
In [2]:

And I can type commands there and it seems correct.

In [2]: links = soup.find_all("a")

In [3]: links[3]
Out[3]:
English

As it stands, this Inferior shell seems rather useless, if the only workable way to interact with it is to copy/paste from a py file at the prompt. I can't see any benefit in this and wonder if it is like this for everybody.


texts: List manipulation -- appending duplicate equal lists


texts: prettify-symbols-mode not working in auctex

texts:
In my .emacs file, I have (global-prettify-symbols-mode), and if I visit a .el document, I see the lambda character instead of lambda.

My understanding is that in a .tex file I should see the beta character instead of \beta, but this does not seem to work. The auctex manual says that if global prettify symbols mode is enabled, then this should work automatically.

Any ideas of what could be going wrong?


texts: Spacemacs - Changing evil keys (swapping)

texts: I use a different keyboard layout (colemak) so standard evil keys are a bit annoying. Is there a way to swap keys globally (minus when writing text)?


texts: Why is the mark ring called a 'ring' and not a 'stack'?

texts:
From the description of the mark ring on the Emacs website (link) it seems to me that it is basically just a stack with a maximum size set to be 16. So I am curious why this data-structure is called a "ring" in Emacs parlance and not a mark "stack" which intuitively seems a more reasonable name.

As a side question, what is the mark ring internally implemented as?


texts: How to fontify grep output displayed in a help window

texts:
I wrote a function to show me a list of all defuns in the current buffer. The output is syntactically incorrect Lisp code (if you can even call it Lisp code, being syntactically a mess).  Here's what the output looks like in the help window:

List of results:

(defvar var-one nil "Var one doc")
(defvar var-two  nil "Var two doc")
(defun foobar (one two)
(defmacro mymacro (body)

If possible, I would like to fontify the display a bit, to color the defun words and the function names in some way.

I tried to do what org-mode does (suggested on another thread on SO). That is, copy my results to a temp buffer, enable Lisp mode, run font-lock-fontify-buffer in Lisp mode on the temp buffer, and copy the fontified results back. But that didn't work, for two reasons. First, Lisp mode tried to indent my results like a mess of cascaded, nested defuns (ugh).

The main problem seems to be that with-help-window loses or blocks all font locking. Maybe it's because of the princ statements used to generate output into the help window?

Here's my display code (which does not work for keeping font info):

(with-help-window (help-buffer)
  (princ (concat title "\n\n"))
  (princ alldefuns)
  (lisp-mode)  ; doesn't help, in or out
  (font-lock-fontify-buffer))

My questions are:

Is it possible to display fontified text using with-help-window?

Or is there an alternate route that I should try? (I suppose I could go study the occur source, which displays the same kind of results in a normal buffer. But I'd like to stick with with-help-window approach if I could...)

Update for @lawlist comments below:

Here is the code that generates the list of defuns from the current buffer. The code looks like it should correctly collect and preserve font-lock info from the current buffer because it uses buffer-substring to extract the lines.

(defun ct-u-buffer-defuns-list ()
  "Return a stringlist of defuns in current buffer."
  (let (result buf-contents tmp regex)
    (setq buf-contents (buffer-string))
    (with-temp-buffer
      (insert buf-contents)
      (goto-char (point-min))
      (setq regex "^(defun")
      (while (re-search-forward regex nil t)
        (let (bol eol)
          (setq bol (line-beginning-position))
          (setq eol (line-end-position))
          (setq tmp (buffer-substring bol eol))
          (setq result (concat result tmp "\n")))))
    result))

But on a 20 line display displayed in a normal buffer using the code below executed in the scratch buffer, only the first 10 lines retain their font-lock info. Or sometimes it's another 5 or 10 lines in a 30 line display. I don't know why.

  (let (alldefuns)
    (switch-to-buffer "ct-utils.el")
    (setq alldefuns (ct-u-buffer-defuns-list))
    (switch-to-buffer (get-buffer-create "foobar"))
    (insert "List of results:\n")
    (insert alldefuns))

So it seems that at least part of the font-lock properties are collected and preserved by the extraction (search) code, and at least part of the font-lock properties are preserved by inserting the collected string into a temp buffer (Fundamental mode is active in the temporary buffer).

Further, when I try the following bits of code in the *scratch* buffer as suggested in the comments (alldefuns is a variable that contains the lines extracted from the code buffer), I get the following results:

(defun foo ()
  "Insert a string of defun lines in the current buffer."
  (insert alldefuns))

;;works perfectly in Lisp mode scratch buffer
(foo)

;; only displays 10 of 30 lines with font lock info
(let ((temp-buffer-window-setup-hook 'foo))
  (help-window-full-frame (help-buffer)
      (princ "This title appears last in output.\n")))

It's a puzzle why displaying in (1) a temporary help buffer, or (2) in a temporary Fundamental mode buffer, only shows 1 chunk of 10 lines or so of font-lock info.


texts: How to ignore Caps Lock state for keyboard shortcuts?

texts:
When Caps Lock is on, typing commands may bring surprising results, because the capital letters are used instead of what has been intended. In some modes it leads to deleting large chunks of texts, and is very irritating. On my keyboard caps lock is larger than any modifier key on the left (not sure what for).

There are ways to rebound Caps Lock, but is there a way to ignore it only in the commands? If not, what is the best way to disable the influence of Caps Lock? Maybe, there is some way to re-use on-key LED, as a bonus?

I am using Ubuntu Linux, if that matters.


texts:
I have a problem with my Auctex + Emacs in LateX Preview functions.
They are located in my USB together TexLive packages, Sumatra pdf-reader & all Ghostscript tools.

Where can I include Ghostscript path to allow the Latex preview functions go on in correct way?
(I mean what variable must include the Ghostscrip bin path and others binary file used in windows i.e. Ghostxps & Ghostpcl).
What is the binary "rungs.exe" included in TeXlive that is called by preview-gs-command variable?
(If I see the variable I find "f:/Program-folders/TeXlive2015/bin/win32/rungs.exe").
What can I do to remove into Emacs exec-path others files
that the installation program read from windows path variable and they are not used in usb pen drive?


texts: How to print a quoted sexp using '... (reader syntax) instead of using (quote ...)?

texts: The result of (print 'foo) is (quote foo). Is there a similar function whose result is 'foo, which is what people generally write?


texts: How can I find out in which keymap a key is bound?

texts:
I have rebound a the 'd' key in gnus-article-mode, but its old behavior is still active when the point is on an attachment. I can see that the rebinding did not take effect there by doing C-h k d, but it is not telling me what keymap is in effect at that point, so that I can rebind it.

Is there a way to find it out?

Here is a precise example: I'm using evil, and I want articles to be in motion mode. For my keyboard layout I have 'd' configured as the key to go up.

(evil-mode 1)
(add-to-list 'evil-motion-state-modes 'gnus-article-mode)
(setq evil-emacs-state-modes (remove 'gnus-article-mode evil-emacs-state-modes))
(define-key evil-motion-state-map "d" 'evil-previous-line)

To make sure the evil keys are taken into account, I unset gnus key in the local map:

(defun as/alter-article-evil-map ()
  (local-unset-key "d"))
(add-hook 'gnus-article-mode-hook 'as/alter-article-evil-map)

Unfortunately, when the point is on an attachment, the 'd' key no longer goes up but it offers me to delete the attachment. I guess another binding is active at that point, hence the question.

Solution I used the keymaps-at-point below to find the keymap used was from a text property. I then looked at the code of the bound function to find the name of the keymap gnus-mime-button-map. The following code does what I want:

(defun as/alter-article-evil-map ()
  (define-key gnus-mime-button-map "d" nil))
(add-hook 'gnus-article-mode-hook 'as/alter-article-evil-map)


texts:
Just wondering, because ...

The function of font-lock-mode is to programmatically un/assign a given typeface or typeface font to text. But it's just an assignment, which can be easily overridden; FLM doesn't lock in any sense of that verb that's reasonable to me. (Am I missing something?)
When I'm org-modeing, I regularly toggle M-x font-lock-mode to either (a) hide the Org magic (e.g., inspect the underlying Org markup/syntax, search for URLs inside hyperlinks), or (b) "magic on" (i.e., reprettify the display). But I don't work with Org every day, and if it's been awhile I find myself needing to research "what's the name of that <pig-latin> mucking fode </pig-latin> I need to call?"

So I'm hoping my life will be easier if I know font lock's etymology ... plus I'm curious.


texts:
Is there a way to stop Yasnippet from autoloading? I installed it from melpa (v.20141102.1554), and have no reference to it in my init files. However, keeps up autoloading whenever I run emacs. I only wish it to initialize on my express command.

I also tried this use-package command with no avail:

(use-package yasnippet
  :defer t
  :commands (yas-load-directory)
  :config
  (progn
    (yas-load-directory "/home/nivaca/emacs_x/snippets/")
    (setq yas-indent-line nil)
  )
)

UPDATE

Fixed it with this code:

(use-package yasnippet
  :if (not noninteractive)
  :diminish yas-minor-mode
  :commands (yas-global-mode yas-minor-mode)
  :config
  (progn
    (setq yas-indent-line nil)
    (setq yas-snippet-dirs
      '("~/Dropbox/emacs_x/snippets"
        ))
  )
)

However, I am not sure what's going on...


texts: How to disable/ignore all key-bindings for a file-formats mode?

texts:
There are some file-type modes I mainly use for syntax highlighting (some other features may be handy - eldoc for example), however when loaded they add key-bindings that override my existing bindings.

Is there a general way to load the associated mode for a file-type without any of its key-bindings ?


texts: Is there a specific way to have the author email address linked on his name when exporting in LaTeX, or if I have to do it with LaTeX commands using hyperref package ?


texts:
Every other day I continue work on a coding project which involves these steps:

Open a file in the project
Open a terminal buffer e.g.: m-x term
Change to that term buffer
Enter command in termin e.g. : pytest myfile.py
Enter another terminal buffer e.g.: m-x ansi-term
Change to that term buffer
Enter command in ansi-termin e.g. : journalctl -f
Arrange all buffers
Resize all buffers

Do I have to live with that or can this be done by a function/keypress?

Note: In particular the restore of terminal commands is crucial. Google restore terminal in emacs suggests answers on restoring buffers


texts: remember-mode set custom dateformat for headers

texts:
Is there a way I can customize the "header" of a remembered note?

I couldn't find it in the docs. With the following set up

(use-package remember
  :bind (("C-c r r" . remember)
         ("C-c r n" . remember-notes))
  :config
  (setq remember-data-file (substitute-env-in-file-name "$HOME/docs/notes.adoc"))
  (setq remember-notes-initial-major-mode 'asciidoctor-mode)
  (setq remember-leader-text "== "))

I get

== Thu Dec  7 10:26:37 2017 (remember this!!!)

remember this!!!

What I want is to replace the date to one of the ISO formats (YYYY-MM-DD)


texts: How to make Flyspell ignore code blocks in Markdown?

texts:
Can I filter what Flyspell may check in the buffer? I don't want it to spell-check code in Markdown mode.

Maybe I can use the font-face at point for that? Something like this:

(let ((get-char-property (point) 'face))
  (when (equal face "markdown-pre-face")
    ;; no spell-check
    ))

This question is similar, but the solution there works only for Org-mode.


texts:
Q: how do I get the element number in a list?

nth gets element number n from a list:

(nth 2 '(a b c d))                      ; => c

I'd like to do the reverse: get the element number given the element:

(some-function 'c '(a b c d))           ; => 2

I may have missed it, but does such a function exist?  How would one do this?


texts: How to restore a window configuration after reboot?

texts:
I have foo.txt on the left and a terminal on the right:

|-------|----------|
|foo.txt|ansi@term>|
|-------|----------|

How can I restore the layout of the windows with the same buffers displayed after reboot?

I'v installed https://github.com/ffevotte/desktop-plus and tried desktop+-load after desktop+-create which doesn't restore nor inform what's happening.

System Info :computer:

OS: gnu/linux
Emacs: 26.3
Spacemacs: 0.300.0
Spacemacs branch: develop
Graphic display: t
Distribution: spacemacs
Editing style: vim
Completion: helm


texts: Is it possible to run one emacs but from two terminals?

texts:
I was thinking about how I work normally on services.  Where I might write code in an editor via Emacs in a terminal view, and in another terminal run the code, and yet still in another view tail the log.
I'd like to do something similar but with Emacs.  For instance, write some code in elisp which updates a buffer that's something like a log, but I'd like to put that log/view on another window in another terminal altogether, but controlled from one Emacs.  Is this possible?  If so how?


texts: Blank lines after org-mode code block results in LaTeX export

texts:
Context I am embedding org-mode source code blocks and their results into my document and am exporting it to LaTeX. I usually wrap the output of my code into helper functions that generate formatted LaTeX code, for example equation environments or TikZ graphics.

Question
Unfortunately I stumbled over blank lines after the results block leading to new paragraphs in the LaTeX document. Do you see a reasonin org-mode for this behauvior?

Related
On StackOverflow there is a question regarding newline characters at the end of each python print invocation but this does not resolve the issue:

StackOverflow: Print to the same line and not a new line in python

Modifying the end paramter of print does only insert abc before the newline but is not replacing it.

print('\\begin{equation}c+d\\end{equation}', end='abc'),

Minimum working example:

#+TITLE: Blank lines after source block results on export
#+LaTeX_HEADER: \usepackage{lsthighlight}

* Example
In this example I would like to show that exporting a paragraph with
the embedded two source blocks
#+BEGIN_SRC python :exports results :results output latex
print('\\begin{equation}a+b\\end{equation}')
#+END_SRC
and
#+BEGIN_SRC python :exports results :results output latex
print('\\begin{equation}c+d\\end{equation}')
#+END_SRC
will result in blank lines after the result listing in the exported
LaTeX document.

LaTeX export:

\section{Example}
In this example I would like to show that exporting a paragraph with
the embedded two source blocks
\begin{equation}a+b\end{equation}

and
\begin{equation}c+d\end{equation}

will result in blank lines after the result listing in the exported
\LaTeX{} document.

Instead it should be exported as follows:

\section{Example}
In this example I would like to show that exporting a paragraph with
the embedded two source blocks
\begin{equation}a+b\end{equation}
and
\begin{equation}c+d\end{equation}
will result in blank lines after the result listing in the exported
\LaTeX{} document.

I really have no idea where to look for this issue. That's why I have the hope that you can help me with this. Thank you!


texts: Import CSV into org-mode table, but preserve quotes around strings

texts:
I really like the ability to quickly go between CSV tables like this:

a, b, c
this, TRUE, 5,
that, FALSE, 8

...and org mode tables, that look like this:

| a    | b     | c |
| this | TRUE  | 5 |
| that | FALSE | 8 |

...using org-table-create-or-convert-from-region.

However, I often work with CSV files where the strings are quoted, i.e.:

a,b,c
"this",TRUE,5
"that",FALSE,8

Converting this to an org mode table gives:

| a    | b     | c |
| this | TRUE  | 5 |
| that | FALSE | 8 |

...which means that when converting back to CSV, I lose the quoting of "this" and "that".

Is there a simple way to import CSV tables into org mode while preserving quotes around strings (i.e. cells would like like | "this" |)?


texts: Highlight a specific phrase in any emacs buffer, regardless of mode

texts:
I would like to be able to highlight a particular phrase (in my case: @dakrone) in every emacs buffer, regardless of the mode (it's fine if it doesn't work in fundamental-mode). I know of something like:

(defun eos/add-watchwords ()
  "Highlight FIXME and TODO in code"
  (font-lock-add-keywords
   nil '(("\\<\\(TODO\\(?:(.*)\\)?:?\\)\\>"  1 'warning prepend)
         ("\\<\\(FIXME\\(?:(.*)\\)?:?\\)\\>" 1 'error prepend))))

(add-hook 'prog-mode-hook #'eos/add-watchwords)

But I haven't gotten something like that to be applied globally instead of having to manually add every mode I want to highlight in. Is there a way do do this?


texts:
My elpy uses ipython as the interactive interpreter.  It does not, however, emulate ipython's history-informed autocomplete feature (for lack of a better term).

That is: within an ipython session launched from the terminal, if you want to execute a line previously executed, you can type the first part of the line, and up-arrow will only display consistent previous commands.

In the ipython shell launched from elpy (with C-c C-c), I can execute previous commands with C-p, but I cannot view only those commands consistent with a given partial command. How can I utilize this very useful feature of ipython within the emacs elpy shell?


texts: Error running timer ‘ac-update-greedy’: (void-variable org-link-types)

texts:
I very recently updated to Emacs 26.3 and Org 9.2.6, and am getting the above-mentioned error whenever I type "[[" in an org-mode buffer to type a hyperlink. Unsurprisingly, no error after turning off auto-complete mode (20170125.245, the only version I see in "list-packages").

Any possible fixes or recommendations?

Addendum 1: Aside from the error message, the link still works fine.

Addendum 2: Searching through the variable index of the Org manual, there's no mention of "org-link-types". The second line of the debugger backtrace cites "org-ac--get-link-head-candidates()". The hyperlink takes me to the function's definition in "org-ac.el" where there's a line (mapcar (lambda (x) (concat x ":")) org-link-types))). Is it reasonable to assume this is what's causing the problem? And if so, is there anything to be done about it?


texts:
I launch a shell in my session with M-x shell and then I launch a python script that produces a lot of output to stdout---so many lines of output that my emacs session beomes quite slow.
Is there a command I can run to ask my buffer to be fixed length and automatically delete lines older than N?  I have tried looking this up, but don't even know what terms to use in my query beyond "automatically delete," "circular buffer" and "fixed length" which were not helpful.


texts: Can I write to a local file from a remote session using an Org-babel R code block?

texts:
I'd like to find a way to evaluate my R code remotely, but insert images into my local org file.

I use R code blocks in my org files and insert images into the org file with something like this:

#+begin_src R :exports results :results graphics :file test.png
  plot(1)
#+end_src

When ESS prompts me with:

ESS (*R*, R (default)) starting data directory?

I enter a remote location, e.g. /ssh:server:~/project/

The figure is then created in the remote directory and a link is inserted in the #+RESULTS, however this link "cannot determine image type".  Basically the image isn't local and so isn't viewable.  If I copy the image to the local directory, the link works and I see the image as if I had evaluated the code chunk locally.

I've also tried adding a :dir header argument and the full path to the image, like this:

#+begin_src R :exports results :results graphics :dir erker@krusty:~/ :file /tmp/test2.png

Can I specify somehow in the header arguments to write the file to a local directory so that it is inserted in the org file?


texts: LaTeX highlighting: Dollar expressions across lines

texts:
I'm having some trouble with LaTeX math expressions between (single) dollar signs. Specifically, syntax highlighting breaks across lines. Things looks something like this:

  if there exists $\alpha<\kappa$ and a map  $f:X\setminus\alpha\to
  Y $. Then let $ X,Y $ be subsets...

where I'm using boldface to indicate highlighting. It  should be displayed like this:

  if there exists $\alpha<\kappa$ and a map  $f:X\setminus\alpha\to
  Y $. Then let $ X,Y $ be subsets...

This was indeed the behavior in some previous version. I'm working now with GNU Emacs 24.3.1.

Is there some way to correct this?


texts: Want to Alt-Q on a long piece of text - but it has no spaces so it doesn't work

texts:
When you press Meta-Q to wrap a long blob of text, it doesn't work, probably because my text has no spaces.
my text is the result of a curl, json with no spaces.

so how do I tell emacs to add newlines at around 80 chars mark?


texts:
I want to activate tide-mode when using Javascript soruce code blocks,
following this it works well with indium:

https://orgmode.org/worg/org-contrib/babel/languages/ob-doc-js.html

But I want to use tide when editing the source code. if I activate the tide-mode, it seems to work, but the tide server is started. with other js frames. So this is a problem.

So how can Acchieve this automatically, or I need a something differente. in order to activate autocomplete, maybe indium autocomplete shopuld work


texts: Run function at the end and begin of any minibuffer interaction

texts:
I tried to advice read-from-minibuffer and read-string but nothing worked.

For example, when I called yes-or-no-p, no advice handlers were called.

Is there general way how to detect that user is interacting with minibuffer?
I need it because I have some package which in idle time print some data into minibuffer, problem is, when I interact somehow with minibuffer and wait here for a while, that package will simply print some garbage into it when I need it for something completely different.

EDIT: Currently I use following solution, but its kinda bad, I want something generic.

(advice-add #'yes-or-no-p
            :around
            (lambda (oldfun &rest args)
              ;; eat all messages
              (setq eldoc-message-function
                    (lambda (&rest args) nil))
              (prog1
                  (apply oldfun args)
                (setq eldoc-message-function
                      #'eldoc-minibuffer-message))))


texts: org-agenda-files variable is getting reset each time I launch emacs

texts:
Each time I launch Emacs, org-agenda-files is reset to nil. I can C-h v org-agenda-files, which confirms that the value of the variable is nil.

I have the following in .emacs.d/package-init.el:

(use-package org
  :ensure t
  :config
  (setq org-agenda-files (quote ("~/org/"))
        org-startup-indented 1
        org-default-notes-file (concat org-directory "/inbox.org")
        org-refile-targets '(
                             (nil :maxlevel . 9)
                             (org-agenda-files :maxlevel . 9)
                             )
        org-agenda-window-setup 'current-window
        org-agenda-restore-windows-after-quit t
        )
  (define-key global-map "\C-cc" 'org-capture)
  (global-set-key (kbd "C-c l") 'org-store-link)
  (global-set-key (kbd "C-c a") 'org-agenda)
  (global-set-key (kbd "C-c c") 'org-capture)
  (add-hook 'org-mode-hook 'turn-on-flyspell)
  )

Everything else under the :config for org mode is getting set correctly.

What’s really strange is that if I open the package config file as a buffer and M-x eval-buffer, org-agenda-files gets set correctly, which I can confirm by using help on the variable.

How is this possible?


texts: How to change the font face of the current buffer?

texts:
I am using tex-mode in Aquamacs and would like to temporarily change the font for the current buffer. What is the way to do it? I tried:

(set-face-attribute "American Typewriter" nil :height 150)

which gives the error:

eval: Wrong type argument: symbolp, "American Typewriter"

even though "American Typewriter" is in (font-family-list). When I try:

(set-face-attribute "American Typewriter" nil :height 150)

it only affects the font of the minibuffer, not the current buffer I have open.


texts:
I am running GNU Emacs 26.3 under Windows 7. I want to install the Solarized theme by typing M-x package-install solarized-theme.

When I do this, I see the message No match (see below).

I tried to configure MELPA in my .emacs file. However, I am still getting the error.

How can I fix it?


texts:
Anyone know what controls the font face of this part of org markup:

https://www.screencast.com/t/n5wdrkktl9oQ

I've tried changing so many things in list-faces-display but I can't seem to find it.


texts: How to type superscript Roman numeral in Emacs, e.g., by using TeX input method?

texts: One can type normal Roman numerals by using C-x 8 RET. For example, to type Ⅲ one use C-x 8 RET 2162 RET. Furthermore, one can type superscript numbers, English letters and Greek ones by using the TeX input-method. For example, to type superscript alpha one switch to the TeX input-method and use ^\alpha. However, it seems that one cannot type superscript Roman numerals, not even by expanding the TeX input-method as suggested ?


texts: Configure gud to invoke python3 debugger instead of python debugger

texts: When I issue the Emacs command M-x pdb it invokes Python’s pdb as python -m pdb foo.py. I want to instead invoke python3 -m pdb foo.py -- how do I set this up?


texts: How to pretty print Scheme code in Emacs?

texts:
I would like to format Scheme code inside Emacs, I'm developing Scheme interpreter and my formatter don't work quite right, so while I'm working on syntax-rules macro I would like to pretty print the code I'm working on, without the need right not to fix my formatter.
The code is expansion of SRFI-197 that I'm try to debug and fix (fix my syntax-rules implementation since the code in SRFI-197 is correct).
Just for completeness here is the code I'm trying to format:
(let () (define-syntax %chain (syntax-rules …₂ (placeholder ellipsis) ((_ () () () ((var) …₂) () (step …₂ last-step)) (let* ((var step) …₂) last-step)) ((_ () () () (vars …₂) () (step …₂ last-step)) (let*-values ((vars step) …₂) last-step)) ((_ () () () out-vars (step . in-steps) out-steps) (%chain step () () out-vars in-steps out-steps)) ((_ () step () (out-vars …₂) in-steps (out-steps …₂)) (%chain () () () (out-vars …₂ ignored) in-steps (out-steps …₂ step))) ((_ () step vars (out-vars …₂) in-steps (out-steps …₂)) (%chain () () () (out-vars …₂ vars) in-steps (out-steps …₂ step))) ((_ (placeholder ellipsis) (step …₂) () (out-vars …₂) in-steps (out-steps …₂)) (%chain () () () (out-vars …₂ chain-rest-var) in-steps (out-steps …₂ (apply step …₂ chain-rest-var)))) ((_ (placeholder ellipsis) (step …₂) (vars …₂) (out-vars …₂) in-steps (out-steps …₂)) (%chain () () () (out-vars …₂ (vars …₂ . chain-rest-var)) in-steps (out-steps …₂ (apply step …₂ chain-rest-var)))) ((_ (placeholder ellipsis . rest) . _) (syntax-error _ ... can only be used as a final argument)) ((_ (placeholder . in-step) (out-step …₂) (vars …₂) . rest) (%chain in-step (out-step …₂ chain-var) (vars …₂ chain-var) . rest)) ((_ (x . in-step) (out-step …₂) . rest) (%chain in-step (out-step …₂ x) . rest)))) (%chain (map (lambda (x) (+ x 1)) _) () () () ((filter odd? _) (fold * 1 _)) (initial-value)))


texts: Modifying syntax so as to grey out the non-source part of an org file

texts:
I thought a nice alternative to (org-edit-special) (which
becomes cumbersome with many small blocks), and to
tangling-and-untangling (which is incompatible with noweb
references), might be simply to switch to the source mode, so
that source indentation and highlighting would work.

    (defun org*-toggle ()
      (interactive)
      (if (eq major-mode 'org-mode)
          (funcall (org-src-get-lang-mode (car (org-babel-get-src-block-info))))
        (let ((org-startup-folded nil))
          (org-mode))))

But this would be even nicer if the non-source parts of the file
were either displayed in the shadow face or completely hidden.
How could one achieve that?


texts: Yanking line copies past kill-ring lines along with current

texts:
I'm using Emacs to create text to copy to another program, but I need to copy line by line. I'm using a variation of kill-ring-save I provide below.

(defun my-kill-ring-save ()
    (interactive)
    (if (equal mark-active nil) (kill-ring-save (point) (line-end-position)) (kill-ring-save (point) (mark))))
(global-set-key "\M-w" 'my-kill-ring-save)

So I would do this:

M-w to copy the line
Alt-Tab to go to the other program
Ctrl-v to paste the line
Alt-Tab to go back to Emacs
C-k two times (delete the current line, and again so the next line moves up)
Repeat the process

The problem is that when I hit Ctrl-v in the other program sometimes it yanks not only the line I want, but other previously deleted lines. I read that the paste command should only paste the last line in the kill ring, thats what I would like it to do. This problem only happens (as far as I know) If I C-k two times fast and right after copying the line with M-w. If I kill lines with C-k, wait for 3 seconds, I'm able to M-w the current line and paste just this line. Sorry if it seems like a exageration of a small problem, but I'm actually doing this process a lot of times so any solution would be great for me. I couldn't find any related problem about this specficic issue.

EDIT: the solution below unfortunately didn't work or I couldn't use it correctly, appreciate any update on this, thanks!


texts: Limit property entry by type or regular expression

texts:
It is possible to get Org to limit the values you can enter for a property by using the special _ALL property. For example, if I want to limit the CONDITION property I could use:
#+PROPERTY: CONDITION_ALL Pristine Worn Repaired Damaged

after which when I use the menu to insert the CONDITION property, I will be presented with these for options and only allowed to enter them.
I really like this feature, but I wish it was a bit more flexible, allowing a concept of a type or a regular expression to limit my entry. As a conceptual example, it would be nice if I could set a property something like
#+YEAR_REGEX: \d{4}

which would then only allow me to enter four-digit integers through for the YEAR property when using the insertion menu. To be clear, I am not trying to be overly picky about how this works. Another example that could also be useful:
#+YEAR_PREDICATE: numberp

would only allow me to enter values for YEAR that satisfied the ELisp predicate numberp.
How can I get Org to limit my property entry more flexibly than by an enumeration only?


texts: can I have swiper and counsel as "add-ons" and not the default binding

texts:
I like the powers that counsel/ivy/swiper gives me, specially
for C-s and C-x C-f,
but since installing it, I've started missing the vanilla emacs C-s and C-x C-f.
It would be awesome if I can "call" these enhanced versions if I feel lost.
For example

To look for something I do vanilla Emacs C-s, and after a few seconds I realize I need swiper, so I should be able to "hop" in to swiper mode.

Likewise, I do vanilla emacs C-x C-f, and after a few tab presses I feel I need counsel(?), so I should be able to to "hop" on to counsel.

Is this a good idea? - Is anybody doing this already? If so how.


texts:
QMK defines Hyper as Ctrl+Shift+Alt+GUI.
XFCE4 is treating my Left super as Hyper, which also happens to be the key that was configured as Hyper in xmodmap when the shortcut was defined.
Emacs doesn't treat QMK's Hyper as equivalent to the Hyper that can be generated in Emacs.
Is there a "hardware definition" for the Hyper that Emacs uses?


texts: How to make `emacs` shell command switch to existing emacs process, if it exists?

texts:
Is there a way to get the emacs shell command (the UNIX utility) to start an emacs process, if none exists, but if one does, switch to it?

More specifically, is there a way to get the command emacs file1 file2 visit file1 and file2 in the existing emacs process, if one already exists?

BTW, I'm not sure how to tag this.


texts: How to save speck-mode dictionary with file?

texts:
What I tried, putting at the end of a file:

Local IspellDict: de
As local variable: speck-dictionary: de

However, neither is interpreted. When I open the file in question, speck-mode
always uses en as dictionary. The spell checker used is hunspell.

What should I add to a file to change the dictionary of speck-mode?

By the way, I use speck-mode because flyspell-mode is very slow on my
system.


texts: Why does preview-latex not show some equations?

texts:
I open a LaTeX file in Emacs, and press C-c C-p C-b (M-x preview-buffer) to generate math/graphics previews for the entire buffer. I find that a PDF file is generated with each page containing a math formula.

I then move cursor to the beginning of an equation, press C-c C-p C-p (M-x preview-at-point), but the equation gets folded up!  Here are screenshots before and after pressing C-c C-p C-p:

Am I using preview-latex correctly? Why is there no equation rendered for the first line?

When moving cursor inside an align environment, I don't get a preview either, and it says:

GPL Ghostscript 9.05: Unrecoverable error, exit code 1
Preview-PDF2DSC exited abnormally with code 1 at Sun Sep 28 10:19:53
PDF2DSC sentinel: Opening input file: no such file or directory,  ./_region_.prv/tmp19610wh0/preview.dsc

I installed AucTeX and TeXLive on my Ubuntu 12.04.

TeXlive 2009-15
AUCTeX 11.86-2ubuntu1
preview-latex 11.86-2ubuntu1

I use TeX-PDF-mode.

After installing the latest auctex, the problem solved.

However, when C-c C_p C-d, there is an error at the end:

(see the transcript file for additional information)</usr/share/texmf-texlive/f
onts/type1/public/amsfonts/cm/cmbx12.pfb></usr/share/texmf-texlive/fonts/type1/
public/amsfonts/cm/cmex10.pfb></usr/share/texmf-texlive/fonts/type1/public/amsf
onts/cm/cmmi12.pfb></usr/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmm
i6.pfb></usr/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmmi8.pfb></usr
/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmr12.pfb></usr/share/texmf
-texlive/fonts/type1/public/amsfonts/cm/cmr6.pfb></usr/share/texmf-texlive/font
s/type1/public/amsfonts/cm/cmr8.pfb></usr/share/texmf-texlive/fonts/type1/publi
c/amsfonts/cm/cmsy10.pfb></usr/share/texmf-texlive/fonts/type1/public/amsfonts/
cm/cmsy6.pfb></usr/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmsy8.pfb
></usr/share/texmf-texlive/fonts/type1/public/amsfonts/symbols/msbm10.pfb>
Output written on hw.pdf (135 pages, 204905 bytes).
Transcript written on hw.log.

Preview-LaTeX exited as expected with code 1 at Sun Sep 28 17:21:07
LaTeX: LaTeX found no preview images

When C-c C-p C-p, I can see the preview:

Preview-LaTeX exited as expected with code 1 at Sun Sep 28 17:22:06
Running `Preview-PDF2DSC' with ``pdf2dsc _region_.pdf _region_.prv/tmp32202-vH/preview.dsc''

Preview-PDF2DSC finished at Sun Sep 28 17:22:07
Running `Preview-Ghostscript' with ``gs -dOutputFile\=\(_region_.prv/tmp32202-vH/pr1-\%d.png\) -q -dDELAYSAFER -dNOPAUSE -DNOPLATFONTS -dPrinted -dTextAlphaBits\=4 -dGraphicsAlphaBits\=4 -sDEVICE\=png16m -r96x96.0504''

Preview-Ghostscript finished at Sun Sep 28 17:22:21


texts: In markdown-mode cursor goes to beginning of line when I type certain characters

texts:
In markdown-mode the cursor goes to the beginning of a line whenever I type any of (),[]{};:, this happens in both GUI and command-line emacs, this only happens in markdown-mode.

How do I stop this from happening?

Emacs version: GNU Emacs 26.1


texts: How do I leave out/surpress particular default \usepackage headers when exporting to LaTeX?

texts: When exporting to LaTeX from org-mode, it seems that several \usepackage headers are added by default. However, what if I want to disable one of them (not all), because I will manually specify a replacement to that package later? The documentation seems to only talk about adding new headers but I'm not sure about surpressing a particular header instead.


texts: How can I configure Emacs to search verbatim by default?

texts:
Emacs makes assumptions about what constitutes an adequate match for a search.  In particular, AFAICT, it disregards whitespace differences, as well as differences in case.

During an incremental search, it is possible to toggle these settings.  For example, M-s SPC toggles whitespace matching.

But is there something I can put in my .emacs file such that the default initial settings are the strict ones?  (I.e. search for the exact string I have typed in the minibuffer.)

Just to be clear, I still want to be able to toggle these settings.  (In fact, my preference would be to selectively adjust these settings for the duration of a search, rather than turning them on or off for the remainder of the session.)


texts: Bindings just for text buffers created by magit?

texts:
I'm trying to create a different keybinding to abort a commit in magit. Right now, when you're editing a commit message C-c C-k is bound to with-editor-cancel, which does the trick.  But I'm an evil user and prefer vim-style keybindings, and I actually use evil-escape to set most of my bail-out keybindings to ESC ESC.
My first thought was to just provide a different keybinding for with-editor-cancel, like to bind it in normal state to ESC ESC to match the rest of my escape keys. But here's the problem: Magit commit edit buffers appear to run under text major mode which a bunch of other modes I use constantly inherit from (markdown, org, etc.) And with-editor-cancel appears to be super-dangerous to have bound to a key normally.  I tried it out on an org file just to see what would happen, and it not only killed the buffer without any confirmation, but also deleted the underlying file from the file system (!!!).  This is not something I want to accidentally call.
So, like, is there some way to define a keybinding only on those text-mode buffers that happen to have been created by magit?
(Most of my keybindings are defined with general, but I'm happy to do it some other way.)


texts: Footnote-like custom function for org-roam-insert

texts:
I am trying to make a custom function for org-roam which inserts footnote-like links in the current note.
The idea is to insert links on this way
The logistic regression [fn:20200612000001]...

* Footnotes

[fn:20200612000001] [[file:20200612000001-definition_logistic_regression.org][Logistic regression]]

and the linked file has the form
:PROPERTIES:
:ID: 20200612000001
:END:
#+TITLE: Definition Logistic Regression

I just copy-pasted the original org-roam-insert function and hacked it a little to insert the footnote. The code is here https://gist.github.com/maikol-solis/ed149c16cff16a55492d1acba8c12025.
However, after a couple of times using it, emacs crashes completely.  I think that is caused by this function because this has never happened before.
I used gdb to follow the crash and this is the output:
Thread 1 "emacs-gtk" received signal SIGSEGV, Segmentation fault.
gui_produce_glyphs (it=0x7fff82fc3650) at xdisp.c:29925
29925         struct font *font = face->font;
(gdb) next
handle_sigsegv (sig=11, siginfo=0xc201f0 <sigsegv_stack+7152>, arg=0xc200c0 <sigsegv_stack+6848>) at sysdep.c:1876
1876    {
(gdb) next
1882      if (!fatal && !pthread_equal (pthread_self (), main_thread_id))
(gdb) next
1886      if (!fatal && stack_overflow (siginfo))
(gdb) next
1890      deliver_fatal_thread_signal (sig);
(gdb) next

Thread 1 "emacs-gtk" received signal SIGSEGV, Segmentation fault.
0x00007fc45ddc1170 in raise () from /lib64/libpthread.so.0
(gdb) next
Single stepping until exit from function raise,
which has no line number information.
[Thread 0x7fc44567f700 (LWP 28923) exited]
[Thread 0x7fc4477fe700 (LWP 28922) exited]
[Thread 0x7fc447fff700 (LWP 28921) exited]
[Thread 0x7fc44df97700 (LWP 28920) exited]

Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.

I appreciate any help to solve this issue.
Best.


texts: Comparing two text files on a Windows system

texts:
Since ediff-files and ediff-buffers result in apply: Searching for program: no such file or directory, diff error on windows machines.

How to compare two files using Emacs on a windows system?


texts:
How to turn off auto indent on yank in web mode?

As far as I understand, I must call remove-hook with the name of the hook and the function. But how too find them?


texts: org heading temporarily not visible when folding

texts:
Sometimes when I close all the folds in org mode one of my headings becomes invisible.

It depends on where my cursor is at the time of the fold. But despite my testing I don't know a hard fast rule for where the cursor needs to be to reproduce it. Although it occurs often enough that I can reproduce it by blind guessing a cursor point and calling C-u C-u org-cycle-folds.

This is an example of an invisible heading:

This is what the org document should look like:

To fix this I have looked into redraw-display and redraw-frame.

(add-advice #'org-cycle-folds :after (lambda () (redraw-display))

Unfortunately and unusually this did not work. Or, at least, when the display was redrawn it was redrawn with the hidden fold.

The only solution that seems to work is placing my cursor on the heading.

Based on this I made a hack that seems to work (I haven't been able to reproduce the problem again).

It is

(advice-add #'org-cycle :after (lambda (&rest rest)
                                 (next-line) (previous-line)))

;; I also tested this for evil and it works the same way
(advice-add #'evil-close-folds :after
            (lambda ()
              (next-line) (previous-line)))

Interestingly, If I do (save-excursion (next-line) (previous-line)) (which I tried because I'm paranoid and think I could end up on different original point somehow), it doesn't work.

Of course, this not the best solution. What confuses me the most is what exactly triggers the heading to display correctly. I know it's associated with moving the point into the heading, which is why I move to the next line and back again.

Any ideas as to what's actually responsible for this heading hiding and how I can resolve it in a more direct way (rather than the hacky way I have)?


texts: using functions with mandatory and optional arguments

texts:
I am trying to understand, what some functions are doing, in order to code something similar.

The following example was copied from the file acro.el from the AUCTeX package.  This is just a random example, as any other style-file from AUCTeX will do.

In acro.el you will find

...
 (TeX-add-symbols
    ;; Creating New Acronyms
    '("DeclareAcronym" LaTeX-arg-define-acro-acronym
      (LaTeX-arg-acro-key-val "Definition of acronym (k=v)"
                  LaTeX-acro-declareacronym-keys))
...)

I do interpret this, that if you want to insert the macro \DeclareAcronym into your LaTeX-buffer, (by running the command TeX-insert-macro, bound to CTRL-cCTRL-m) AUCTeX will first run the function LaTeX-arg-define-acro-acronym.

This---in return---is defined this way:

(defun LaTeX-arg-define-acro-acronym (optional &optional prompt)
  "Prompt for an acronym completing with known acronyms.
If OPTIONAL is non-nil, insert the resulting value as an optional
argument, otherwise as a mandatory one.  Use PROMPT as the prompt
string."
  (LaTeX-arg-acro-acronym optional prompt t))

As far, as I have understood LISP, the function LaTeX-arg-define-acro-acronym has to be called with one mandatory argument.  You may also give it a second, optional argument.

Therefore, calls as this

(LaTeX-arg-define-acro-acronym t)
(LaTeX-arg-define-acro-acronym t "Acronym to define: ")

should be correct.  In fact, I can execute those commands in the scratch buffer without error.

But, as you saw above, the function is called without the mandatory argument and even without the parentheses ():

LaTeX-arg-define-acro-acronym

Can someone explain to me, why this is working and why emacs is not throwing an error?  When I try this in the *scratch*-buffer, I get an error

  Symbol's value as variable is void

When I add parentheses, I get this error message in the minibuffer

  Wrong number of arguments

Digging further into the code, I found, that LaTeX-arg-define-acro-acronym calls the function LaTeX-arg-acro-acronym.  This time, the mandatory OPTIONAL and both optional arguments PROMPT and DEFINITION are handed over. Again, copied from acro.el:

(LaTeX-arg-acro-acronym optional prompt t)

This time the parentheses () are used.

I am asking myself, what value OPTIONAL, PROMPT and DEFINITION do get, as they haven't been defined (as far as I can see).  (Are there any defaults, I have missed?)


texts: Using a master password (gnupg) with twittering-mode

texts:
I'm using Emacs 25.1 on fresh Debian Unstable installation. I have gnupg installed on my system, and twittering-use-master-password is t. When I invoke M-x twit, a web page with an application PIN is opened, and I must enter that PIN in Emacs. After I authorize the application, I get the following messages:

Open authorization URL with browser? (using `browse-url') (y or n) y
Authorization for the account "gnuvince" succeeded.
Encrypting......
(Encrypt failed Exit)
Loading international/kinsoku...done
Fetching :home. Success. :home: +20
Fetching :home. Success. (No new tweets)

Encryption used to work on my former laptop, does anyone know why the encryption would fail now?


texts: Can you use a regexp in an abbrev definition?

texts:
I want to replace words like 1st with 1^{st} and 102nd with 102^{nd} while typing in emacs. Basically I want to replace things that match this:

"\([0-9]+\)\(st\|nd\|rd\|th\)"

with this \1^{\2} as I type.

It seems like an abbrev might work for this, but it does not appear you can put a regexp as the name.

The best I have come up with is

(defun org-ordinal-expansion ()
  (interactive)
  (and (= ?w (char-syntax (char-before)))
       (save-excursion
         (and (skip-syntax-backward "w")
          (let (case-fold-search)
        (looking-at "\\([0-9]+\\)\\(st\\|nd\\|rd\\|th\\)"))
          (replace-match "\\1^{\\2}")))))

(define-minor-mode ordinal-mode
  "Toggle `ordinal-mode'.  Converst 1st to 1^{st} as you type."
  :init-value nil
  :lighter (" om")
  (if ordinal-mode
      (add-hook 'post-self-insert-hook #'org-ordinal-expansion nil 'local)
    (remove-hook 'post-self-insert-hook #'org-ordinal-expansion 'local)))

Is there some more elegant way to achieve this that doesn't rely on the post-self-insert-hook?


texts:
This discussion got me investigating Calc programming with elisp, especially at the bottom this code

(defmath myFact (n)
 (format-number (calcFunc-fact n)))

then

(calcFunc-myFact 33)

yields 8683317618811886495518194401280000000

...all of which works nicely from my *scratch*. However, I would like these functions to work, but they don't seem to. The docs say many confusing things, such as prepending calcFunc- and math-. Also I've tried (require 'calc-ext) and tried running (calc-extensions). All of attempts to use these vector functions return void function errors. What am I missing?


texts: 'Symbol's value as variable is void' in callback from url-retrieve

texts:
When executing the following I get an error:

(defun caller (func)
  (url-retrieve "http://m0smith.freeshell.org/"
   (lambda (status) (funcall func))))

(caller (lambda() (message "called")))

Result:

error in process filter: Symbol's value as variable is void: func

What is the best way to solve this problem?  Basically I need to accept a callback from somewhere else, wrap it in another lambda and use that as the callback to url-retrieve.

If I change caller to

(defun caller (func)
  (url-retrieve "http://m0smith.freeshell.org/"
   `(lambda (status) (funcall ,func))))

it works.  However, I cannot do this as func is being passed by flycheck and the macro expansion breaks it.  To see the full context of what I am doing: https://gist.github.com/m0smith/b5961fda6afd71e82983


texts: Yanking without moving the mark, but still be able to `yank-pop`

texts:
I would like to change C-y to not move the mark, but still be able to yank-pop. I looked at the source code and saw that the major change needed was to remove the (push-mark (point)) command:

(defun yank (&optional arg)
  "Reinsert (\"paste\") the last stretch of killed text.
More precisely, reinsert the most recent kill, which is the
stretch of killed text most recently killed OR yanked.  Put point
at the end, and set mark at the beginning without activating it.
With just \\[universal-argument] as argument, put point at beginning, and mark at end.
With argument N, reinsert the Nth most recent kill.

When this command inserts text into the buffer, it honors the
`yank-handled-properties' and `yank-excluded-properties'
variables, and the `yank-handler' text property.  See
`insert-for-yank-1' for details.

See also the command `yank-pop' (\\[yank-pop])."
  (interactive "*P")
  (setq yank-window-start (window-start))
  ;; If we don't get all the way thru, make last-command indicate that
  ;; for the following command.
  (setq this-command t)
  (push-mark (point))
  (insert-for-yank (current-kill (cond
                  ((listp arg) 0)
                  ((eq arg '-) -2)
                  (t (1- arg)))))
  (if (consp arg)
      ;; This is like exchange-point-and-mark, but doesn't activate the mark.
      ;; It is cleaner to avoid activation, even though the command
      ;; loop would deactivate the mark because we inserted text.
      (goto-char (prog1 (mark t)
           (set-marker (mark-marker) (point) (current-buffer)))))
  ;; If we do get all the way thru, make this-command indicate that.
  (if (eq this-command t)
      (setq this-command 'yank))
  nil)

But when I look at the source code for M-y, it relies on the mark to be able to function:

(defun yank-pop (&optional arg)
  "Replace just-yanked stretch of killed text with a different stretch.
This command is allowed only immediately after a `yank' or a `yank-pop'.
At such a time, the region contains a stretch of reinserted
previously-killed text.  `yank-pop' deletes that text and inserts in its
place a different stretch of killed text.

With no argument, the previous kill is inserted.
With argument N, insert the Nth previous kill.
If N is negative, this is a more recent kill.

The sequence of kills wraps around, so that after the oldest one
comes the newest one.

When this command inserts killed text into the buffer, it honors
`yank-excluded-properties' and `yank-handler' as described in the
doc string for `insert-for-yank-1', which see."
  (interactive "*p")
  (if (not (eq last-command 'yank))
      (error "Previous command was not a yank"))
  (setq this-command 'yank)
  (unless arg (setq arg 1))
  (let ((inhibit-read-only t)
    (before (< (point) (mark t))))
    (if before
    (funcall (or yank-undo-function 'delete-region) (point) (mark t))
      (funcall (or yank-undo-function 'delete-region) (mark t) (point)))
    (setq yank-undo-function nil)
    (set-marker (mark-marker) (point) (current-buffer))
    (insert-for-yank (current-kill arg))
    ;; Set the window start back where it was in the yank command,
    ;; if possible.
    (set-window-start (selected-window) yank-window-start t)
    (if before
    ;; This is like exchange-point-and-mark, but doesn't activate the mark.
    ;; It is cleaner to avoid activation, even though the command
    ;; loop would deactivate the mark because we inserted text.
    (goto-char (prog1 (mark t)
             (set-marker (mark-marker) (point) (current-buffer))))))
  nil)

So how do I still maintain full yank functionality without having yank (C-y) move my cursor?


texts:
I've been using magit for a few months now and I like it a lot. But one thing I still do it in a terminal is cherry picking.

What is a simple way to do this?


texts: How do I get code signature snippets with lsp-mode/lsp-ui/company-lsp?

texts:
I see on the front page of https://github.com/tigersoldier/company-lsp when you type the function name it autocompletes not just the rest of the name, but the signature as a snippet, enabling you to tab to the args and fill them in.

That's not working for me, and I'm not sure why. (Not even sure which package is providing those signature snippets.) Here's a short emacs init file I'm using to test:

(require 'package)
(package-initialize)
(require 'use-package)
(setq use-package-verbose t)

(use-package yasnippet
  :ensure t
  )

(use-package company
  :ensure t
  :demand
  :bind (("M-RET" . company-complete))
  :config
  (global-company-mode)
  )

(use-package lsp-mode
  :ensure t
  :commands lsp
  :hook ((vue-mode . lsp)
         (typescript-mode . lsp)
         (python-mode . lsp))
  :config
  (setq lsp-prefer-flymake t)
  )
(use-package lsp-ui
  :ensure t
  :commands lsp-ui-mode
  :hook (lsp-mode . lsp-ui-mode)
  )
(use-package company-lsp
  :ensure t
  :config
  (push 'company-lsp company-backends)
  ;; Disable client-side cache because the LSP server does a better job.
  (setq company-transformers nil
        company-lsp-async t
        company-lsp-cache-candidates nil)
  )

If I have a typescript file like this:

function foo1(a: number, b: number) {
  return a+b
}

function foo2(a: number) {
  return a % 2 == 0
}

function main() {
    foo

with the cursor at the end of the last "foo", I do get the popup with possible completions, but when I select one I don't get the signature like in the gif on the company-lsp home page.
I do get the doc in the minibuffer with the current arg highlighted as I type, so I know the info is in there somewhere!


texts: mu4e bookmarks: how to hide messages for folders like Trash and Spam?

texts:
I am trying mu4u for Gmail and an Exchange account.

;;; Mail directory shortcuts
  (setq mu4e-maildir-shortcuts
        '(("/Gmail/INBOX" . ?g)
          ("/Exchange/INBOX" . ?a)))

;;; Bookmarks
  (setq mu4e-bookmarks
        `(("flag:unread AND NOT flag:trashed AND NOT (maildir:/[Gmail].Trash OR maildir:/Trash)" "Unread messages" ?u)
          ("date:today..now" "Today's messages" ?t)
          ("date:7d..now" "Last 7 days" ?w)
          ("mime:image/*" "Messages with images" ?p)
          (,(mapconcat 'identity
                       (mapcar
                        (lambda (maildir)
                          (concat "maildir:" (car maildir)))
                        mu4e-maildir-shortcuts) " OR ")
           "All inboxes" ?i)))

  )

On mu4e main view, hitting bu brings me unread email from all over places including Trash folders.

How do I change it so that I don't see messages that are trashed in Trash folders or marked spam?


texts: Org-Mode Startup not Rendering Theme Colors at Startup

texts:
System Info

Windows 10
emacs 27.1 64-bit

Description
Basically, when I open a new org file, it appears to be a plain text document.  However, I can clearly see that org-mode is activated, and this is confirmed by M-x describe-variable major-mode.

As you can see in the picture above, I don't see any coloring of my example headlines despite clearly being in Org-Mode.  However, once I M-x org-mode, the colors are rendered.  How do I go about debugging?
Another weird thing I noticed in my message buffer was the following line: (Shell command succeeded with no output).  I've never seen this before, so I don't know if it's related.  Google searches don't yield anything helpful.


texts: I've been working on align-rules for Fortran 90 so that the built-in align and align-current functions do something useful. What would be the best way to make this code available for others?