texts: elpy (and evil-mode) do not react on TAB

texts:
This is my elpy-config
 1Elpy Configuration
 2
 3Virtualenv........: None
 4RPC Python........: 3.7.3 (/usr/bin/python3)
 5Interactive Python: /usr/bin/python3 (/usr/bin/python3)
 6Emacs.............: 26.1
 7Elpy..............: 1.28.0
 8Jedi..............: 0.17.2
 9Rope..............: Not found
10Autopep8..........: 1.5.3
11Yapf..............: Not found
12Black.............: Not found
13Syntax checker....: flake8 (/usr/local/bin/flake8)

It runs on Debian 10.
When typing TAB nothing happens. No message. No change in the mode line or status line.
Is it default that elpy do not work with TAB and why?
How can I turn this on?
EDIT: I expect 4 empty chars when typing TAB.
EDIT2: M-x describe-key <kbd>TAB</kbd> results in
TAB (translated from <tab>) runs the command evil-jump-forward (found in
evil-motion-state-map), which is an interactive compiled Lisp function in
‘~/.MyAppData/emacs.d/elpa/evil-20201014.2043/evil-commands.el’.

It is bound to TAB.

(evil-jump-forward &optional COUNT)

Go to newer position in jump list.
To go the other way, press C-o.

I have evil-mode installed and activated. So there must be a reason why TAB is used by evil-mode but do not work.


texts: How can I sort Org headings by value in :properties:

texts:
My org file structure is this:
* Heading 1
:PROPERTIES:
:EVENT_CREATED: [2016-11-28]
:END:
* Heading 2
:PROPERTIES:
:EVENT_CREATED: [2016-10-27]
:END:
* Heading 3
:PROPERTIES:
:EVENT_CREATED: [2019-02-08]
:END:

I essentially want to sort each all headings by the EVENT_CREATED property, so that they are on chronological order.


texts:
For my current config, I'm tangling an org-mode buffer into my init.el, and I have a few sections where I'd like to insert rich text between segments of Emacs lisp code, like the following:

...

#+BEGIN_SRC elisp
(use-package exwm
  :config
  (exwm-enable)
#+END_SRC

I find that four workspaces is enough to start out with, and I like being able
to use my X windows across workspaces.

#+BEGIN_SRC elisp
  :init
  (setq exwm-workspace-number 4
        exwm-workspace-show-all-buffers t
        exwm-layout-show-all-buffers t)
#+END_SRC

...

The issue is, if I C-c ' to edit the second SRC block, it reindents to the beginning of the line. Smartparens is also unhappy about any unmatched closing parentheses I have in subsequent blocks.

Is there anything in org-mode that would support something like this? Perhaps some marker I can tag each block with as a hint that they should all be pulled into the same Org Src buffer when I C-c ' on one of them?


texts:
is there a way to keep only source code inside source code, that is make #+BEGIN_SRC and #+END_SRC invisible? It's cosmetic but it makes things clearer when one have to deal with a lot of short code snippets.
For exemple:

(defun org-xor (a b)
          "Exclusive or."
          (if a (not b) b))

instead of :

  #+BEGIN_SRC emacs-lisp
       (defun org-xor (a b)
          "Exclusive or."
          (if a (not b) b))
  #+END_SRC


texts: ibuffer: how to filter ruby and rspec buffer into separate groups?

texts:
I have files like model.rb and model_spec.rb in my Rails project.
Both have ruby as major mode and using a regex doesn't work on the Specs filter group.

(setq ibuffer-saved-filter-groups
  (quote (("default"
            ("Ruby"
              (mode . ruby-mode))
            ("Specs"
              (name . "spec\.rb$"))))))


texts: wanderlust: save all attachments in a group of messages

texts:
I'm using wanderlust in emacs-25.1.x

I'm looking for a way to select a group of messages and have all of their MIME attachments extracted and saved into a specified folder.

I assume that I can mark the messages with the target mark ('*'), and use 'wl-summary-target-mark-set-action' to specify an action to run on each of these marked messages. However, I don't know what action will save all MIME attachments in any given message.

I have searched through the wanderlust docs, but I couldn't find anything. If this info is documented somewhere, could someone point me to it?

Thank you very much in advance.


texts:
After a few trials and errors, I finally managed to find a series of customization for my Emacs to be the almost perfect distraction free environment. However, I don't want these settings to load every time I open Emacs, I want to be able to press a button (like F10) and have a chain of commands executed, like the following:

M-x load-theme solarized-dark
M-x org-mode
M-x olivetti-mode
M-x olivetti-set-width 120
M-x wc-goal-count

And I would like to revert the commands and their effect, once I'm done with writing (obviously without quitting Emacs).

An acceptable course of action (maybe more elegant) would be to execute all this when loading olivetti-mode, since I'll use this mode exclusively in distraction free environment, but I would like to be able to revert all those settings too. I'm sure it's possible, but I can't figure it out yet.

I'm obviously a n00b, so any idea, setting, hint, link that would simplify my workflow is welcomed.


texts: Experience with WSL as underlying shell (esp. with Texlive) for native win-x64 Emacs

texts:
I've been using MinGW compiled native windows 64-bit Emacs for a while, and I paired it with Cygwin to use especially Texlive, as well as other common linux and shell programs and commands.

I am considering switching to Windows Subsystem for Linux (WSL) as I am using Windows 10, and WSL allows me to install genuine linux distributions (esp. the case of WSL2).

I notice two important differences between Cygwin and WSL, which may make pairing up with them for my native windows Emacs different or potentially problematic:

WSL uses linux native binary files for their executables. It can run
downloaded linux binary executable files. I believe it is only their
executables and they can edit and make changes to other files as
usual.
WSL sets the root directories and home directories in a hidden
    folder.

Does anyone have experience of making the switch to WSL and using Emacs with it?


texts:
From the Ivy manual:

  Customizability is about being able to use different methods and interfaces of completion to tailor the selection process. For example, adding a custom display function that points to a selected candidate with ->, instead of highlighting the selected candidate with the ivy-current-match>>

I've tried to customize the face to look like the one in IDO, with the "->", but to no avail. I can only seem to change the background and font of the face with (ivy-current-match), not manipulate the actual string.  Does anyone know?


texts: how to test which org mode publish backend is in course in a export filter?

texts:
Why is my org mode publish derived backend not reconized in the code snipped below?

 (if (org-export-derived-backend-p backend 'jekyllHtmlPost)

This is my complete init.el

;;; package --- Summary

;;; Commentary:

;;; Code:

(require 'cl-lib)
;; -*- coding: utf-8; lexical-binding: t; -*-

(require 'ox-org)
(require 'ox-publish)

(message "Arquivo init.el carregado com sucesso!")

;;https://pank.eu/blog/blog-setup.html
(defun configure_jekyll_front_matter (output backend info)
  "Configure Jekyll front matter after jekyllHtmlPost publish    backend.OUTPUT BACKEND INFO."

  (if (org-export-derived-backend-p backend 'jekyllHtmlPost)
      ;;this is never executed
      (message "jekyllHtml backend")
    (message "not jekyllHtml"))

;  (setq frontMatter (format "---\ntitle:%s\nauthor:%s\nlayout:%s    \nexcerpt:%s\ndate:\n---\n"
;                         (org-export-data (or (plist-get info :title)     "?Title?") info)
;                         (org-export-data (or (plist-get info :author)     "?author?") info)
;                         (org-export-data (or (plist-get info     :jekyll_layout) "?jekyll layout here?") info)
;                         (org-export-data (or (plist-get info     :jekyll_excerpt) "?post excerpt here? ") info)
;                       ))

;(concat frontMatter output)

)

(add-to-list 'org-export-filter-final-output-functions
             'configure_jekyll_front_matter)

;;https://github.com/theodorewiles/org-mind-map/issues/22
(org-export-define-derived-backend 'jekyllHtmlPost 'html
   :menu-entry
   '(?j "Jekyll HTML post"
        ((?J "As Body HTML buffer" org-html-export-as-html)
     (?j "As Body HTML file" org-html-export-to-html)
     (?o "As Body HTML file and open"
         (lambda (a s v b)
           (if a (org-html-export-to-html t s v b)
                 (org-open-file (org-html-export-to-html nil s v b)))))))
   :options-alist
   '((:with-toc nil nil nil)
     (:creator nil nil nil)
     (:html-doctype "HTML_DOCTYPE" nil fzl-jekyll-org-html-doctype))) ;;     Never include HTML's toc)

(defun fzl-jekyll-org-html-doctype (info)
"Return correct html doctype tag from org-html-doctype-alist,
or the literal value of :html-doctype from INFO if :html-doctype
is not found in the alist.
INFO is a plist used as a communication channel."
   (message "<><><><><><><><><><<>< (defun fzl-jekyll-org-html-doctype         (info)...")
)

;;; init.el ends here

My Elisp is hard :(

Is the answer on "How to do backend-dependent actions in org-mode export" not a suitable aproach in my case?


texts:
Note: This question is not well suited for standard emacs StackExchange format but I believe the discourse and exchange of techniques would be valuable for the community because the  wrapping cells inside an org-table is a popular question on the site.

Context
org-tables use pipe delimited syntax for columns
The simplest org-table  syntax example:
| 1 2 3 | one two three |

Note: The pipe character | is not allowed inside a table cell.

Because of the simple syntax, org-tables can be easily transcoded into either a list or an array which are common data types in available in most of the popular programming languages. This feature allows named org-tables to be passed into SRC blocks as variables.
e.g.
#+NAME: my-table
| 1 2 3 4 5 | one two three four five |

#+begin_src elisp :var data=my-table :results code
  data
#+end_src

#+RESULTS:
#+begin_src elisp
(("1 2 3 4 5" "one two three four five"))
#+end_src

#+begin_src ruby :var data=my-table :results code
  data
#+end_src

#+RESULTS:
#+begin_src ruby
[["1 2 3 4 5", "one two three four five"]]
#+end_src

This unique feature allows users to easily share & process data in org-table syntax in over 30 programming languages.
Unfortunately, as characters are added to each table cell, the table extends beyond the boundary of the screen and quickly the table becomes unreadable.

One option is to export the file into another format, e.g. HTML, PDF, etc... which supports table cell wrapping.

Other options are provided by answers to wrapping cells question.

How to Implement Column Wrap in org-mode Tables Programmatically?

I've thought of potential programmatic options including overlays using vertical broken bars ¦ or embedding with an innocuous wrapping token character inside the data that could be processed and filtered similar to an overlay by a SRC block.

Thank you for helping the community.


texts: Hiding empty lines at the end of plain list items

texts:
Can I prevent an empty line at the end of a plain list item from
showing when the item is folded?  For example, if I have

+ top

  wooden pole.  fireworks.

+ bottom

can I have it fold into

+ top...
+ botton

instead of

+ top...

+ bottom


texts: Display list of words along bottom of frame?

texts:
I'd like to display 3 lists of words on separate lines horizontally along the bottom (although top would work too) of every emacs frame I have open. I've thought of 6 ways to do this, and they all have issues:

My first thought was to add a line to my mode line, but AFAICT you can't use the newline character in a mode line, it just gets converted to "^J".
My second thought was to have the line across the top of the screen and use the header line, but it doesn't support the newline character either.
I could display an overlay over the last 3 lines of the window, but making this robust seems hard -- scrolling would need to be triggered when point reached the overlay rather than the real end of the window, and I'd have to constantly reposition the overlay since overlays are in text space not window space.
I could try to make dedicated windows at the bottom of the frame. I have tried coding this up but it's not very robust either, it doesn't seem to work right when a frame already contains split windows and I've had to rebind C-x,1 to a custom version of delete-other-windows that ignores my special windows and I'm sure there are other corner cases. Also when a help window pops open now it pops open vertically because it thinks there's already a horizontal split (which technically there is but it's only to display a one line window).
I could have a dedicated frame for this, but then my config won't work in terminal mode, and I'd have to script my window manager to handle keeping it along the bottom of the screen, making it unselectable, not affecting layout, etc. etc.
I could insert the text for the 3 lines directly into the minibuffer. I got this partially working, I can grow the minibuffer to accomodate the 3 lines, and I can display them. However, any time any message is echo'd the lines disappear until I issue another command at which point they re-appear. Ideally the 3 lines and the echo area would not overlap so I could see both. This would be less annoying if I could reliably filter which messages go to the echo area -- I found a solution on EmacsWiki but it doesn't appear to work for messages that originate in the emacs C source (specifically I'd like to get rid of the file saving messages because I autosave often on a timer).

For context, my goal is to constantly have a display of the most frequently used words in the current buffer, the words nearest point in the current buffer, and the words most recently used in the current buffer. I intend to be able to insert them into the buffer via voice commands. So I could say "nearest 2" and have it pick the second item from the list of words nearest point and insert it. I only care about the word lists being visible for whatever buffer I'm currently editing. I don't want to use the pop-up windows used by the various code completion modes because I need the lists always visible.


texts: Horizontal Scroll Wheel on Mouseover Buffer

texts:
My mouse has a horizontal scroll function, where I can tap the scroll wheel left and right to scroll horizontally. By default, it seems Emacs does nothing with that. The scroll wheel produces <mouse-6> and <mouse-7> key events, so I added this to my .emacs as a very basic way to get it to work.

(global-set-key (kbd "<mouse-6>") (lambda () (interactive) (scroll-right 6)))
(global-set-key (kbd "<mouse-7>") (lambda () (interactive) (scroll-left 6)))

This is fairly close to what I want. But the trouble is this. With vertical scrolling, Emacs always scrolls the buffer that the mouse is currently over. With my custom keys that I've just set here, horizontal scrolling happens in the active buffer, not the buffer that the mouse is over. I'd like to get the latter behavior, so that my scroll wheel consistently scrolls whichever buffer the mouse is over.


texts:
Macros like defun (or defmacro itself) have an optional docstring argument, but since they are macros and not functions, docstring isn't evaluated, but is taken as-is.
I need the docstring to be evaluated so that instead of something like this -
"does a, then b, then c" ; b is hardcoded

I can put something like this instead -
(concat "does a, then " (getenv "<some-shell-variable>") " , then c") ; b isn't hardcoded

Is it possible to do this without having to tweak the definitions of defun and defmacro?
By tweak, I don't mean overwriting the definitions, but writing new macros like prefix-defun and prefix-defmacro based on the existing definitions of defun and demacro, except, the docstring is evaluated by replacing all instances of docstring with (eval docstring).


texts: Smart minor mode toggle depending on major mode

texts:
I use several minor modes, which are enabled globally by default:

whitespace-mode
linum-mode
fci-mode

I'm finding them very helpful when editing code sources and text files, however I does not want to activate them with some major modes, e.g. dired-mode, eshell.

I've tried to solve this as following:

(add-hook 'prog-mode-hook '(linum-mode 1))

(require 'whitespace)
(add-hook 'prog-mode-hook '(whitespace-mode 1))

(require 'fill-column-indicator)
(add-hook 'prog-mode-hook '(fci-mode 1))
(add-hook 'text-mode-hook '(fci-mode 1))

But this solution does not works well:

reverting buffer toggles off linum-mode
whitespace-mode not activating
fci-mode not activating, producing error message

  File mode specification error: (invalid-function (fci-mode 1)) [2 times]

  What is the correct way to make smart toggle mentioned modes only with source code buffers and text buffers?

P.S. A note about fci-mode: error message looks odd to me, because I can either use M-x fci-mode to toggle it, or evaluate (fci-mode 1) or (fci-mode -1).


texts:
VS Code recently added the ability to switch themes when macOS's dark mode changes. Presumably they use the Electron API, which internally uses the Objective-C API of subscribing to the AppleInterfaceThemeChangedNotification event in NSDistributedNotificationCenter.

It would be nice if Emacs had this same ability. The pseudo-code would be:

(add-event 'os-dark-mode-changed
  (lambda (on)
    (set-theme (if on
                  some-dark-theme
                  some-light-theme))))

(In VS Code, the dark and light themes are configurable.)

Does Emacs have the ability to do something similar?


texts: How can I manually set links in org mode?

texts:
So I'm trying to make an "autolinks mode" to emulate the functionality of notetaking software like Tomboy Notes or notes.vim, which automatically linkifies any text that happens to be the title of a note. But I'm totally new to Emacs and to Elisp. This is what I have so far (it's like the first elisp I've ever written, be gentle):

;; Set directory of files to search for *.org files
(setq autolinks-mode-dir "~/Dropbox/Org/")

;; Get all .org files in this directory.
(setq autolinks-mode-files (directory-files autolinks-mode-dir t "[.]org\\'"))

;; Convert it to a list of just the filenames, without paths.
(setq autolinks-mode-files-bare
      (mapcar 'file-name-nondirectory autolinks-mode-files))

;; Strip extensions
(setq autolinks-mode-topics
      (mapcar 'file-name-sans-extension autolinks-mode-files-bare))

So far, so good. Now I I have a list of topics, and a list of corresponding files. For example, the topic "James" corresponds to an org file at "/path/to/notes/James.org". Now I want to manually update org's list of links for a particular buffer with this list of topics, so that, when I turn on this mode, it highlights any instance of the word "James" in an org buffer and makes it a link to /path/to/notes/James.org. Same with a multi-word org file, like "Henry James", which would point to /path/to/notes/Henry James.org. Note that I'm not trying to replace all instances of James with [[James]] or <James> or something, just trying to get those text snippets to behave as links.

I've been browsing through org.el, and I saw this variable:

(defvar org-link-re-with-space nil
  "Matches a link with spaces, optional angular brackets around it.")

Which in my system has all kinds of stuff in it, probably due to org-ref and other things:

org-link-re-with-space is a variable defined in ‘org.el’.
Its value is
"<?\\(A\\(?:cp?\\|utocite[*s]?\\)\\|Cite\\(?:a\\(?:l[pt]\\|uthor\\*?\\)\\|[pst]\\)?\\|Gls\\(?:pl\\)?\\|Notecite\\|P\\(?:arencites?\\|notecite\\)\\|Smartcites?\\|Textcites?\\|a\\(?:c\\(?:p\\|r\\(?:full\\|long\\|short\\)\\)?\\|ddbibresource\\|uto\\(?:cite[*s]?\\|ref\\)\\)\\|b\\(?:bdb\\|ib\\(?:entry\\|liography\\(?:style\\)?\\|tex\\)\\)\\|cite\\(?:a\\(?:l\\(?:[pt]\\*\\|[pt]\\)\\|uthor\\*?\\)\\|date\\*?\\|num\\|p\\*\\|t\\(?:\\*\\|ext\\|itle\\*?\\)\\|url\\|year\\*?\\|[*pst]\\)?\\|do\\(?:cview\\|i\\)\\|e\\(?:l\\(?:feed\\|isp\\)\\|qref\\)\\|f\\(?:ile\\(?:\\+\\(?:\\(?:emac\\|sy\\)s\\)\\)?\\|notecite\\|oot\\(?:cite\\(?:s\\|texts?\\)?\\|fullcite\\)\\|tp\\|ullcite\\)\\|g\\(?:ls\\(?:desc\\|link\\|\\(?:p\\|symbo\\)l\\)?\\|nus\\)\\|h\\(?:elp\\|ttps?\\)\\|i\\(?:n\\(?:dex\\|fo\\)\\|pynb\\|rc\\)\\|l\\(?:abel\\|ist-of-\\(?:\\(?:figur\\|tabl\\)es\\)\\)\\|m\\(?:ailto\\|\\(?:essag\\|h\\|u4\\)e\\)\\|n\\(?:ameref\\|ews\\|o\\(?:bibliography\\|\\(?:te\\)?cite\\)\\)\\|orgit\\(?:-\\(?:log\\|rev\\)\\)?\\|p\\(?:a\\(?:geref\\|rencite[*s]?\\)\\|notecite\\|rint\\(?:bibliography\\|index\\)\\)\\|r\\(?:ef\\|mail\\)\\|s\\(?:hell\\|martcites?\\|upercites?\\)\\|textcites?\\|w3m\\):\\([^]

So it seems Org has the functionality to be able to highlight plain text as a link. I just don't know the best way to do it. I think I can append my list of link words to org-link-re-with-space, maybe? But then how do I set their targets? Any help would be much appreciated.


texts: Using UTF8 encoding as default when writing emails

texts:
When I want to send an email I composed in Emacs, I press C-c C-c and am always presented with such an error message:

These default coding systems were tried to encode text
in the buffer `2015-02-03_19:08:30_1':
  (utf-8-unix (302 . 4194243) (303 . 4194208) (305 . 4194243) (306 .
  4194217) (308 . 4194243) (309 . 4194221) (311 . 4194243) (312 .
  4194227))
However, each of them encountered characters it couldn't encode:
  utf-8-unix cannot encode these:

Click on a character (or switch to this window by `M-o'
and select the characters by RET) to jump to the place it appears,
where `C-u M-x what-cursor-position' will give information about it.
[...]

At this point I can manually select an encoding and my email is sent. What I don't understand is that I always select utf-8 as the encoding when I receive this message and it just works! But the message said that utf-8-unix can't encode some characters.

Can somebody tell me why Emacs can't select utf-8 by default and what this error message mean in this context?

EDIT 2015/02/05

I'm using mu4e and I tried (setq-default buffer-file-coding-system 'utf-8) without success (after evaluating this expression, if I start writing a new email, the variable's value is not 'utf-8 but 'utf-8-unix).

EDIT 2015/02/06

I also tried M-x set-keyboard-coding-system utf-8 and (setq mm-coding-system-priorities '(utf-8)) but this had no visible effect.

EDIT 2015/02/21

I've just noticed this problem only happens if smtpmail-queue-mail is t. So I guess the problem is in the email queueing feature.


texts: Is there a way to autoindent single quoted lines automatically for python code?

texts:
The python.el mode has several ways to fill docstrings, but I would like to fill single quoted lines. Is there a function that would change this:

variable = {
    'key':
    ' this is a very long long long long long long long long long long long long long long long string'}

into this:

variable = {
    'key':
    ' this is a very long long long long long long long long long long '
    'long long long long long string'}

I do not want to use triple quoted strings, because they add newlines I don't want.


texts: Adding Spacemacs documented layers fails

texts:
Adding layers existing in the layer section of the .spacemacs documentation results in failed test in the dot-test-results buffer generated after reloading the .spacemacs file (with SPC-f-e-R).
increminated layers were :
neotree ;; for filetree
notmuch ;; for emails
parinfer ;; clojure / lisp paren inference
pdf  ;; pdf visualisation
prettier
The * spacemacs* welcome screens gets some warnings but couldn't find any other error messages to help debug :
   Warnings:
           - Unknown layer neotree declared in dotfile.
           - Unknown layer notmuch declared in dotfile.
           - Unknown layer parinfer declared in dotfile.
           - Unknown layer pdf declared in dotfile.
           - Unknown layer prettier declared in dotfile.
           - package twittering-mode not initialized in layer keyboard-layout, you
             may consider removing this package from the package list or use the :toggle
             keyword instead of a `when' form.
           - package linum not initialized in layer nlinum, you may consider removing
             this package from the package list or use the :toggle keyword instead of a `when' form.
           - package linum-relative not initialized in layer nlinum, you may consider
             removing this package from the package list or use the :toggle keyword
             instead of a `when' form.
           - More than one init function found for package helm-make. Previous owner was ivy,
             replacing it with layer helm.
           - More than one init function found for package smex. Previous owner was ivy,
             replacing it with layer smex.
           - package evil-nerd-commenter not initialized in layer evil-commentary, you may
             consider removing this package from the package list or use the :toggle keyword
             instead of a `when' form.
           - package vi-tilde-fringe not initialized in layer vim-empty-lines, you may
             consider removing this package from the package list or use the :toggle keyword
             instead of a `when' form.
           - tern binary not found!

my config :
OS: mac osX Catalina 10.15.5
emacs : GNU Emacs 26.3 (build 1, x86_64-apple-darwin18.5.0, Carbon Version 158 AppKit 1671.4)
fetch with brew install emacs-plus@26 IIRW
spacemacs à jour (latest)
271 packages loaded in 18.794s (e:202 r:2 l:18 b:49)
(this seems slow, may be because of spaceline-all-the-icons)
My .spacemacs is still a work in progress and thus not in a github repo yet so I attached a gist link  below.
Thanks for any hits on how to get thos layers working.
Best
Samusz
.spacemacs file: https://gist.github.com/samusz/2cfb1ced064276be06eee4488cc86788


texts: Why does M-x underline-region doesn't work?

texts:
I don't know if I'm using the command correctly or not.
I select the region to be underlined and then pass the command M-x underline-region and it doesn't work.
For example

if the text is SAMPLE which I select and pass the command within Emacs, the output looks like this

 _^HS_^HA_^HM_^HP_^HL_^HE

How should I be using this command? I found this command by co-incidence.
When I searched on this topic, I found ul.el. I'm not good at elisp yet, so couldn't make any sense of the code.
The comment in the code says:

"Underline all nonblank characters in the region.
Works by overstriking underscores.
Called from program, takes two arguments START and END
which specify the range to operate on."

Which means that the output should look this SAMPLE (with an underline below it - I'm unable to get it in Markdown)


texts: Enable ivy fuzzy matching everywhere, except in swiper

texts:
I have been using flx-ido-mode for a while and I like it. Ivy can behave the same way by using ivy--regex-fuzzy.

The problem is that swiper will also use fuzzy matching now and in this case I don't really like it (at least not as a default, all the time).

So I'd like to continue using fuzzy matching with Ivy except in swiper. Is there a way to configure this? Or can I somehow tell swiper that I'm really looking for "this" substring right now by prefixing something?


texts: Quick optional alternative to "M-x compile"

texts:
I'm using "M-x compile" several times a day with the following in my ~/.emacs:

(setq compile-command "cd ~/my-dev/linux_build/ && killall gdb ; ~/my-dev/someStuff/.git/hooks/pre-commit; mv -f ../bin/my-exe /tmp 2>&1; echo ---; make -j$(nproc) APP=my-exe MODE=debug SOMEOPTION=value && date")

The main problem is that sometimes I don't want "SOMEOPTION=value" - other times I want it (I know I can just use the cursor keys to change the command before hitting enter, but I'm looking for an even faster/quicker way). So, the question is:

Is there a way to modify "M-x compile" such that it by default runs without SOMEOPTION=value and using just a single key after "M-x compile", it runs with SOMEOPTION=value? Maybe it would be nice also to be able to switch between 2 makefiles, again - using just a single keypress, e.g. the following 3 tasks should be easy and fast/quick to switch between:

"M-x compile + enter" (default): Runs the usual command without
SOMEOPTION=value, i.e. cd ~/my-dev/linux_build/ && killall gdb ; ~/my-dev/someStuff/.git/hooks/pre-commit; mv -f ../bin/my-exe /tmp 2>&1; echo ---; make -j$(nproc) APP=my-exe MODE=debug && date
"M-x compile + S": Runs the usual command WITH
SOMEOPTION=value, i.e: cd ~/my-dev/linux_build/ && killall gdb ; ~/my-dev/someStuff/.git/hooks/pre-commit; mv -f ../bin/my-exe /tmp 2>&1; echo ---; make -j$(nproc) APP=my-exe MODE=debug SOMEOPTION=value && date
"M-x compile + M": Runs everything but using a
different makefile, i.e: cd ~/my-dev/linux_build/ && killall gdb ; ~/my-dev/someStuff/.git/hooks/pre-commit; mv -f ../bin/my-exe /tmp 2>&1; echo ---; make -j$(nproc) -f makefileAlternative APP=my-exe MODE=debug SOMEOPTION=value && date
(maybe something else here in the future, with a relevant keystroke after "M-x compile")

As I'm not very good at emacs programming I'm asking to learn, so I also highly appreciate a few words for background information, e.g. why a solution is good or why this cannot be achieved (if it cannot, but I'm guessing there's a way to do this). I hope some of you can help, I would appreciate it a lot as I do this many times per day...

EDIT: Based on the answer by lawlist, I've updated the first 3 example cases with i.e: "commandline-to-be-executed" in code-tag, I think this should make the question clearer (and the objective is to be able to run each case, with as few keystrokes as possible)...


texts: What is the difference between Aquamacs and other Mac versions of Emacs?

texts:
Macintosh users have several choices of pre-built Emacs.  I am aware of the following versions:

YAMAMOTO Mitsuharu's Emacs Mac Port
David Caldwell's Emacs for Mac OS X
Vincent Goulet's Emacs Modified for macOS
David Reitter's Aquamacs

Some questions I had in mind:

Do these versions differ in any signifcant ways?
Can one obtain the functionality of the others by simply modifying the initialization file?
Do these changes make their way back upstream?

I am aware that Aquamacs is considered "unorthodox" as it has very Mac-like keybindings, but I am also interested in understanding the differences between the non-Aquamacs versions.


texts: Swift major mode indentation is not moving to expected position

texts:
When I type a } to close the for loop, the '}' is moved to position as shown in the screen shot (where the cursor is)

I expect it to be at the same column of the for keyword.

Indentation for lines within the if condition worked perfectly.

Is there anyway I can fix this behaviour?


texts: org-cycle in Doom Emacs: 2 instead of 3 states

texts: I recently installed Doom and noticed that in org-mode the Tab key (used for local/subtree visibility cycling) only cycles between 2 states ('folded' and 'children') as opposed to 3 states I'm used to from vanilla Emacs ('folded', 'children' and 'subtree'). I can't seem to find the reason for that. Tab is bound to org-cycle, the documentation of which clearly mentions 3 states. Invoking the function "manually" through M-x never unfolds the entire subtree either. What am I missing here?


texts: Is it possible to break out of a dolist loop? if not, are there alternatives to dolist that don't involve a while loop and indexing a list?


texts:
I have not done much with abbrev-mode or yasnippet, but I recently started using AucTex mode with great success, and I think some common TeX markup I'm inputting could benefit from expansion.

Example:

Type dots and get \dots{}
Type txt and get \textit{} (with cursor between the brackets)

I'm a beginner user, and abbrev-mode looks easier. However, I am not sure if it has the funcionality I'm looking for. If it must be Yasnippet, could someone advise on a good tutorial aimed at beginners?

Thank you,
steven arntson


texts:
Upon leaving multiple blank lines (saying 4 lines of blanks), I have to strike four times of Enter.

Tried C-u Enter or C-3 Enter, it does not work.

How could specify the number lines like C-3 space?


texts:
I am trying Spacemacs with emacs keybindings, so the commands starting with SPC, like SPC f e d, can be invoked by replacing SPC with M-m.

Since M-m is bound to back-to-indentation in stock emacs, I would like to remap the prefix M-m to M-n, so that I can then safely bind M-m to back-to-indentation.

How can I achieve this?


texts: I just wanted to know if Magit has this functionality. The reference manual does not have this explicitly so that's why I am asking.


texts:
The Emacs *shell* has a nice command history accessible via C-c C-l (comint-dynamic-list-input-ring).  However, in classic Emacs fashion, the *Input History* buffer which displays the history is not selected automatically.  I want to change this.

Trouble is, I can't get a reference for the *Input History* buffer.

My thought is to write a wrapper around the comint-dynamic-list-input-ring function which calls the command and then switches to the *Input History* buffer.

(defun my-see-shell-history ()
  "Open comint command history and switch to *Input History* buffer.

A wrapper around COMINT-DYNAMIC-LIST-INPUT-RING."
     (interactive)
     (comint-dynamic-list-input-ring)
     (switch-to-buffer-other-window "*Input History*"))

This doesn't work.  Nothing happens; no error, no change in buffer focus.  Nada.

If I try the following, a new buffer called *Input History* is created:

M-: (comint-dynamic-list-input-ring)
M-: (switch-to-buffer-other-window "*Input History*")

What's confusing is that the *Input History* created by comint-dynamic-list-input-ring seems to be a buffer that doesn't exist.  I can have the *Input History* buffer open on my screen (after calling C-c C-l) yet it doesn't show up in M-x list-buffers.  However, I can manually select the buffer and run M-: (current-buffer) and see that it is #<buffer  *Input History*>.

What's going on here?  How can I reference the *Input History* buffer?


texts: JSON file folding and step-by-step unfolding

texts:
I need to look at larger, quite deeply nested JSON files in Emacs. Similar to the terminal tool json-view I would like to start with the JSON file completely folded and then open each level step-by-step.

I've tried Emacs' built-in Hideshow minor mode, but after I have totally folded an JSON tree (via hs-hide-all) I issue hs-show-block and Emacs shows the next level and all sub-levels, i.e. the whole JSON document, instead I would liketo see incrementally just the next level with all deeper sub-levels still folded.

It looks to me that hideshow is good at incrementally hiding levels, but is there a way in Emacs to view JSON files that the levels are step-by-step revealed?


texts: How can I prevent orgmode re-sorting all my headings when I enter a `.org` file? Org startup variables are ignored

texts:
While trying to solve this problem, Iv'e followed this, running cd ~/.emacs.d/elpa &&  find org*/*.elc -print0 | xargs -0 rm and recompiling elpa. But the undesired behaviour is still there and now this error shows up:
File mode specification error: (wrong-number-of-arguments #[(arg &optional invisible-ok) \306=\203\0    \306=\204\0\307 \210\310
!\210 \211\311X\203 \0\312\313!\210\311V\203]\0
\314V\203]\0o\204]\0\211W\204S\0o\204S\0
\203G\0\315 \210\202K\0\316\311!\210 \211\2024\0)
S\202 \0)\317!\207 [this-command last-command invisible-ok outline-level start-level arg outline-up-heading push-mark outline-back-to-heading 1 error Already at top level of the outline 0 outline-previous-heading outline-previous-visible-heading looking-at level outline-regexp] 3 (/usr/share/emacs/26.3/lisp/outline.elc . 34670) p] 0)

How can I make org-mode open files in a folded state and not try to sort my headings when I open new files?
Using spacemacs 0.200.13 @ emacs 26.3.
the relevant variables/settings are:
  ;; Org mode settings
  (defun org-sort-headings-todo-prio ()
    "sort org headings first by priority then by todo order"
    (interactive)
    (org-sort-entries t ?p )
    (outline-up-heading)
    (org-sort-entries t ?o ))

  (setq org-image-actual-width 400
        org-startup-with-inline-images t
        org-directory "~/path/to/folder/"
        org-default-notes-file (concat org-directory "organizer.org")
        org-startup-folded t)

  (add-hook 'org-mode-hook
            (lambda ()
              (yas-minor-mode)
              (make-variable-buffer-local 'yas/trigger-key)
              (setq yas/trigger-key [tab])
              (add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
              (define-key yas/keymap [tab] 'yas/next-field)
              (flycheck-mode 1)
              (flyspell-mode-on)
              (org-autolist-mode)
              (org-bullets-mode)
              (local-set-key (kbd "C-c C-x s") (org-sort-headings-todo-prio))))

  (global-set-key (kbd "C-c o") (lambda () (interactive) (find-file org-default-notes-file)))
  (global-set-key [c-x c-c c-r] 'org-preview-latex-default-process)
  (global-set-key (kbd "C-c c") 'org-capture)

the whole config file can be seen here (just without the variable definitions at the end)


texts:
I receive GnuPG-encrypted (and signed) e-mails through an MS Exchange server. Unfortunately, the exchange server messes up the GPG format, such that mu4e cannot decrypt correctly.

This is a known issue with MS Exchange servers. For instance, Thunderbird-Enigmail pops up a message, "do you want to repair this message", and offers to repair the message. This changes some MIME headers and contents, and then the e-mail can be decrypted correctly.

I wrote a small Python script, which makes similar changes to files containing e-mails in a Maildir directory, which is synced with an IMAP server via offlineimap.

Now, whenever I open an encrypted e-mail in mu4e that cannot be encrypted, I want to run the Python script on the corresponding file, and then re-load it. How can I do this in Emacs Lisp?

Or, is there any other, simple solution to mimic the behaviour of Thunderbird's Enigmail plugin to repair e-mails messed up by Exchange servers?


texts: Is there a key binding to open the configuration file of Emacs?

texts:
I'm going to set key binding to open and edit my init.el. Hotkey will call this function.

(defun my-edit-configuration ()
  "Open the init file."
  (interactive)
  (find-file user-init-file))

I wouldn't want to rewrite another standard key binding. What kind of a key binding usually utilized in Emacs for this purpose?


texts:
In my doom-emacs, "C- n n" will invoke org-capture,
I want to change it to "C-c c c"  as

(global-set-key "\C-c c c" 'org-capture)

However, it does not work as expected.

How could set C-c c c to substitute C-c n n

I find such key Binding:

Key Bindings
doom-leader-map n n
doom-leader-notes-map n
general-override-mode-map C-c n n
global-map C-c c
mode-specific-map c

it seems that general-override-mode-map C-c n n will override anything I set.


texts: Include special (LaTeX) symbols in verbatim/code?

texts:
I wonder if it is possible to include special symbols within verbatim delimiters, e.g.

=\alpha 6=, although displayed correctly in a prettified buffer, actually exports the literal words \alpha 6 when a LaTeX file is generated from the org file.


texts: How to disable auto-save in emacs only for files opened as root

texts:
I want to use emacs auto-save feature with tramp, but only for file that I don't open using sudo. My current configuration, based on the tramp documentation, looks like this:

;;;;;;;; BAKUCP ;;;;;;;;
;; Backup remote files locally to stop autosave pain
(setq tramp-backup-directory "~/.emacs-backup")
(unless (file-directory-p tramp-backup-directory)
  (make-directory tramp-backup-directory))
(if (file-accessible-directory-p tramp-backup-directory)
    (setq tramp-auto-save-directory tramp-backup-directory)
  (error "Cannot write to ~/.emacs-backup"))
;; Don't backup su and sudo files
(setq backup-enable-predicate
      (lambda (name)
        (and (normal-backup-enable-predicate name)
             (not
              (let ((method (file-remote-p name 'method)))
                (when (stringp method)
                  (member method '("su" "sudo"))))))))

It is forbidding creating remote backups of files edited as superuser but auto-saved files are still created on my local machine. Is there any way to disable that without disabling auto-save at all?


texts: Why is Selenium / Chromedriver giving me errors in Emacs' Python shell?

texts:
If I launch a Python shell inside Emacs with run-python and try to open a Chromium window with Selenium, I am suddenly running in to the following error:
Python 3.8.5 (default, Jan 27 2021, 15:41:15)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> python.el: native completion setup loaded
>>> from selenium import webdriver
>>> browser = webdriver.Chrome()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/brian/.local/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
    self.service.start()
  File "/home/brian/.local/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 98, in start
    self.assert_process_still_running()
  File "/home/brian/.local/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 109, in assert_process_still_running
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 1

>>>

If I do the same thing but outside of Emacs, I do not have this problem. In either case, the output of print(webdriver.__file__) is the same,
/home/brian/.local/lib/python3.8/site-packages/selenium/webdriver/__init__.py Version heading is also the same outside of Emacs.
So what might be different about the Python environment in emacs that I suddenly can't do this anymore? (It was working fine before my last system update.)


texts: How can I tangle a specific org mode header from commandline?

texts:
$ cat foo.org
* A
#+begin_src text :tangle a.txt
123
#+end_src
* B
#+begin_src text :tangle b.txt
456
#+end_src

Now I change 123 to 1234 and save foo.org
$ cat foo.org
* A
#+begin_src text :tangle a.txt
1234
#+end_src
* B
#+begin_src text :tangle b.txt
456
#+end_src

Via inotify I can tangle the whole file e.g. emacs --batch --eval "(require 'org)" --eval '(org-babel-tangle-file "foo.org")'
But how can I tangle only header A (a.txt)?


texts:
The following code allows me to catch an escape key press.  After evaluating the code, pressing ESC will print "Escape pressed", as desired.

Unfortunately, due to the equivalence between ESC and Meta, Meta keys do not function when this keymap is active.  Instead, I see messages like

M-f is undefined

I would like to be able to evaluate the following block of code, press M-f, and have it invoke forward-word as usual.  Is there any way to achieve this?

(set-transient-map
 `(keymap
   (27 . ,(lambda () (interactive) (message "Escape pressed"))))
 nil (lambda () (message "Other key pressed")))


texts: Cannot open URL link in emacs under msys

texts:
When trying to open URL link in emacs under MSYS2 I get the error browse-url-default-windows-browser: Searching for program: No such file or directory, cygstart.
Looking into the function browse-url-default-windows-browser I found out that it needed to call process cygstart:

    (defun browse-url-default-windows-browser (url &optional _new-window)
      "Invoke the MS-Windows system's default Web browser.
    The optional NEW-WINDOW argument is not used."
    <...>
    ((eq system-type 'cygwin)
             (call-process "cygstart" nil nil nil url))

But there is no cygstart in MSYS2 according to its wiki How does MSYS2 differ from Cygwin. Though the variable system-type really equals 'cygwin and cannot be changed to anything more appropriate.

How to fix this error?


texts: Preview LaTeX doesn't work when I delete the _region_.prv folder

texts:
Suppose I create a latex document in ~/junk/text.tex with the following conent:

\documentclass{article}
\begin{document}
$x$
\end{document}
%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

I then run C-c C-p C-b and preview-latex works as expected.
The folder _region_.prv and the files _region_.log, prv_test.fmt, prv_test.log and _region_.tex get created (and the folder auto as well).
When I delete the folder and those files, preview-latex won't work anymore.
I get the error

Running `Preview-LaTeX' on `~/junk/_region_' with ``lualatex  -interaction=nonstopmode -file-line-error \&prv_test "/AUCTEXINPUT{" _region_.tex "}"''
This is LuaTeX, Version 1.07.0 (TeX Live 2018/Arch Linux)
 restricted system commands enabled.

kpathsea: Running mktexfmt prv_test.fmt
mktexfmt: mktexfmt is using the following fmtutil.cnf files (in precedence order):
mktexfmt:   /etc/texmf/web2c/fmtutil.cnf
mktexfmt: mktexfmt is using the following fmtutil.cnf file for writing changes:
mktexfmt:   /home/berber/.texlive/texmf-config/web2c/fmtutil.cnf
mktexfmt [INFO]: writing formats under /home/berber/.texlive/texmf-var/web2c
mktexfmt [INFO]: did not find entry for byfmt=prv_test, skipped
mktexfmt [INFO]: Disabled formats: 6
mktexfmt [INFO]: Not selected formats: 36
mktexfmt [INFO]: Total formats: 42
mktexfmt [INFO]: exiting with status 0
Sorry, I can't find the format `prv_test.fmt'; will try `prv_test.fmt'.

kpathsea: Running mktexfmt prv_test.fmt
mktexfmt: mktexfmt is using the following fmtutil.cnf files (in precedence order):
mktexfmt:   /etc/texmf/web2c/fmtutil.cnf
mktexfmt: mktexfmt is using the following fmtutil.cnf file for writing changes:
mktexfmt:   /home/berber/.texlive/texmf-config/web2c/fmtutil.cnf
mktexfmt [INFO]: writing formats under /home/berber/.texlive/texmf-var/web2c
mktexfmt [INFO]: did not find entry for byfmt=prv_test, skipped
mktexfmt [INFO]: Disabled formats: 6
mktexfmt [INFO]: Not selected formats: 36
mktexfmt [INFO]: Total formats: 42
mktexfmt [INFO]: exiting with status 0
I can't find the format file `prv_test.fmt'!

TeX Output exited as expected with code 1 at Mon Jun  3 16:17:28
LaTeX: LaTeX found no preview images

How can I make preview-latex work again?


texts: How to make emacs prompt yes or no to save the session when desktop-save-mode is on?

texts:
I started to use emacs a few days ago and still getting the hang of it.

desktop-save-mode is really handy at times as I don't have to reopen all the files that I had already opened in my previous session. But, I wouldn't want emacs to remember the open buffers every time I quit a session. So, is there a way to make emacs prompt to ask yes or no to invoke desktop-save-mode before quitting ?

Cheers


texts:
I've been looking for themes which are transparent, but I didn't find any.
Is there someone who uses a transparent theme?


texts: How to block output of a command run with via `run-with-idle-timer`?

texts:
I use

(run-with-idle-timer 45 t 'org-save-all-org-buffers)

to automatically save all org-mode buffers when I am idling for 45 seconds. What I don't like about this is that it prints "All org-mode buffers have been saved" to the minibuffer. How can I prevent this output from being shown?


texts: How to apply a hunk of changes in diff to current branch?

texts:
I have two branches, let's say branch a and b, I would like to apply some changes from b to a.
Note that I use magit-diff to show the differences between the two branches. Then I would like to apply some changes pointed out by magit-diff from b to a.
So, could please tell me how should I do this. Or is there better ways.


texts: showing lunar and solar ephemerides in Emacs agenda

texts:
Is there a way to show the calendar functions for phases of the moon? I know it's an inbuilt function of Emacs, but I have never seen it pop up in my agenda.

Thank you,

EG


texts: Dynamically change cursor color to indicate input script

texts:
I'd like to use the cursor color to provide visual feedback on the alphabet I am currently in (I sometimes have to switch rapidly between, say, Latin and Cyrillic, and find myself typing in the wrong script).

Something like this:

http://emacs-fu.blogspot.com/2009/12/changing-cursor-color-and-shape.html

But I can't find a good way to detect the keyboard layout (Unicode code page, ...) to tell which language I am in, in order to use that to change the parameters of the cursor.

I am on MacOS, but it would be preferable to have a general solution.


texts: Is this a bug? emacs freezes when doing "sudo service apache2 status" inside a org babel tramp remote code block

texts:
I think I've found a bug with emacs+org+babel.
This block runs fine

#+BEGIN_SRC sh :dir /ssh:ubuntu@54.175.231.31:~/ :exports both :results output
sudo service --status-all
#+END_SRC

This block freezes emacs

#+BEGIN_SRC sh :dir /ssh:ubuntu@54.175.231.31:~/ :exports both :results output
sudo service apache2 status
#+END_SRC

This is the expected output

ubuntu@ip-172-31-4-188:~$ sudo service apache2 status
● apache2.service
   Loaded: not-found (Reason: No such file or directory)
   Active: inactive (dead)
ubuntu@ip-172-31-4-188:~$


texts: How to make Emacs start using the Xetex engine as default

texts: I am using Emacs to edit all the stuff I'm writing. As I make extensive use of fontspec, I would like to configure my Emacs (running within OpenSuse Linux)so as to start using the xetex-engine without going again and again through the pull-down menu command -> TeXing options -> use xetex-engine.


texts: Selecting a directory like counsel-find-file

texts:
I would like to write a function that would prompt the user to select a directory, using an UI like that presented by counsel-find-file.
The starting directory should be an arbitrary directory passed to this function as an argument.
This function should only show the user directories, not files, and the user should be able to navigate up and down the filesystem just as in counsel-find-file.
When the user makes their selection by hitting the RETURN key, the path to the selected directory should be returned to the calling function.


texts:
Background:

I want to use emacs like tmux which can run as persistent session as well as shorten the time for me to start bringing up emacs when I want to (as inspired by these: Emacs and a Tmux replacement and Detaching and re-attaching to emacs server )

In my .profile, I tried to start emacs in daemon mode in the background, and it didn't start, and there was this message:

 http://bugzilla.gnome.org/show_bug.cgi?id=85715
 Emacs might crash when run in daemon mode and the X11 connection is unexpecedly lost.
 Using an Emacs configured with --with-x-toolkit=lucid does not have this problem.

Then I start emacs with -Q --debug-init --daemon --with-x-toolkit=lucid.

But the process hangs there as well as my logging in.

When I check with tty1, I see always 2 pairs of processes:

 14183 ?        Sl     0:00 /usr/bin/gnome-keyring-daemon --daemonize --login
 14187 ?        Sl     0:00 /usr/bin/gnome-keyring-daemon --daemonize --login
 14132 ?        S    0:00 /usr/bin/emacs -Q --debug-init --daemon --with-x-toolkit=lucid
 14138 ?        Ssl    0:00 /usr/bin/emacs -Q --debug-init --daemon --with-x-toolkit=lucid

And if I kill one of the emacs process (usually with the single S), then the other keyring-daemon process will disappear and I will be automatically brought back to the logon screen and the logon will be successful too. One examination with ps x in the Xsession, there is only 1 emacs process and only 1 keyring process.

Questions:

What is happening so that the emacs startup hangs?
What can I do in my settings to make the emacs daemon startup nicely?

[I am using Emacs 25.1.1 on all most updated Devuan ASCII 2.1 distro (I know, my distro "Devuan" is so slow to update packages)]

Edit 1:
After I have fully started X and in XWindows environment, and if I do a $> killall emacs first and make sure no emacs process is running, and then try starting the daemon with the same line. Here is the result:

 My_User_Name@devux:~$ emacs --daemon
 Warning: due to a long standing Gtk+ bug
 bugzilla.gnome.org/show_bug.cgi?id=85715
 Emacs might crash when run in daemon mode and the X11 connection is unexpectedly lost.
 Using an Emacs configured with --with-x-toolkit=lucid does not have this problem.

(and then starting my site-list and then .emacs etc.)

 Starting Emacs daemon.

 My_User_Name@devux:~$ ps x | grep emacs
 17553 ? Ssl 0:06 emacs --debug-init --daemon
 18843 pts/0 S+ 0:00 grep --color=auto emacs

Edit 2: On further trial-and-error, I move the emacs --daemon from .profile to .xsessionrc, and then to the startup tab of xfce4-session-settings. And there is no hiccup for starting the daemon or for the login. I will investigate further for the actual reasons. [By the way, having the emacs daemon started does some convenience for me: my emacs startup time is beyond 12-15 seconds, and now with emacsclient -c -q, I can bring up a frame in less than a second and emacs serves also some functions like tmux in the background.]


texts: magit to honour file-local tab-width variable

texts:
Some of Python files I work on have the following file-local variables:

# Local Variables:
# mode: python
# python-indent-offset: 4
# tab-width: 4
# indent-tabs-mode: t
# coding: utf-8
# End:

When viewing diffs in magit it displays tabs using tab-width 8, rather than the file local variable.

Is there a way to make magit honour file-local tab-width variable?


texts: What's the difference between ‘global-set-key "\M-…’ and ‘define-key esc-map "…’?

texts:
Same for global-set-key "\C-x … and define-key ctl-x-map "….

I prefer (global-set-key (kbd "M-KEYS") #'COMMAND) because it's more readable, but I would like to know if the two kinds of binding -- expliciting the Meta key and using the ctl-x-map -- differ in some ways.


texts:
My presentation has like 30 slides, nothing fancy, mostly a couple of bullet points on each frame and in total like 10 small images. Still the export to beamer, i.e. a pdf takes like 10 seconds and Emacs freezes for the time.
Can anyone tell me why that is or how to fix it?


texts: Can I make "comment-region" comment empty lines?

texts:
In LaTeX code I can have:

Lorem ipsum dolor sit amet, consectetur
\begin{comment}
adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

Ut enim ad minim veniam, quis nostrud exercitation
\end{comment}
ullamco laboris nisi ut aliquip ex ea commodo consequat.

If I use comment-region (in a script) to comment the comment environment in la LaTeX code i obtain:

Lorem ipsum dolor sit amet, consectetur
%% \begin{comment}
%% adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

%% Ut enim ad minim veniam, quis nostrud exercitation
%% \end{comment}
ullamco laboris nisi ut aliquip ex ea commodo consequat.

This is not good because LaTeX interpret the empty line(s) (outside of comment environment) as a paragraph break.

My question is: Can I make comment-region comment empty lines?

I tried customizing (let-bind) the  comment-syle  variable but all the options I've seen do not comment empty lines.

An alternative could be a "built-in" (otherwise I already know how to make this funcion by myself) function that let me append a string on every line of a region (not a triangle). Remember, I need to do it programmatically.


texts: abbrev-mode - Expansion with trailing / does not work

texts:
I want to have w/ expand to with globally.

Defining the abbrev in the usual way works (e.g. typingwith C-x ag w/), and the entry in the abbrev_defs file looks fine - output of M-x list-abbrevs under (global-abbrev-table):

"with"         0    "w/"

However, typing "w/" in abbrev-mode or even manually trying to expand this using C-x ' does not work. Why is that and how can I change it?


texts: My laptop has a 4K screen therefore a very high DPI, much higher than my external monitors. So when I switch from using external monitors to the builtin laptop screen I would like to quickly scale the text and, if possible, all the GUI widgets in Emacs to suite the new DPI. I'm aware of set-frame-font but I haven't found a corresponding function that adjusts the scaling aswell. And text-scale-adjust only works on a buffer locally.


texts: Case-sensitive search and replace in elisp in spacemacs

texts:
Running Spacemacs v.0.200.13 on emacs 25.2.2 on Kubuntu 18.04.

Consider the following code:

  (defun xx-ll ()
    (interactive)
    (save-excursion
      (goto-char (point-min))
      (xx-replace-regexp-and-return
        "^[[:blank:]]\*LLA[[:space:]]\*\\(<[ou]l class=\"nicelist\"\\)"
        "\\1 type=\"A\"")
      (xx-replace-regexp-and-return
        "^[[:blank:]]\*LLI[[:space:]]\*\\(<[ou]l class=\"nicelist\"\\)"
        "\\1 type=\"I\"")
      (xx-replace-regexp-and-return
        "^[[:blank:]]\*LLa[[:space:]]\*\\(<[ou]l class=\"nicelist\"\\)"
        "\\1 type=\"a\"")
      (xx-replace-regexp-and-return
        "^[[:blank:]]\*LLi[[:space:]]\*\\(<[ou]l class=\"nicelist\"\\)"
        "\\1 type=\"i\"")))

  (defun xx-replace-regexp-and-return (from to)
    (save-excursion
      (while (re-search-forward from nil t)
        (replace-match to 1))))

The 1 in replace-to is to preserve case of replacement string. All goes well except that LLa and LLi leads to replacement by type="A" and type="I" respectively.

How do I set this right? Also, if I need to make any changes to any initialization variables, I will like to make them ONLY for this function.


texts: Why in sizes of files not show in human-readable format?

texts:
Linux Mint 20
Emacs 26.3
I install packaged dired-k
And set this param in my init.el
'(dired-k-human-readable t)

But it not work in dired mode.
Here example

As you can see size of files not show like KB/MB (human readable)
If in shell I use
ls -alFH

The show with human readable format:
 alexei@alexei-nb:~/.emacs.d$ ls -alFh
total 168K
drwx------  8 alexei alexei  12K Mar 27 18:22 ./
drwxrwxr-x 55 alexei alexei 4.0K Mar 27 17:54 ../
drwx------  2 alexei alexei 4.0K Mar 27 19:55 auto-save-list/
-rw-rw-r--  1 alexei alexei  11K Mar 25 23:37 bookmarks
drwxr-xr-x  2 alexei alexei 4.0K Mar 27 18:31 custom/
-rw-r--r--  1 alexei alexei 6.2K Mar 27 19:54 dired-history
drwxr-xr-x 62 alexei alexei 4.0K Mar 27 18:00 elpa/
drwx------  2 alexei alexei 4.0K Mar 16 23:42 eshell/
drwxr-xr-x  9 alexei alexei 4.0K Mar 27 19:54 .git/
-rw-r--r--  1 alexei alexei  341 Mar 19 21:21 .gitignore
-rw-------  1 alexei alexei 8.6K Mar 27 19:54 history
-rw-rw-r--  1 alexei alexei  62K Mar 27 19:54 ido.last
-rw-rw-r--  1 alexei alexei 8.6K Mar 27 19:54 init.el
-rw-r--r--  1 alexei alexei   50 Mar 19 21:18 README.md
-rw-------  1 alexei alexei 1.6K Mar 27 19:54 recentf

But why it's not work in dired mode?


texts:
Emacs supports syntax flags for 1- and 2-characters comment delimiters. Can it be made to recognize and properly highlight 3-characters delimiters?

For example:

In Emacs Lisp:
    ;;; Headings

In C#:
    /// XML Comment

In Java:
    /** Javadoc comment */

In Coq:
    (** Codoc comment (nestable with (* ... *) and (** ... *)) *)


texts: How to run `gprolog` under an Emacs sub-process shell?

texts:
I'd like to run the gprolog interactive interpreter in an Emacs sub-process shell (started with M-x shell).

The interactive interpret starts without a problem, but it does not respond to some keystrokes as expected.

To illustrate the problem, I first show a simple interaction as it occurs when I run gprolog in a "top-level shell" (i.e. not one running as a subprocess of Emacs).

(In the excerpts below, please regard the delimiters << and >> as "markup" to indicate the text I type.  In the actual interaction, I don't type any << or >> sequences.  Neither do I type the ▮ characters, which I'm using only to indicate the position of point.  With the exception of the text enclosed by <<...>> and ▮, all text shown in the excerpts below is produced by gprolog.)

Staring from top-level shell

First I type the following query:

| ?- <<member(X, [a,b,c]).>>▮

Then I hit the Enter key (shown below as [RET]):

| ?- <<member(X, [a,b,c]).[RET]>>

X = a ? ▮

Now I hit ; once:

| ?- <<member(X, [a,b,c]).[RET]>>

X = a ? <<;>>

X = b ? ▮

Note that pressing ; was all that I had to do to elicit the next response from gprolog.

Finally I hit ; twice more, thereby exhausting the list of remaining results:

| ?- <<member(X, [a,b,c]).[RET]>>

X = a ? <<;>>

X = b ? <<;>>

X = c ? <<;>>

no
| ?- ▮

Staring from Emacs sub-process shell

Next I show what an attempt to run the same interaction in an instance of gprolog invoked from an Emacs sub-process shell.

Up to this point, it looks the same as before:

| ?- <<member(X, [a,b,c]).[RET]>>

X = a ? ▮

But now, if when I press ;, the semicolon character gets inserted, but gprolog does not respond:

| ?- <<member(X, [a,b,c]).[RET]>>
X = a ? <<;>>▮

If now I hit Enter, gprolog (basically) prints out one more result and terminates the query (prematurely):

| ?- <<member(X, [a,b,c]).[RET]>>

X = a ? <<;[RET]>>
;

X = b ?

yes
| ?- ▮

I encountered a similar problem with swipl (Swiss-Prolog), but found that starting it with the -tty flag made it usable under an Emacs sub-process shell (though the interface behaves a little differently).

I did not find anything like swipl's -tty flag for gprolog.


texts: How to toggle neotree in the project directory?

texts:
There is a nice example of how to open neotree in the project rootsee:
 https://www.emacswiki.org/emacs/NeoTree (find-file-in-project and Projectile sections).

However, I'd like to toggle neotree, so I can easily open and close it, while having the root set to the project path.

Is this possible?


texts: How should I solve "no such directory" error at CDPATH with environmental variable on Windows 10 Emacs?

texts:
I have installed GNU Emacs on Windows 10. When I open it, I get an error.

Warning (initialization): An error occured while loading
'c:/Users/[redacted]/AppData/Roaming/.emacs.d/init.el':

error: No such directory found at CDPATH environment variable.

Adding CDPATH as an environmental variable doesn't seem to change it. What should I do? Was it looking for a directory, instead of my init.el file?


texts: Tern stopped working! Request failed: ((wrong-type-argument url nil))

texts:
I just upgraded yesterday emacs from version 25.2 to 27.0.5. Now I am encountering this problem, any idea of how to fix it?

  This happens in some tern functions I try to use: tern-get-docs, tern-ac-complete...


texts: What does refeer evil-mode ^ (carry)'s mark to ? (shown in :marks list)

texts:
I Think I have an idea, unless i want to be sure. According to vim.wikia.com, [ and ] marks in vim refers to beginning/end of previously changed or yanked text, but there is no built-in ^ mark.

I must have missed something because I didn't really get deep into evil or vim references manuals.

Any accurate idea ?

Thank you in advance, hoping this is not a duplicate.


texts:
I've just switched to using spacemacs with powerline.  I'm trying to make the font larger (my eyes are not as good as they used to be).  But when I do, the powerline separator gets screwed up.  Is there anyway to scale that up as well?

I've update size to 16 (from 13) and changed powerline-scale to 0.8 (from 1.1) to try and counteract the size problem.

dotspacemacs-default-font '("Source Code Pro"
                               :size 16
                               :weight normal
                               :width normal
                               :powerline-scale 0.8)

This is what I get


texts: cygwin/emacs (v24.4.1) behind firewall proxy package install 0 sized files

texts:
I'm a recent Vim "convert" (and yet love most of it), still I have an issue with installing packages using cygwin/emacs.

The related configurations are (I have $http(s)_proxy set up as environment variables in my .bashrc):

;;; init.el
;; This sets up the load path so that we can override it
(package-initialize nil)
(package-initialize t)
(setq package-enable-at-startup nil)
(org-babel-load-file "~/Repos/orgfiles/emacs-setup.org")

From emacs-setup.org:

(require 'package)
  (setq package-list '(
  ;;; list of packages
  ))
 (add-to-list 'package-archives
    '("melpa" . "http://melpa.milkbox.net/packages/") t)
  (add-to-list 'package-archives
    '("org" . "http://orgmode.org/elpa/") t)
  (add-to-list 'package-archives
    '("marmalade" . "http://marmalade-repo.org/packages/") t)
  (package-initialize)
  ; fetch the list of packages available
  (unless package-archive-contents
    (package-refresh-contents))
  ; install the missing packages
  (dolist (package package-list)
    (unless (package-installed-p package)
      (package-install package)))

(This was copy pasted from several places from the interwebs...)

My problems are the following:

I quiet often (but not always) get the following errors in *Messages*:

 Contacting host: elpa.gnu.org:80
 Failed to download `gnu' archive.
 Contacting host: melpa.milkbox.net:80
 Failed to download `melpa' archive.
 Contacting host: orgmode.org:80
 Failed to download `org' archive.
 Contacting host: marmalade-repo.org:80
 Failed to download `marmalade' archive.

when I'm able to download the (e.g.) melpa archive and mark a package for installation, quiet often the installed package contains 0 sized package file(s) after which seemed to be a succesful installation. E.g.: most recently:

 $ ls -l auto-complete-chunk-20140225.146/
 total 2.0K
 -rw-r--r-- 1 zsbotykai None   0 Feb 16 10:54 auto-complete-chunk.el
 -rw-r--r-- 1 zsbotykai None 410 Feb 16 10:54 auto-complete-chunk-autoloads.el
 -rw-r--r-- 1 zsbotykai None 172 Feb 16 10:54 auto-complete-chunk-pkg.el

So above: auto-complete-chunk.el is empty after the *Messages* install log shows:

 Install package `auto-complete-chunk-20140225.146'? y
 Contacting host: melpa.milkbox.net:80
 Generating autoloads for auto-complete-chunk.el...done
 Saving file /home/zsbotykai/.emacs.d/elpa/auto-complete-chunk-20140225.146/auto-complete-chunk-autoloads.el...
 Wrote /home/zsbotykai/.emacs.d/elpa/auto-complete-chunk-20140225.146/auto-complete-chunk-autoloads.el

Could you please point me out and/or show the direction where/what/how should I investigate the root cause of this?


texts: Org export via org-ref-->pandoc, bibliography using relative path

texts:
Can org-ref export through ox-pandoc using a relative path to the bibliography file?

Export via org --> pandoc --> HTML succeeds when the org document contains an absolute path to the bib file. However using a path to the bib file relative to the org file directory, such as bibliography:/bib/mybib.bib, produces the error: File ‘bib/mybib.bib’ not in paths defined via bibtex-file-path.


texts:
Is it possible to create a regexp that excludes a string? For example, I want to create a regexp that accepts a set of strings with *.*helm.**except a few ones such as *helm help*. It means, *helm help* should be excluded. I want this regexp functionality because I set display-buffer-alist to position Helm windows where I like it to be:

(add-to-list 'display-buffer-alist `("*.*helm.**"
                                    (display-buffer-in-side-window)
                                    (inhibit-same-window . t)
                                    (window-height . 0.4)))

However, doing so would prevent a Helm buffer by default displayed in fullscreen, like *helm help* buffer.


texts:
I use shell inside emacs but by default it prints output in 1 color.

However, when I use grep, I would like to see substring I'm searching highlighted.

To see colors, I can manually type TERM=ansi when shell starts, but I wonder if there is a way to run shell with TERM defined?


texts: Can I use emacs with company-mode and company-go to complete Go's standard library function names?

texts:
Below is my emacs init file that relates to Go. I'm trying to use company mode to auto completes Go.
;;===================================================
; Golang related configuration
;;===================================================
(defun my-go-mode-hook ()
  ; Add go-guru
  (require 'go-guru)

  (require 'company)
  (require 'company-go)

  ; Use goimports instead of go-fmt
  (setq gofmt-command "goimports")
  ; Call Gofmt before saving
  (add-hook 'before-save-hook 'gofmt-before-save)
  ; Customize compile command to run go build
  (if (not (string-match "go" compile-command))
      (set (make-local-variable 'compile-command)
           ;"go build -v && go test -v && go vet"))
           "go run"))
  ; Godef jump key binding
  (local-set-key (kbd "M-.") 'godef-jump))
(add-hook 'go-mode-hook 'my-go-mode-hook)
; Highlight identifiers in Golang by default
(add-hook 'go-mode-hook #'go-guru-hl-identifier-mode)

However, it seems that the company mode can only completes words that have been used in the buffer. See below screen shot.

What I want is to complete Go's builtin functions, like fmt.Fprintln. It seems company mode can't do that. See below screen shot.

I want to confirm, is it true? Can emacs auto completes Go's builtin functions? Are there any example emacs init files that I can use as a reference? Thanks in advance.

Update
Confirmed I installed gocode.

I've cleared my init.el and only contains the minimal code to do the completion, but it still not work (emacs restarted).

Update2
Yes gocode is running.


texts: Local magit revives all stale tramp connections

texts:
I'm using long-living emacs sessions using emacs in daemon mode, and I use tramp quite extensively. I usually have several buffers in the background which use tramp, but since my system has been suspended in between, those tramp connections have died in the meantime. This is usually no problem - when I open the buffer again (and modify it), emacs just asks me to open the tramp connection again.
However, when I work at something completely different, locally on my system, and I invoke magit (magit-status), it asks me to revive every single tramp connection, even though these have nothing to do with what I'm currently working on, and most of those connections don't even visit a file in any git repository.
Is there any way of not having magit revive all those tramp connections?


texts: Built-in way of decoding HTML entities (i.e. " or ')

texts:
I recently ran into the problem of decoding html entities. I have the
following two strings (Note how two methods of encoding are used,
named and numbered).

The old &quot;how to fold xml&quot; question
Babel doesn&#39;t wrap results in verbatim

And I need to convert them to

The old "how to fold xml" question
Babel doesn't wrap results in verbatim

Searching around, I found this old question on SO (which is what I'm
doing for the moment), but I refuse to believe Emacs has no built-in
way of doing this. We have several web browsers, at least two of which
I know are built-in, not to mention mail clients and feed readers.

Is there not a built-in way of decoding html entities?
I'm looking for a function that takes a string from the first example and returns a string from the second example.


texts:
Is there a best, most future-proof method of setting emacs on OS X to delete files to the trash?

I tried the instructions here:

(setq delete-by-moving-to-trash t)

(defun system-move-file-to-trash (file)
  "Use \"trash\" to move FILE to the system trash.
When using Homebrew, install it using \"brew install trash\"."
  (call-process (executable-find "trash")
    nil 0 nil
        file))

but they don't work:

Trashing...
(wrong-type-argument stringp nil)

Also, it feels wrong to have to install a separate program in order for Emacs to be able to trash files. Furthermore, I won't remember to install the "trash" program the next time I do a clean OS X install.

Update: I added this to my .emacs and removed the call to trash and it seems to work. I wonder why Emacs on OSX defaults to the FreeDesktop ~/.local/share/Trash location.

(setq trash-directory "~/.Trash")


texts: Macros usage: execute instructions after a backquoted one

texts:
I have a question about macros.
When I call a macro with an argument, I call a function with it. It works.
But if I add another instruction below, the backquoted instruction is not executed.

Here is the dummy example:

(setq words '())

(defun func-test (name)
  "Function test."
  (message "Function called with %s" name)
  (add-to-list 'words name))

(defmacro macro-test (name)
  "Macro test."
  (message "Before ...")
  (unless (member name words)
    `(func-test ,name))
  ;;;; /!\ Bug: if I uncomment this next line, it does not work anymore
  ;;(message "... After")
  )

(macro-test 'hello)
(message "%S" words)
;; Should be (hello)

(macro-test 'thanks)
(message "%S" words)
;; Should be (thanks hello)

(macro-test 'bye)
(message "%S" words)
;; Should be (bye thanks hello)

Do you have any idea or tip to deal with it?

Bonus question: can I use several backquoted instructions in this macro or is there a specific form to use it? E.g. if I want to call several functions from my macro.


texts: Magit pull --rebase does not work anymore - version 20151203.508

texts: I don't know if it is my version problem or not. I am trying to pull --rebase from the current branch (F -r RET). For now, I have to use workaround (r r origin/branch)


texts:
I have not found a standard Elisp library function to merge two property lists, like this:

(setq pl nil)
(setq pl (plist-put pl 'key-1 'value-1))
(setq pl (plist-put pl 'key-2 'value-2))

I could build something with dolist, but before I do, I would like to check that I'm not overlooking an existing function in some library.

Updates, based on the comments:

In response to the "many-ways" comment:

  I would imagine that there isn't such a function because there are different (and possibly valid) answers possible to the question: what to do when you have duplicate property names with distinct values?

Yes, there is a question on how to merge duplicates, but there are relatively few ways to address that. I see two general approaches. First, argument order could resolve the duplicates; e.g. rightmost wins, as in Clojure's merge. Second, the merge could delegate to a user-provided callback function, as in Ruby's merge.

In any case, the fact that there are different ways of doing it does not prevent many other language standard libraries from providing a merge function. The same general argument could be said of sorting, and yet Elisp provides sorting functionality.

"Could you elaborate?" / "Please specify the behavior you are looking for precisely."

Generally speaking, I'm open to what the Elisp community uses. If you would like a specific example, here would be one example that would work:

(a-merge-function '(k1 1) '(k2 2 k3 3) '(k3 0))

And returns

'(k1 1 k2 2 k3 0))

This would be a rightmost-wins style, like Clojure's merge.

"They're lists, so just append?"

No, append does not preserve property list semantics. This:

(append '(k1 1 k2 2) '(k2 0))

Returns this:

(k1 1 k2 2 k2 0)

  append is a built-in function in `C source code'.

  (append &rest SEQUENCES)

  Concatenate all the arguments and make the result a list.
  The result is a list whose elements are the elements of all the arguments.
  Each argument may be a list, vector or string.
  The last argument is not copied, just used as the tail of the new list.

"And your example does not show anything like a merge - it does not even show two property lists."

Yes it does; it does the merge step by step. It shows how doing a merge using the Elisp's documented property list functions is painfully verbose:

(setq pl nil)
(setq pl (plist-put pl 'key-1 'value-1))
(setq pl (plist-put pl 'key-2 'value-2))

Just display the resulting output value from pl:

(key-1 value-1 key-2 value-2)

To reiterate, I am capable of writing a function to solve this problem, but I first wanted to figure out if such a function exists somewhere in common use.

Finally, if you downvoted the question because you found it unclear, I would ask that you reconsider now that I've gone to some effort to clarify. This is not a lack of research. The Elisp documentation on "Lists" does not answer the question.


texts: Setting MUpdf as default viewer in AUCTeX

texts:
How can I set MUPDF as the default viewer in AUCTeX (I mean setting it in the variable Tex-view-program-selection)?

Many thanks


texts: What does trailing dash mean in the shell command parameter list?

texts:
This question is related to the solution nanny provides to the xml beautifying problem on this answer: How to prettify/format an XML buffer?
This works for me on Emacs 24.5 on Windows, but I want to know what does "xmllint --format -" parameter of the shell-command-on-region function mean? Apparently "xmllint --format" does not work and when I run "xmllint --format -" in the Windows shell it waits for my input instead of returning to the command interpreter. I am able to input an xml document data from the console and after pressing Ctrl-z RET get my input beautified back to the console.
I am curious what exactly the role of the trailing dash in the shell command execution string is.


texts: How can I find which version of a particular mode I am using?

texts:
For example, I want to use a library that requires I am on org-mode version 8 or above. I don't know what version of org-mode I have.

Running M-x version only gives me the emacs version. Is there a command where I can get the org-mode version?

NOTE: As @Drew mentioned in the comments, I am searching for the version of a package, not a mode. In this example, I want to get the version of the org-mode package, not the version of org-mode itself.


texts: 0;95;0c escape code is inserted with typeahead in terminal emacs

texts:
Whenever I start the terminal emacs and there is typeahead (i.e., I start typing before emacs starts), the escape code 0;95;0c gets inserted into the buffer. For example, if I run

sleep 3; emacs -Q test

and type qwerty while the sleep is happening (test is a new file), the buffer will open with

qwerty0;95;0c

The *Messages* buffer says

For information about GNU Emacs and the GNU system, type C-h C-a.
(New file)
M-[ > is undefined
Making completion list...

My $TERM is xterm-256color and I am using iTerm2 on OS X 10.10.5.

EDIT: If I use Terminal.app instead of iTerm2, I get 1;2c in place of 0;95;0c and it opens a help buffer with "Global bindings starting with M-[". Not sure what key sequence activates that.

How can I determine what this escape code is and make it not get inserted into my emacs buffers?


texts: Fixing "Warning: Unknown slot " emitted when a slot referenced by its :initarg name

texts:
The code below works but compiles with: foobar.el:9:9:Warning: Unknown slot ‘:baz’
(require 'eieio)

(defclass foo-bar ()
  ((baz :initarg :baz
        :initform t
        :type boolean)))

(defmethod foo-bar-get-baz ((instance foo-bar))
  (oref instance :baz))

(message "%s" (foo-bar-get-baz (make-instance 'foo-bar)))
;; => t

While this compiles perfectly fine:
(require 'eieio)

(defclass foo-bar ()
  ((baz :initform t
        :type boolean)))

(defmethod foo-bar-get-baz ((instance foo-bar))
  (oref instance baz))

(message "%s" (foo-bar-get-baz (make-instance 'foo-bar)))
;; => t

Is there a way to tell compiler that the :baz is an alias to baz slot? Without creating fake classes.


texts:
Is there any way to use MathJax in emacs org-mode html export without an internet connection?

I know that MathJax can be downloaded, but when I provide org-html-mathjax-options with the path to MathJax.js, the html file doesn't use MathJax at all.

Any help would be appreciated. Thanks!

Update -- this has been answered.

When in org-html-mathjax-options, set path to /<path-to-mathjax>/MathJax/MathJax.js?config=TeX-AMS_HTML,local/local


texts: customized week label in org-mode agenda view

texts:
Is it possible for org-mode agenda view to display a customized label for the week, in addition to the week number included by default? For example, the agenda for the current week shows:

Week-agenda (W37):
Monday      9 September 2019 W37

Instead, I would like it to show one of the following options, or a similar one (no preference, other than ease of implementation):

Week-agenda (W37 | A W00):
Monday      9 September 2019 W37 | A W00

Week-agenda (W37):
Monday      9 September 2019 W37 | A W00

Week-agenda (W37 | A W00):
Monday      9 September 2019 W37

The custom label captures one of three periods in the year (A--C), each comprising 10 weeks (W00--W10). The start date for each period is arbitrary, so it has to be set manually.


texts: Spacemacs: Toggle vim/emacs mode globally

texts: When using Spacemacs on vim mode, you can toggle between Emacs/Vim modes with Ctrl-Z. This works per buffer, is there a way to do this globally so when you switch to a mode, every buffer you open/visit after that keeps the mode you just switched to?


texts:
Is there a good general customization of org-babel to run asynchronously?
Recently I plan to use MATLAB via org-babel, but I would like it in an async manner, since some calculations do take time.

I do not wish to customize ob-matlab only. This is because I think it should be done in the level of framework instead of an application. In other words, a same modification should enable async feature for other language extensions e.g. R language.

Does anyone have a good solution?
So far I have tried async.el as well as deferred.el to modify org-babel-execute-safely-maybe that can be found in ob-core.el at the moment.


texts: Report missing noweb references in org-babel

texts:
In org-babel, is there a way for checking for missing noweb references <<...>> or for throwing an error if a reference is missing?

For example in the following I have mistyped the name of the referenced code block.  Tangling via C-c C-v f then produces an elisp file with <<function-body>> replaced by nothing and reports no error.

#+PROPERTY: header-args :noweb yes :tangle no :exports none

The first code block calls all others.

#+BEGIN_SRC emacs-lisp :tangle yes
  (defun test-fn (a b c)
    "A test function"
    <<function-body>>)
#+END_SRC

#+NAME: function-bod
#+BEGIN_SRC emacs-lisp
  (+ a b c)
#+END_SRC

Alternatively, is there a reliable way to make sure I don't type such names incorrectly?


texts: File encoding differet when visiting the file again

texts:
I have this in my .emacs:

(setq-default buffer-file-coding-system 'utf-8-unix)

When I create a file in emacs and save it, it should be buffered and saved in utf-8-unix.

When I open such a file again after some time, the regional characters I had put in the file originally - å, ä and ö - will appear as capital A with tilde plus one of three cluttercharacters which I don't know the names of, a newlinesymbol, a sort of skull-symbol, and the yen-symbol.

Obviously, what I want is the original symbols when I reopen the file.

Why is this happening, how can I change that behaviour?

What I found in the documentation is the function (set-coding-systems-priority... but I'm not sure how to use it.

Also, second in that list is utf-8 (alias mule-utf-8), and first is iso-latin-1, which I assume is the system that is overriding my åäö's with clutter. Should I just change my default coding system from utf-8-unix to utf-8, if there's any difference. ?.

I'm a bit buffeled about all those coding issues in emacs...

Thanx for any enlightenment on the topic.


texts:
Running Emacs 25 on Kubuntu 17.10.

I am able to enter text in devanagari script but it does not dispaly correctly in the editor.

For instance, the text entered as:

क का कि की कु कू के कै को कौ कं कः

shows as:

As I M-x describe-character, the characters displayed correctly describe the correct character. The characters displayed incorrectly describe the base character क. Also, as I execute describe-character command, the right part of the display disappears and remains blank till I move the pointer across all characters. Then as the pointer moves across characters, the corresponding part appears on the right.


texts: What's the difference between setq and defvar

texts:
What is the difference between setq and defvar in Emacs lisp?

I see common lisp version of the same question at https://stackoverflow.com/questions/3855862.  Are they same in Elisp?


texts: Emacs is garbled by output of a background process running in the same terminal emulator

texts:
My Emacs is running in foreground in terminal emulator, where I am also running some background processes.

My Emacs is garbled by the stdout and stderr output of the background process.

Besides redirecting the stdout and stderr output of the background process to /dev/null, is there another way to make my emacs not bothered by the background process? For example, can something be done on the emacs side?

Thanks.


texts: AUCTeX's pdf viewer doesn't open when Hebrew is the default polyglossia language

texts:
Consider the following LaTeX document.
\documentclass{article}

\usepackage{libertine}
\usepackage{fontspec}
\usepackage{polyglossia}

\iffalse
\setdefaultlanguage{hebrew}
\fi

\begin{document}

Hello, world!

\end{document}

After finishing writing the document, I hit C-c RET twice.

Scenario 1 - with the \iffalse ... \fi as shown
After the first time the message LaTeX: successfully formatted {1} page appears in the echo line. After the second time the message View command: TeX-evince-sync-view appears in the echo line. If I now hit RET, a pdf viewer opens with the processed document.

Scenario 2 - without the \iffalse and without the \fi tags
After both the first and the second time the message You should run LaTeX again to get references right, {1} page appears in the echo line. The pdf file is created and, when opened manually, looks fine, but the pdf viewer does not open from within Emacs as in scenario 1.

How can I get the same behavior of scenario 1, specifically the automatic opening of the synched pdf file, under the setup of scenario 2?


texts: Make region(s) invisible (not evaluated) to "string-match", "occur" and similar commands

texts:
In a previous question, Make region(s) invisible (not evaluated) to query-replacy and similar commands, I learned about isearch-filter-predicate. Now, I wonder if is there a similar method to make regions invisible to functions like string-match, occur etc.

For example I have this LaTeX code:

\begin{eqnarray}
\begin{matrix}
\newline
\end{matrix}
\end{eqnarray}

I use string-match-p to test if the \newline (\\) string occurs in the LaTeX eqnarray environment. If nil I replace "eqnarray" --> "equation". I also need to "ignore" newlines that occur in sub-enviroments like matrix, so I thought I could make the regions of these sub-enviroments "invisible" to the string-match-p function.

Is there a way to do it? Alternatively I thought I could write the isearch-filter-predicate combined with the search-forward-regexp function to test for the occurrence of my target string in the region.

This is the code I wrote:

(defun skip-if-my-ignore (beg end)
  "Return nil if some text BEG to END has non-`nil' property `my-ignore'."
  (catch 'skip-if-my-ignore
    (let ((pos  beg))
      (while (< pos end)
        (when (get-text-property pos 'my-ignore) (throw 'skip-if-my-ignore nil))
        (setq pos  (1+ pos))))
    t))

(defun test-invisibility ()
  (interactive)
  (save-excursion
    (let* ((a (copy-marker (point-min)))

       (SUB_ENVIRONMENTS (regexp-opt '(
                       "array"
                       "cases"
                       "pmatrix"
                       "matrix"
                       ))))

      (unwind-protect
      (progn
        (goto-char a)
        (while (search-forward-regexp (concat
                       "\\\\begin{"
                       "\\(" SUB_ENVIRONMENTS "\\)"
                       "}")
                      nil t)
          (save-excursion
        (let* ((b (copy-marker (match-beginning 0)))
               (SUB_ENV (match-string 1))
               (e (copy-marker (search-forward-regexp
                    (concat "\\\\end{" SUB_ENV "}") nil t))))

          (put-text-property b e 'my-ignore t)

          (save-restriction
            (narrow-to-region b e)

            (let ((isearch-filter-predicate  'skip-if-my-ignore))

              ;; should not ask for replacements (in sub-environments)
              (perform-replace "\\\\newline" "MATCHED" t t nil 1 nil b e)

              (if (string-match-p "\\\\newline" (buffer-substring b e))
              (read-string "string-match-p matched the string. I don't want this!")

            (read-string "string-match-p didn't match the string. I WANT THIS!"))

              (if (search-forward-regexp "\\\\newline" e t)
              (read-string "search-forward-regexp matched the string. I don't want this!")

            (read-string "search-forward-regexp didn't match the string. I WANT THIS!"))

              ;; should not find occurrences in the sub-environments:
              (occur "\\\\newline" 1))))))))
    ;; *UNWINDFORMS
    (remove-list-of-text-properties (point-min) (point-max) '(my-ignore))))))


texts: Is there a syntax in Elisp for indexed getters and setters?

texts:
I want to define a struct for chores

(defstruct chore name sector assignments)

where the assignments slot is a vector with seven positions. I know that the above syntax will generate the getters chore-name, chore-sector and chore-assignments. But I would like to have something like this (chore-assignment 1 c). Is there any syntax that will give me this “for free” or should I code the function myself?


texts: How to remove unmatched auto-complete results?

texts:
Now auto-complete show list of values, used in other files, not in current, for example:

I use latest versions of all packages from MELPA, and my .emacs contain this strings for set settings:

(global-auto-complete-mode t)
(add-hook 'python-mode-hook 'jedi:setup)
(add-hook 'python-mode-hook 'py-autopep8-enable-on-save)
(setq jedi:complete-on-dot t)
(setq ac-auto-start 1)
;; More for tern, js2 and other...

I do'not change settings for auto-complete with sustomize.

How to remove unmatched values from auto-completion list?


texts: Unable to set keybinding with the down arrow key in emacs

texts:
I have the following keybindings for jumping 10 lines.

(global-set-key (kbd "<C-up>") (lambda () (interactive) (previous-line 10)))
(global-set-key (kbd "<C-down>") (lambda () (interactive) (next-line 10)))

The problem is that the C-up binding works and the cursor jumps 10 lines back, but nothing happens on C-down. What might be the reason?


texts: Get the path to the JSON element at point

texts:
Problem statement

Using Elisp, when point is on an element in a JSON datastructure (either raw JSON or an Elisp sexp of the kind generated by json.el), is there an easy way to get a json-pointer-get-style path to that element?

Sexp example

To take the example from the json-pointer.el docs:

(let ((json '((foo . 1)
              (bar . [((qux . "hello")) 3])
              (baz . ((boo . [1 3 5 7]))))))
    (json-pointer-get json "/foo")        ;; => 1
    (json-pointer-get json "/bar/0")      ;; =>  '((qux . "hello"))
    (json-pointer-get json "/bar/0/qux")  ;; => "hello"
    (json-pointer-get json "/bar/1")      ;; => 3
    (json-pointer-get json "/baz/boo/2")) ;; => 55

If point was on the "1" on the first line, I'd like to get "/foo".

If point was on the first opening parenthesis or last closing parenthesis inside the square brackets of the second line, I'd like to get "/bar/0".

If point was somewhere on "hello", I'd like to get "/bar/0/qux".

If point was on the "3" on the second line, I'd like to get "/bar/1".

And if point was on the "5" on the third line, I'd like to get "/baz/boo/2".

Raw JSON example

I'd also like to get the same paths when point is positioned on the same elements in raw JSON format instead of an Elisp sexp.

In other words, if my buffer contained the raw JSON equivalent of the above sexp:

{"foo":1, "bar":[{"qux":"hello"}, 3], "baz":{"boo":[1, 3, 5, 7]}}

If point was on the  first "1", I'd like to get "/foo".

If point was on the opening or closing curly braces following "bar", I'd like to get "/bar/0".

If point was somewhere on "hello", I'd like to get "/bar/0/qux".

If point was on the "3" in the second element of "bar", I'd like to get "/bar/1".

And if point was on the "5", I'd like to get "/baz/boo/2".

Naturally, this should work regardless of the whitespace and should work just as well if everything was one one line or spread across multiple lines.


texts:
To aid minuting staff meetings in a small organisation, I considered creating a property called :Attendees: and defining the allowed values for that property, e.g.:

* Meetings
       :PROPERTIES:
       :Attendees_ALL: Amy Bob Joe Max Sam Zoe
       :END:

and then using them like this:

** Meeting 2017-05-17
       :PROPERTIES:
       :Attendees: Amy Joe Zoe
       :END:

However, I then spotted that "a property can only have one entry per Drawer." So, Org-mode properties might not be a suitable tool for this after all.

I could use a simple list, I suppose, but I want to easily be able to create sparse trees matching who was at a meeting.

Using tags is also an option, but would be quite intrusive: potentially quite a long list of tags for each meeting. And not easily extendable to "Apologies", i.e. people who could not attend.

What might be a better solution?


texts: How do I get Emacs to accept a # (hash) sign as a comment starter in a new mode?

texts:
I am attempting to develop an Emacs major mode for writing Tecplot macros. The Tecplot macro language has lots of peculiar constructs, such as a # sign for comments and $! for the beginning of a macro command. When I use the following code to define the syntax table, I get an invalid character error for the comments:

(defconst tecplot-macro-mode-syntax-table
  (let ((table (make-syntax-table)))
    ;; ' is a string delimiter
    (modify-syntax-entry ?' "\"" table)
    ;; " is a string delimiter too
    (modify-syntax-entry ?\" "\"" table)
    ;; " is a string delimiter too
    (modify-syntax-entry ?| "|" table)

    ;; / is punctuation, but # is a comment starter
    (modify-syntax-entry ?# ". 1b" table)
    table))

The error I get is:

**Lisp error: (error "Invalid syntax description letter: #")**

How do I get the # sign to be resolved as a comment? Am I going to have similar issues with the $!?


texts:
I like sqlplus package on emacs.
It works perfect when I use oracle dbms, however,
my company uses Tibero, which is not available on melpa repository.

I would like to write a melpa package for this specific db.
What procedures should I follow if I want to upload the package on melpa   repository?
Is there a good tutorial for this?


texts: undo-tree -- history file without text-properties

texts:
Q:  How can I modify undo-tree-save-history to remove the text-properties from all entries that make their way into the saved history file?

In a related thread, @PythonNut was on a very similar quest to remove text-properties from entries that make their way into the history file created by undo-tree-save-history:  text-properties bloat persistent undo files

In that related thread, the original poster chose to remove text-properties before they ever become part of the buffer-undo-tree.  This is not ideal, in my opinion, because a user should be able to undo/redo entries with text-properties intact if so desired.  I am looking for a solution that does not modify either buffer-undo-tree or buffer-undo-list -- instead, I only want a history file without text-properties.


texts: How to display Complete Evaluation Result in Echo Area itself in addition to new frame: Buffer > Message?

texts:
I am new to Emacs and Emacs-Lisp. I have the following code:

(message "Her age is: %d" 10)
(message "Her name is: %s" "Nancy")
(message "My list is: %S" (list 7 4 2))

When I evaluate, it displays JUST the last line in the echo area.

My list is: 7 4 2

It does NOT display the first 2 lines.

Of course, on C-h e it displays all the 3 lines in Buffer > message area in new frame.

Is there a way I can display ALL the 3 lines in echo area itself, in addition to message buffer frame, like the following?

Her age is: 10
Her name is: Nancy
My list is: (7 4 2)


texts:
When i try to open my .emacs file with emacs i get an error as such.

$ emacs .emacs
Fatal error 11: Segmentation fault
Backtrace:
emacs[0x4f74cb]
emacs[0x4dcf3e]
emacs[0x4f611e]
emacs[0x4f6283]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10340)[0x7f98da6f4340]
emacs[0x538130]
emacs[0x59a8cb]
emacs[0x59a8e1]
emacs[0x59a8e1]
emacs[0x59a8e1]
emacs[0x539e37]
emacs[0x5380dd]
emacs[0x537d28]
emacs[0x538186]
emacs[0x537ce4]
emacs[0x538186]
emacs[0x537ce4]
emacs[0x538186]
emacs[0x537ce4]
emacs[0x537dd4]
emacs[0x537dd4]
emacs[0x537d28]
emacs[0x538186]
emacs[0x537ce4]
emacs[0x538186]
emacs[0x537ce4]
emacs[0x538186]
emacs[0x537ce4]
emacs[0x538186]
emacs[0x537ce4]
emacs[0x538186]
emacs[0x537ce4]
emacs[0x538186]
emacs[0x537ce4]
emacs[0x537cf1]
emacs[0x538186]
emacs[0x537ce4]
emacs[0x537ce4]
emacs[0x537dd4]
emacs[0x537dd4]
emacs[0x537cf1]
...
[1]    6084 segmentation fault (core dumped)  emacs -nw .emacs

But emacs opens other files without crashing. Can some one help me.


texts:
Is there any context-aware auto-completion for Go e.g
if I enter "fmt." after importing the library, auto-completion should pop up and suggest me the functions like "Println" etc.


texts:
The following function fails to return "16":
(string-to-number "bm16")

It seems to get tripped up if the first characters of a string aren't numbers.  Is there a way to construct an elisp function which takes a string of text and returns the number it contains (it doesn't have to handle decimals)?


texts:
I like using indirect buffers and narrowing to work on multiple sections of code simultaneously.

I noticed recently that if I disable font-lock-mode in an indirect buffer then I cannot get proper syntax highlighting back.  I can reenable the mode, but no colors show up and instead I get the following error message:

Not enabling jit-lock: it does not work in indirect buffer

I've tried reading the documentation on font locking and looked in the jit-lock customize group ... but I can't find any way to tell Emacs to skip over jit locking and just try to fontify the whole indirect buffer.  Is there some way to do this?  If not, what else can I try?  If there's nothing I can do ... why can't I fontify an indirect buffer?


texts: How to customize the rendering of the straight lines in mode line?

texts:
Here are two examples of what I mean:

The lines are rendered in a different color as the background, so they are clearly seen:

The lines are rendered in the same color as the background, so they can not be seen:

So, I would like to know how to tweak that, probably setting a face attribute.
Whether to render it clearly or hide it.