texts: Setup c-mode indentation, braces and tabs

texts:
I've been trying to setup cc-mode based files to behave in the way I want, but with so many varying opinions and suggested ways of doing things, I've not been able to get things just right.

All I want to be able to do is the following:

void foo() {
   if (something) {
      doSomethingElse();

      while (bar()) {
         zap();
      }
   }
   else {
      orSomeOther();
   }
}

Opening braces should be on the same line.
When I hit Return after I enter the opening brace, the cursor should move to the next line, and indent.
Indentation should be using tabs, each with a width of 3.
When I hit Return after entering the opening brace on the line with the while, the cursor should be placed where the z in zap() is.
When I do hit Return after opening braces, the closing brace should be added under the blank line where we've just indented and the cursor is now waiting for me to continue typing.


texts: How does a boolean variable work in Emacs lisp?

texts:
In my package I have the following:

(defcustom foobar-on-exit t
"Boolean variable, enabled by default."
:type 'boolean
:group 'foobar)

(if foobar-on-exit
    (add-hook 'kill-emacs-hook 'some-message))

So I get a message when I close Emacs.

Then in my init.el I set the value of foobar-on-exit on nil.

(setq foobar-on-exit 'nil)

After evaluating or restarting, I still got the message while the variable foobar-on-exit is still false.

So somewhere I went wrong. Any hint?


texts: Emacs gives `stty: 'standard input': Inappropriate ioctl for device` in ZSH shell

texts:
I am running emacs inside ZSH shell. I have current lines in .zshrc file, which I believe affects the emacs behavior it is using shell within:
stty eof undef
stty sane && stty erase "^H" intr "^C" eof "^D" susp "^Z"

When I press run elpy-find-file I get the following warning message. What may be the main cause of this? is there any way to fix it?

Setting current directory: No such file or directory,
/home/user/work_folder/stty: 'standard input': Inappropriate ioctl \
for device
stty: 'standard input': Inappropriate ioctl for device /

M-x shell-command+ and ls [enter]:

Following output show up on the mini-buffer.
stty: 'standard input': Inappropriate ioctl for device
stty: 'standard input': Inappropriate ioctl for device
files.txt
...

I believe emacs is using bash shell while zsh shell is active on the native shell.
=> Is it possible to resolve this conflict to fix the stty: 'standard input': Inappropriate ioctl for device error/warning?


texts: I'm new to Emacs and trying to change the color scheme so that there is no blue text on a black background, but when I try instructions online on how to do so, I keep getting [no match] error messages.


texts:
Is there a good way to manage multiple windows in a large frame?

I usually have one large frame, split into many windows, and I find that when I (or some command) visits a buffer, the choice of window that will display the buffer is somewhat random. Sometimes it chooses a window that I'd like to keep its current buffer, sometimes it makes a new window, etc. All reasonable behaviours, but a bit annoying.

The only resources I've found are display-buffer-alist and set-window-dedicated-p, but they are not very convenient. For example, if I make a window dedicated, then I can't make it show a different buffer without undedicating it by hand.

On the other hand, I can use display-buffer-alist to decide whether a buffer should make a new window/frame, or reuse or split some window, but it's difficult to control which window it uses. It mostly seems the use the least recently used window, but that's not a meaningful heuristic for my setup because I can easily have multiple important windows that I look at, but don't interact with.

Any suggestions?


texts: How to stop Emacs from interpreting a file name with `@` as an email address

texts:
If I try to open a file whose filename is ~/A/b/C@d.yaml, Emacs will interpret that I want to send an email to the address C@d.yaml, and in the minibuffer I have mailto:C@d.yaml.

What could I do so that I can keep @ in the filename?

I use helm-find-file if that matters.


texts:
What's the Evil Mode equivalent of these Vim commands?

nnoremap : ;
nnoremap ; :
vnoremap : ;
vnoremap ; :


texts:
Q: where do untracked .#files come from when working in a git repository?

When working on file example.txt in a git repository, I occasionally get an untracked file showing up in status titled .#example.txt (that is, dot-hash-filename).  (This happens both in magit's status buffer and when running git status from the command line, so it seems to be Emacs-related but not magit-related.)

What is causing the appearance of untracked files of this sort?  It does not appear to be a standard auto-save file (or at least I've never seen the .# prefix before.)


texts: Show contents just up to particular headline level in org mode

texts:
I know about the standard cycling commands here: https://orgmode.org/manual/Global-and-local-cycling.html but they don't seem to allow this.
I have a setup like
* A
** AA
Foo
*** AAA
Hidden
**** AAAA Hidden
*** AAB
Hidden
** AB
Bar
*** ABA
Hidden
*** ABB
**** ABBA Hidden
Hidden

I want to only see:
* A
** AA
Foo
*** AAA ...
*** AAB ...
** AB
Bar
*** ABA ...
*** ABB ...

The idea is to show children and contents only up to level 2 in this case (so you see level 2 contents, and level 3 headings). Ideally I would like to be able to specify P level headings and Q level contents, but, even just having a solution to this specific example would be great!


texts: How to highlight the compilation buffer?

texts:
I try to define a custom coloring of the compilation buffer, but I can not get the highlight correctly.

(add-to-list 'compilation-error-regexp-alist 'my-message)
(add-to-list 'compilation-error-regexp-alist-alist
  '(my-message
    "^\\(\\(ERRR\\|CRIT\\|ALRT\\|EMRG\\)\\|\\(WARN\\|NTCE\\)\\|\\(INFO\\|DEBG\\)\\) .*\\[\\(\\([^ \n]+\\):\\([0-9]+\\)\\)\\]$"
    6 7 nil (3 . 4) 5))

This correctly colors the hyperlink:

But I can not get the beginning of the line right. I would like the tags WARN, INFO, NTCE, DEBG and ERRR to have the same color as the hyperlink. But everything I tried did not work. I get either the error, that the match does not exists of the color for all lines is fixed.

How to color the beginning of the line in the same color like the hyperlink?


texts:
Platform: Windows 7, Emacs 24.2, Pandoc 1.17.2

Scenario: I am writing a markdown file in Emacs. I need to use pandoc to render the output, because it supports citations (using pandoc-citeproc).

Question: How can I preview a pandoc-rendered version (probably html) in another buffer simultaneously?


texts:
This is a simple question: how to set the antialias attributes in emacs? I am using GNU emacs 24.4 in windows 7. If I put this line in init.el:
(set-face-attribute 'default nil :font "Georgia 15" :bold nil :antialias nil)
Emacs will complain set-face-attribute: Invalid face attribute name: :antialias.
Neither can I find this option in customize interface.
Any help is appreciated!


texts: forward-to-word functionality with subword-mode

texts:
I frequently type camelCase variable names, and enjoy the features subword-mode offers.

This, this and this reiterate the fact that the community desires vim-like functionality where they can choose whether to go to the end of the current word, or beginning of the next word. One can use

forward-to-word from the misc package,
viper-forward-word from viper  or
evil-forward-word-begin from evil to achieve the same thing.

However using these mean that subword-mode will be overridden. I am guessing that the only way to have both would be to implement a function like subword-forward-to-word which combines the two functionalities. I lack the knowledge in elisp to do so, so I am asking for your help. How can this be done?


texts:
I want to perform some action before a prefix keymap is invoked.
Seems to me prefix keymap command is something different from normal commands that I cannot advise on it.
The following code gives commandp error.
(define-prefix-command 'my-some-map)
(let ((map my-some-map))
  (define-key map (kbd "+") '("↑h" . save-buffer)))
(global-set-key (kbd "C-c s") #'my-some-map)

(defun my-some-map-ad (&rest args)
  (message "custom actions such as perform a require"))
(advice-add 'my-some-map :before #'my-some-map-ad)

;; pressing C-c s fails with:
;; Wrong type argument: commandp, my-some-map


texts: starting emacs from the commandline and setting line wrap to 60 - howto?

texts:
I'm new with Emacs and come from Joe.

There I started editing mail from the command line by

joe -rmargin 60

because I don't want to generally set the right margin to 60.

I can't find a similar command-line option in Emacs.

Is there one somewhere?


texts: spacemacs: How can I disable flymake and flycheck completely, to speed up performance

texts:
I’m using spacemacs. I just installed syntax-highlighting layer and auto-completion layer, and now my emacs got really really slow.
So slow that going back to PyCharm (IntelliJ) with R-plugin feels waaay better again. initially, emacs had felt better with more freedom, after having slugged through IntelliJ for a few weeks.
The issue is that after installing: polymode, flycheck, autocompletion, poly-r, just to get rmarkdown support, the entire emacs for ESS (R) just feels like a complete slug. Like, 0.5X performance of IntelliJ (on a good day).
I am wondering if any tips on how to disable completely, FlyCheck and FlyMake?  I used SPC t s to toggle off FlyCheck, that helped a bit, but FlyMake still is slugging it in the background and highlighting my lines of code.
I really appreciate someone kindly developing a nice lintr for Emacs, but it really slows me down more than just eye-balling the code myself, at this point, in Emacs.


texts: How can I use my local Emacs client as the $EDITOR for remote machines I access over TRAMP?

texts:
I often use TRAMP to manage several remote servers, both for editing files and running remote shells in shell-mode. However, this does not work when a command uses the EDITOR variable to edit a file, such as crontab -e especially because shell-mode is a "dumb" terminal that does not support running another editor inside of it.

Locally, I do this with an appropriate call to emacsclient which opens up a new buffer and makes life very easy. Unfortunately, this does not work from the remote machine.

I guess I could use ed. (Hah!)

How can I set up a remote EDITOR that would let me edit files with my local Emacs instance?


texts:
By default, auto-fill will only break a line at a whitespace character. Usually this is what you want. However, I'm writing a major mode for editing data files (DNA sequences) that contain long lines of text with no spaces, and I want them to auto-fill at exactly 80 columns. How can I achieve this?

i.e., I want to use auto-fill (or similar) to fill this:

ACCATCGAAACTTTGAACGCAAGTTGCGCCTCAAGCCATTAGGTTGAGGGCACGTTTGCTTGGGTGTCATTCGTTATGTC

to this (using 20-character lines instead of 80 for a shorter example):

ACCATCGAAACTTTGAACGC
AAGTTGCGCCTCAAGCCATT
AGGTTGAGGGCACGTTTGCT
TGGGTGTCATTCGTTATGTC


texts:
Original Question

I am trying to use org-mode to remind me of whom I will have to follow up with, and when in a conversation with someone which topics I need to discuss with them.

My current plan is to query for TODO items that also have a specific value of the property WITH. The WITH property keys will be populated with my colleagues and clients names that I am working with on these tasks. To make it quick to retrieve this information, I thought of setting up a custom agenda view with an interactive user-input to fill in the keys for the WITH property.

I found documentation on how to setup "hardcoded" agenda views. How do I fill some parts of these queries with values provided by the user?

Background: I decided to try emacs for its org-mode a week ago. So I am quite new to emacs. I am try to explore as much of its potential as quickly as I can so I gauge whether or not emacs has the potential to solve my issues. So this question is potentially a mix of an org-mode specific and a generic beginners emacs question.

Intended Workflow

(I am adding this as requested in the comments)

Background

I am managing different projects and interface with various systems, clients and internal teams. Due to this there is no single system used by everyone that would make sure tickets can be filed and tracked. Often I get ad-hoc requests that I cannot complete in real-time for various reasons. If I cannot complete a request in real-time, I want to file it away and retrieve it on demand: when deadline approaches (easy), when looking for open internal or external requests, ideas (easy), or when I have a catchup with any involved party (the tricky bit)

Plan

My plan so far is to create TODOs with various stages. The exact TODO states are not important, but lets say they are: NEW_REQUEST, PROCESSING, BLOCKED | COMPLETED

These TODOs can be of various kinds. I was thinking of using tags for this, like: :inbound:outbound:internal:request:idea

Because essentially I am an (not very well defined) API between different parties and individuals, I want to log which individuals are involved in each request. This will allow me to follow up on any open task whenever I speak to any involved person. For this I was planning to use properties, specifically the WITH keyword as I was looking for a short signifier.

As an example, a task could look like:

* PROCESSING Alice: setup computer for Bob    :internal:request:
  DEADLINE: <2020-05-22>
  :PROPERTIES:
  :WITH: Alice, Bob
  :END:

I will configure org-capture to make it fast to create such a task. I can use / configure the agenda to show me tasks by completion based on deadline and tags.

However, I have regular catchups with most people I interface with on regular intervals (which might be weekly). For non-urgent tasks I want to batch up all my requests that involve a person when I meet them anyway. If I have to report to anyone, I want to be able to get all their tasks and report what the status of the tasks they gave me is.

Because this system needs to scale to 20+ people, multiple TODO states and tags, hardcoding all the combinations is impractical. In the same time retyping the match-strings all the time is not practical either. But something inbetween would potentially possible.

I can define a few template searches I regularly need. For instance open tickets that are inbound involving person XXX:

TODO="-CLOSED"+inbound+WITH="XXX"

Since C-c a m asks the user for the match string, I thought I could do the same. The user would just need to navigate to the custom query, and type in Alice and an agenda view TODO="-CLOSED"+inbound+WITH="Alice" would get created.

This is is what this question was about. I have tried setting org-agenda-custom-commands and it does work for static queries. But I cannot find out how to add a user-prompt to it. (might not be possible, as one of the answerers pointed out)


texts: Org mode subtitle not being exported to pdf

texts:
#+TITLE: My title
#+SUBTITLE: My subtitle

* Blah blah blah

My subtitle isn't being exported, anyone know why?

LaTeX export: https://pastebin.com/Wg2gVS12


texts:
(dolist (face '((org-level-1 . 1.2)
                (org-level-2 . 1.1)
                (org-level-3 . 1.05)
                (org-level-4 . 1.0)
                (org-level-5 . 1.1)
                (org-level-6 . 1.1)
                (org-level-7 . 1.1)
                (org-level-8 . 1.1)))
  (set-face-attribute (car face) nil :font "Cantarell" :weight 'regular :height (cdr face)))

when I evaluate this code, emacs doesn't complain but when I load a new instance of emacs it gives me an error of: error: Invalid face, org-level-1.
emacs: v27.1, org: v9.3


texts:
I have the following code to replace default eldoc display function:

(defun my-eldoc-display-message-momentary (format-string &rest args)
    "Display eldoc message near point."
    (when format-string
      ;; (pos-tip-show (apply 'format format-string args))
      (momentary-string-display
       (apply 'format format-string args)
       (save-excursion (forward-line) (point))
       )
      ))

(setq eldoc-message-function #'my-eldoc-display-message-momentary)

But it does not work smoothly.

it display slowly
the exit-char for momentary-string-display should be excepted in most
programming code inputting (not SPC, not [a-zA-Z], not [*,-+=!] etc)

Hope someone can improve it.


texts:
orgmode file links can contain additional information to link to particular places within a file, i.e.:

[[file:~/code/main.c::255]]

opens main.c and jumps to line 255. Is it possible to accomplish this with non-file links? I'm particularly interested in links to man pages, provided via org-man. I'd like to be able to link directly to a line or heading within a long man page, such as man bash.

The following doesn't work:

[[man:bash::144][bash manual line 144]]

[[man:bash::OPTIONS][bash manual options section]]

Is it possible to define a link handler to incorporate searching as is done with the built-in file links?


texts: How to combine the history of isearch and query-replace?

texts:
I often use isearch (C-s normally or / in evil) and then want to use that query (or part of it) for replacing. This answer explains how to cycle history, but M-p cycles the history for each mode separately so I don't see isearch queries from query-replace.

Ideally, the query I used for either search is automatically saved and I can use a key binding to insert the query into a buffer or minibuffer.

Example: search for "fib-function", C-h f and insert "fib-function" for help, or helm-do-grep to search for it in files, or just insert it into the current file to start defining it.


texts: Replace text inside various delimiters (eg: brackets, quotes)

texts:
I often do some testing implementation with hardcoded values which I later want to change. Like

ref = open('specific-file-name')

Which I would like to change into

ref = open(fname)

I'm used to vim and there I can type ci(fname assuming that point is inside the brackets. (ci( stands for replace inner brackets).

How can I achieve something like 'replace inner ' in emacs?


texts: org export processes code blocks even if located in noexport headline

texts:
EDIT 1 : a more simple use case

For this org file content:

* Headline 1
  - Something to export

* Headline 2      :noexport:
  #+begin_src python :results none :exports none
  def foo():
      pass
  #+end_src

A simple html export (C-c C-e h o) leads to a processing of the python code block event if it is located in a noexport section: org-babel-exp process python at position 116...

Since I have hundreds of code blocks under non exported headlines, this leads to non useful long processing times. Is it possible to avoid this ?

Initial Question:

I have the following problem: I use a selective export with tags thanks to the following code:

#+name: myexporter
#+BEGIN_SRC emacs-lisp
(defun myexporter (tags filename)
  (let
      ((org-export-select-tags tags) (async nil) (subtreep nil) (visible-only nil) (body-only nil) (ext-plist '()))
      (org-export-to-file 'html filename async subtreep visible-only body-only)))
#+END_SRC

#+name: selectiveexport
#+BEGIN_SRC emacs-lisp :noweb yes
<<myexporter>>
(myexporter '("bar") "bar.html")
#+END_SRC

This code enables to select all sections with tag :bar: and export them to an html file called bar.html.

My problem is that when I call the selective export all code block are systematically processed (and I have a lot in my file which makes the selective export quite slow).

For example, with the following org file

* Test :bar:
  - Bla, bla

* Foo
  #+name: foo
  #+begin_src python :results none :exports none
  def foo():
      pass
  #+end_src

the selective export leads to the following messages :

executing Emacs-Lisp code block (selectiveexport)...
org-babel-exp process emacs-lisp at position 21...
org-babel-exp process emacs-lisp at position 337...
org-babel-exp process python at position 796...
Saving file [...]/bar.html...

My problem is the org-babel-exp process python at position 796 that I would prefer not to be executed. I precise that it is executed even if a :noexport: tag is assigned to section Foo.

Is it possible to avoid this processing step ?


texts:
I want to sleep until a predicate is true, without blocking the rest of Emacs from executing.

For example:

(defun clock-striking-one-p ()
  (eq clock 1))

(defun hickory-dickory-dock ()
  (run-up-clock)
  (sleep-until clock-striking-one-p)
  (run-down))


texts: Is it possible to define codepage for tangled file while Org-mode tangle?

texts:
Subj. I want to tangle file to be in different codepage than viewed Org file.
Didn't find any header agruments for encoding :(


texts:
I love helm and try to utilize it whenever possible.  Naturally, I have bound M-x to M-x-helm.  For the most part, this has not caused any problems for me.  However, I have noticed that it appears to be interfering with sql-sqlite.

When I try to execute this command, it prompts me for the path to the sqlite database.  Normally, helm allows me to traverse the directory structure and find the file I would like.  But when it comes to sql-sqlite, it limits me to the files in the current directory.  If I try to manually type in the path, I just get the error "No Match".

If I instead run execute-extended-command, I am able to navigate to the appropriate path and proceed without issue.

Has anyone else experienced this problem before, or have recommendations on how to address / debug it?

I'm not sure that it matters, but here is my configuration and a link to the relevant helm setup.


texts: How to extract some text from within HTML code?

texts:
I have this string in an elisp variable

Country: United States
<a href

I want to extract out the United States in to a separate variable.
How can I do that?

In ruby I do

str=~/
(.*?)</; var2=$1

I read already:
https://www.gnu.org/software/emacs/manual/html_node/elisp/Regexp-Search.html


texts:
At the moment I am killing the Python interpreter with C-d each time I want to quit Python interpreter.

What is the name of the function to kill the Python interpreter in Python mode (the one which comes with Emacs) so that I can bind it to a key command?


texts: Unable to configure gnus with openmailbox server

texts:
I want to use gnus for reading and sending mails from my openmailbox address via IMAP, but can't configure it properly.

In /.gnus.el I wrote

(setq user-mail-address "email@openmailbox.org"
      user-full-name    "My Name")

(setq gnus-select-method
      '(nnimap "openmailbox"
           (nnimap-address "imap.openmailbox.org")
           (nnimap-server-port "imaps")
           (nnimap-stream ssl)
           (nnimap-authinfo-file "/home/user/.authinfo.gpg")))

(setq smtpmail-smtp-server "smtp.openmailbox.org"
      smtpmail-smtp-service 465)

and in /.authinfo.gpg

machine imap.openmailbox.org login <LOGIN> password <PASSWORD> port imaps
machine smtp.openmailbox.org login <LOGIN> password <PASSWORD> port 465

but when I'm trying to log in it gives me the following error

  nnimap (openmailbox) open error: 'NO (AUTHENTICATIONFAILED)
  Authentication failed.' Continue? (y or n)

I also tried with port 587 but it fails with the same output.

Can anybody help me to configure gnus? You can find all necessary protocols on openmailbox website.


texts: How to automatically run a command when cursor is at bottom of visible frame?

texts:
The recenter command in emacs is recenter-top-bottom which I can invoke using Ctrl-l. How can I call this command automatically every time the cursor is on the fifth-last line in the visible frame?

[Context]

I am manually editing one column in a large csv file with 4000 rows and I have turned on overwrite mode and I have remapped the 0 and 1 keys so that they automatically add a new line, like this:

(local-set-key (kbd "1") (lambda () (interactive)
 (self-insert-command 1) (next-line) (left-char)))

So I don't have to press any arrow keys. One last thing that I want to automate is the recentering.


texts:
With some regularity, I am using bash with M-x shell, and out of muscle memory I hit C-c C-c, with dramatic results:

the comint prompt streams a long error message with a large number of escaped characters;
several files are created in the working directory with only escaped characters in the name.

Is there any way to send a kill signal to the prompt from within comint-mode, similar to what is triggered in a normal bash terminal with C-c C-c?

Edit: this is in Emacs for OS X Modified, and it only happens sometimes when I press C-c C-c in shell-mode


texts:
In my init file, I have C-) bound to a smartparens "slurp" command. This works great on linux, but when I try to use the same keybinding on my Windows machine, nothing happens.

To troubleshoot on my Windows machine, I've tried C-h c followed by C-)—emacs doesn't register that any keys have been hit.

I've tried a couple of similar key sequences: M-) and C-0 both register fine.

Any idea why C-) doesn't register, and any idea how to fix it?


texts:
I was wondering if are existing tools or package to write C++ (or other langage) code from lisp.

For example, this afternoon I needed to create 4 basic classes:

class D{
public:
    D(){
    }
};

class C{
public:
    C(){
    }
};

class B{
public:
    B(){
    }
};

class A{
public:
    A(){
    }
};

Using lisp it would be fairly easy to create a function that takes as an argument the class name and generate the template code from one instance:

class $TAG{
public:
    $TAG(){
    }
};

where $TAG is going to be replaced by the class name.

I am not really looking at the exact lisp code to produce this because I can code it myself but rather at a package about this philosophy and with extra stuff I haven't thought of.

Please share your thoughts


texts: Projectile: show project open buffers when switching project

texts:
I have a very large project and generally I work on multiple related projects simultaneously. While switching project I have to type full name everytime (multiple similar named files under different directories) to open a buffer which was already opened earlier as helm-projectile-find-files doesn't show already opened buffers.
  How do I make projectile-project-switch-action to display and filter both project open buffers and rest of the project matches.

When I was using spacemacs I remember having this kind of behavior. I use prelude now.

Eg:
project p1 has pp1, pp2, pp3 ...
Project a1 has aa1, aa2, aa3...
Project x1 has xx1, xx2, xx3...

Now assume I have 2 windows win1 and win2.
In win1 I have pp1 opened and in win2 aa1 is opened
Now I switch to project x1 in win1 and open file xx1
Now after viewing the file I try to switch back to project p1 in win1. After selecting project from projectile-switch-project projectile list me with all the files of p1 - pp1, pp2, pp3... to select a file and open it.
Now since I have already opened pp1 earlier if I could see a list of open buffers along with project files I could save some time.


texts: How to have a remote terminal inside Spacemacs, like a PuTTy within Emacs?

texts:
My question is about mimicking PuTTy inside Spacemacs in Windows, not about using Spacemacs via PuTTy.

That is, I am interested in learning whether it is possible to open within Spacemacs a remote terminal such that I could do within Spacemacs what I currently do in PuTTy. I know that one can work on remote files, by using the built-in TRAMP layer and doing something like C-x Cfand entering the remote address (e.g. /ssh:myusername@hostaddress:root/home/myfile.txt.

However, I never found anything about how to open just the remote terminal from the server being connected to. Is that even possible?


texts: How to customize visualization blank mode

texts:
I use blank-mode

I don't want the newlines to be displayed how can I turn it off.

Also long lines are shown in dark background how can I turn that off.

In fact I only want to display trailing whitespace, that gives me error on eslint.


texts: How can I make the cursor place properly when hitting enter inside an empty object, without exiting "insert mode"

texts:
This is mainly for js2-mode, but would love to have it in python or other programming languages as well.
I would like to have the cursor placed as seen in the below image when hitting enter inside an empty object "{}". It's default behavior is placing the cursor at the end, and I have to manually go to command mode / go up / insert mode / and set the object. (I am using evil-mode).

I think this is the default in VsCode, but I'm not exactly sure. Can this be done in emacs?


texts: How to export org subtree as nested / HTML list?

texts:
I have a section of an org-file where there are only headings with no content within them, each line is a (sub)heading.

* heading 1
* heading 2
** heading 2.1
** heading 2.2
*** heading 2.2.1
* heading 3

I want to put the point at a subtree, type a command, and have a buffer open up with (or copy to clipboard) that subtree converted to HTML. Not to a whole HTML file with , , styles, etc., just a short snippet like

heading 1

    heading 2

heading 2.1

        heading 2.2

heading 2.2.1

heading 3

Basically remove the *s and mimic the tree structure in HTML, no need to process anything beyond that like turning /italics/ into s or anything like that.

Is there something ready that does that, or how would I go about doing it in Emacs Lisp?


texts: Configuring web-mode for Vue.js (.vue) files

texts:
It seems that web-mode has supported Vue.js since May 2017, the "Venora Release".

Configuring Emacs to handle Vue.js files (extension .vue) is as easy as writing

(add-to-list 'auto-mode-alist '("\\.vue\\'" . web-mode))

in one's .emacs file.

But web-mode does not like the <template> tag. What is the right .emacs setup/config?


texts:
I'm using emacs I downloaded from http://emacsformacosx.com/, but it doesn't display the file type icon for some file types like plain text file, in the title bar. How can I make it appear?

What I mean by "file type icon" is like the blue c++ icon in the title bar of the frame in this picture


texts: Track org-mode headlines separately with version control

texts:
I want to setup a personal wiki in Emacs org-mode. And I want to put this under version control, so that I can see the history of each article, as it evolves.

If I use a single file for my wiki, with top-level headlines denoting articles, how can I track each article individually, using something like Magit?


texts: auto-fill-mode without automatic indentation

texts: Is it possible to prevent auto-fill-mode from automatically indenting new lines according to the previous?  I would like new lines to begin at column 0 regardless of the previous line's indentation.


texts: How do I get the date range of the current org-agenda view in elisp?

texts:
I'm trying to get org-agenda to behave a bit more like a paper day planner, and have it only show deadlines on the day that they're due, rather than carrying them forward when they're overdue. So far, I've created a custom org-agenda view as follows:

(defun org-agenda-skip-deadline-if-not-today ()
  (ignore-errors
    (let ((subtree-end (save-excursion (org-end-of-subtree t)))
          (deadline-day
            (time-to-days (org-time-string-to-time (org-entry-get nil "DEADLINE"))))
          (now (time-to-days (current-time))))
      (and deadline-day
           (not (= deadline-day now))
        subtree-end))))

(setq org-agenda-custom-commands
  '(("b" agenda "Today's Deadlines"
    ((org-agenda-span 'day)
     (org-agenda-skip-function '(org-agenda-skip-deadline-if-not-today))
     (org-agenda-entry-types '(:deadline))
     (org-agenda-overriding-header "Today's Deadlines")))))

However, this only shows the agenda entries for today. What I would like to do is pass into org-agenda-skip-deadline-if-not-today the date range of the current agenda view, and have it exclude subtrees whose deadline lies outside of that range.

Is it possible to do that with elisp? I've looked at the org manual for custom agenda views, but I haven't been able to find out get the date range for the current agenda view.


texts: nxml: Indent tag attributes on new lines 4 characters, not below attribute on parent line

texts:
I put attributes for XML tags onto a new line when the tag line gets too long:

<flux:field.inline.fal name="settings.image" required="1"
    maxItems="1" minItems="0" collapseAll="1"
    allowedExtensions="jpeg,jpg,png" />

nxml is configured with nxml-attribute-indent=4.

When pressing enter/return on the first line, emacs automatically puts the cursor directly under the beginning of the first attribute on the parent line:

<flux:field.inline.fal name="settings.image" required="1"
                       |

I'd like that to be 4 characters indented from the parent line:
ibute on the parent line:

<flux:field.inline.fal name="settings.image" required="1"
    |

How can I achieve that?


texts:
After doing an some emacs packages updates, every time a new file is opened the buffer has whitespace mode turned on. I see red on all the whitespace at the start of lines. I've tried disabling whitespace-mode, but can't change this behavior from happening on every new buffer.

Is there someway to make sure whitespace-mode is disabled on new buffers?


texts:
How does eshell resolve its PATH?
If I run my top in eshell on my local machine, it opens a new buffer and shows the output of the command in it. However, if I do the same on an eshell run on a remote machine I get:
/ssh:remote:/home/me/ $ top
----- in *top* bugger -----
..: 1: exec: /ssh:remote:/bin/top: not found

Process /ssh:remote:/bin/top exited abnormally with code 127

I certainly do have top on the remote machine and it is in /bin/top.


texts:
Trying to store all auto-save files in a single dir, i.e. ~/.emacs.d/autosave/
I have read the emacs manual on autosave
I have read the emacs wiki on placing auto save file in one place

From this post, I learnt the dir name must end with a /. I have read many other posts on this site but none of them are of help.

I am only setting auto-save-file-name-transforms in one place.
I have read countless posts where they just say place this in your init.el file:

(setq auto-save-file-name-transforms '((".*" "~/.emacs.d/autosave/" t)))

I check it with:
buffer-auto-save-file-name
And its always prints (for example for my init.el file):

/home/me/.emacs.d/#init.el#

I have seen so much flaky renderings with buffer-auto-save-file-name. I am not sure what is going on and I can't build something reliable after 2 days of searching.

Using Ubuntu 18.04 and Emacs 26.3


texts: Exporting a figure generated with org-babel and noweb reference syntax

texts:
Wanting to export a figure generated by matplotlib to LaTeX (as described here) I've encountered the following issue (which ultimately I was able to solve as described here).

My source block has two noweb syntax references

#+HEADER: :var path="./fig.png"
#+BEGIN_SRC python :exports results :results file :noweb yes
<<get-modules>>
x = np.random.normal(0, 1, 100)
<<plot-figure>>
#+END_SRC

where get-modules and plot-figure are defined in the commented headline named Source blocks

* COMMENT Source blocks

   #+NAME: get-modules
   #+BEGIN_SRC python
   import numpy as np
   import matplotlib.pyplot as plt
   #+END_SRC

   #+NAME: plot-figure
   #+BEGIN_SRC python
   plt.plot(x)
   plt.savefig(path)
   return path
   #+END_SRC

The code works properly and after executing (with C-c C-c) I get

#+RESULTS:
[[file:./fig.png]]

Unfortunately, while exporting my document to LaTeX instead of default

\includegraphics[width=.9\linewidth]{./fig.png}

I have just

\url{}

This problem does not occur when I give up noweb references, so

#+HEADER: :var path="./fig.png"
#+BEGIN_SRC python :exports results :results file
import numpy as np
import matplotlib.pyplot as plt
x = np.random.normal(0, 1, 100)
plt.plot(x)
plt.savefig(path)
return path
#+END_SRC

works as expected, but I would like to achieve this with noweb references.

I use org 8.3.4 version.


texts: What is the difference between contrib/lisp and lisp?

texts:
I have both of these folders for my load paths, what is the difference?

~/.emacs.d/contrib/lisp/ vs ~/.emacs.d/lisp/

What should I use one versus the other?


texts: How do I change the value of author name in org-publish?

texts:
Can I specify the value of author used in org-publish?
So far I can see that it is possible to exclude it but how do I change it?
(setq org-publish-project-alist
    '(("org-project"
       ...
       :with-author nil
       ...)))

Update:  I can see that it comes from the user-full-name variable.  If I edit that then the name will change.  Is it possible to do this in any other way instead?


texts: recurring event on weekend day or bank holiday, change to next working day

texts: If there is a recurring event on weekend day or bank holiday, if there a way to change it to next working day?


texts:
In my mu4e setup, is there a way to have helm handle the "jump to maildir" list?

I am aware of the package helm-mu but it does not seem to have this functionality.


texts: Autocomplete and company completes the word . But is there any package which helps predict the next word expected in the sentence.


texts: How to search for a sequence of bytes in hexl-mode?


texts:
I use the standard grep command a lot. When I execute it, the minibuffer is populated with the following the text, allowing me to complete the command:
Run grep (like this): grep --color -nH --null -e

I almost always prefer to use Perl regex and ignore casing, so I'm finding myself replacing the last argument very often like so:
Run grep (like this): grep --color -nH --null -Pi

I would like to change the behavior of grep so that it loads with the argument -Pi instead of -e by default.
When I use describe-function and inspect grep, I can see the lines (in /usr/share/emacs/26.3/lisp/progmodes/grep.el.gz) that define this behavior. Beginning line 650, there is a codeblock like so:
      (let ((grep-options
         (concat (if grep-use-null-device "-n" "-nH")
                     (if grep-use-null-filename-separator " --null")
             (if (grep-probe grep-program
                     `(nil nil nil "-e" "foo" ,null-device)
                     nil 1)
             " -e"))))
       (...

How do I override these grep-options in my Emacs config? I cannot find a variable named grep-probe or grep-options which I could just overwrite, for example, so what's the best practice then?


texts: Process shell exited abnormally with code 53 on windows 10

texts:
I'm using emacs 26.2 installed through msys2.
Recently starting subprocesses from emacs has stopped working for me. Specifically M-x shell and shell-command-to-string.
I get the feeling this is due to a windows update or something since I didn't update emacs when this problem started occurring.
I'm on the Windows 10 beta channel running version 20H2 at the moment.
Now when I do M-x shell I get this error message: Process shell exited abnormally with code 53.
If I call shell-command-to-string I just get an empty string as a reply. No matter what the argument.
Has anyone else seen this problem?


texts: automatically use evil for ibuffer and dired

texts:
I am switching from vim to emacs and have evil installed. Mostly evil runs perfectly, but after starting emacs the first time and running ibuffer or dired I have to turn on evil-mode (C-z). This is really annoying as I often restart Emacs and assume that I can use vim-Bindings when opening dired or ibuffer.

So how can I always have evil-mode turned on by default?

This question seemed to be leading to the right direction, but I could not get it working.


texts: Use a specific font face for gdb buffers

texts:
Need

Default emacs font for most buffers is okay.
But for coding-related activities I need a smaller, crisp font.

What works

In the spirit of Is it possible to change the font size in specific buffers? - Emacs Stack Exchange
I've followed
https://www.emacswiki.org/emacs/FacesPerBuffer
and it works for most modes.

Those work very well:

(add-hook 'emacs-lisp-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'graphviz-dot-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'text-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'c-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'c++-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'objc-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'cmake-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'compilation-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'shell-dirtrack-mode-hook 'my-buffer-face-mode-fixed)
...(and many others)...

What fails

When using M-x gdb, a multi-buffer interface appears, and I can't set the font for them.

describe-mode reports Gdb-Many-Windows and many others.

So I added

(add-hook 'gdb-many-windows-hook 'my-buffer-face-mode-fixed)

But it had no effect.

Then browsed https://github.com/Hawstein/my-emacs/blob/master/_emacs/multi-gdb-ui.el and added all the lines below, to hook, well, on every hook visible in that source code:

(add-hook 'prog-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'gdb-local-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'gdba-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'gdb-breakpoints-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'gdb-frames-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'gdb-threads-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'gdb-registers-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'gdb-memory-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'gdb-info-locals-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'gdb-locals-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'gdb-assembler-mode-hook 'my-buffer-face-mode-fixed)
(add-hook 'global-ede-mode-hook 'my-buffer-face-mode-fixed)

Still no effect.

It's tedious to manually change font every time in the ~5 buffers at each gdb invocation.

What now?

How to set font for gdb emacs interface buffers?


texts: How can I create custom menu prompts in elisp?

texts:
I have two elisp functions:

$ cat ~/myelisp/myoptions.el

(defun get-my-name (arg)
  "Prompt user to enter a string, with input history support."
  (interactive
   (list
    (read-string "Enter your name: ")))
  (message "Your name is %s." arg))

(defun get-my-directory (arg)
  "Prompt user to enter a file path, with file name completion
and input history support."
  (interactive
   (list
    (read-file-name "Enter your directory: ")))
  (message "Path is: %s" arg))

I'd like to organize these functions into a menu. Ideally, I would like to be able to issue something like M-x my-info and have a buffer pop up displaying something like

Press key for command:
----------------------
n Get user's name
d Get user's directory

q quit

Of course, pressing n should call get-my-name and pressing d should call get-my-directory. I've seen similar menus in many emacs packages (like org-agenda, for example). Is this menu easy to code in elisp?


texts:
In the spacemacs documentation for writing layers, it says that "[o]nly one layer may own a package". This has the consequence, that if you write a layer that requires a package, you have to know whether you can claim ownership of it by writing a <layer>/init-<package> function, or if you have to use the post-init function for the package to avoid seizing "ownership of a package that was owned by a previously enabled layer".

Is there a function in spacemacs, that takes a package name and tells you if it is owned by any standard spacemacs layer? I know that you technically only need to know if the package is owned by a previously enabled layer, but such a function would also help prevent writing unnecessary code.

In case it's of interest, in my particular case, I'm interested in polymode.


texts:
I get the following in my minibuffer and I want to disable these basic help messages. Anyone know how?

Type C-x 1 to delete the help window
Type "q" in help window to restore it's previous buffer

Looks like it comes from help-window-display-message.


texts:
When exporting, links are converted to the relevant format. Is it possible to tell org to simply ignore links and only export their text? (that is, completely ignoring the link, not including it as plain text)

My case is for exporting to Markdown, but I believe a solution should apply to all export back-ends.


texts: inhibit-read-only affects all buffers when *Backtrace* buffer is open

texts:
I use buffer-read-only as a safety measure for anything that is important.  Recently, I have been debugging functions that use inhibit-read-only and I leave the *Backtrace* open to go about my business and go back to the *Backtrace* buffer from time to time.  This unfortunately disables read-only in all open buffers.

Q:  How can I leave the *Backtrace* buffer open and still keep all other buffers just the way they were (i.e., read-only)?

(let ((inhibit-read-only t)) (error "stop"))

EDIT:  Here is the link to the bug report:  http://debbugs.gnu.org/cgi/bugreport.cgi?bug=26947


texts: How do I speed up org-mode agenda generation

texts:
It takes several seconds for Emacs org-mode to generate my agenda. How can I make it faster? I'm already using archive files, and I have less than 30 .org files, all of them reasonably short.

Partial profiler output of the org-agenda command:

+ ...                                                              93  50%
- command-execute                                                  90  49%
 - call-interactively                                              85  46%
  - org-agenda                                                     80  43%
   - byte-code                                                     80  43%
    - call-interactively                                           79  43%
     - org-agenda-list                                             79  43%
      - byte-code                                                  79  43%
       - org-agenda-prepare                                        68  37%
        - org-agenda-prepare-buffers                               67  36%
         - byte-code                                               67  36%
          - org-get-agenda-file-buffer                             67  36%
           - find-file-noselect                                    67  36%
            - find-file-noselect-1                                 67  36%
             - after-find-file                                     66  36%
              + run-hooks                                          35  19%
              + normal-mode                                        30  16%
              + auto-save-mode                                      1   0%
             + normal-backup-enable-predicate                       1   0%
        + org-agenda-files                                          1   0%
       + byte-code                                                 10   5%
         org-days-to-iso-week                                       1   0%
    + org-agenda-get-restriction-and-command                        1   0%
  + byte-code                                                       4   2%
  + minibuffer-complete                                             1   0%


texts:
I saw many post about use org mode to post blog with Jekyll. one method is use emacs to export html with some modified publish function, another method is use a Jekyll plugin to call Org mode API do it directly.

But after some try, both mode not work as expected. method 1 will handle the inline pictures but the output is totally in to the root directory, but I wish it been export to separate directory blog by blog. method 2 actually didn't handle inline pictures at all, so the output html will not include the inline image.

What's the best way to write blog with org mode for Jekyll?


texts: How do I perform a sequence of actions with a single keybinding?

texts:
i am using cider.  I want to do the following: when I finish editing in a source buffer, I want to compile the source and execute it in the repl, all with a single key-binding.

In cider-mode, compiling source can be done by C-c C-k or M-x some-function, so the workflow is basically like this: C-c C-k, C-c C-z (switch to repl buffer), and type and execute my-function.  How do I bind all the actions together and popup the repl buffer with results?


texts: Create a minor mode only for prog-mode major modes

texts:
I am working on a minor-mode and I'd like it to be active only for major modes derived from prog-mode.

So far I know that the macro define-minor-mode takes a argument :global to decide whether or not the mode should be global.  But this is too general.

And I'd like not requiring the user to set-up the mode itself with a hook à la:
(add-hook 'prog-mode-hook (lambda () (my-minor-mode t)))

Thanks


texts: Deleted package doesn't reappear in the package list

texts:
I just deleted magit, but it doesn't reappear in the list as available. I typed g and r, restarted emacs, to no effect. It's not hidden. I use C-s to search for it in the buffer. Supposedly its dependencies are installed:
async              1.9.4         dependency Asynchronous processing in Emacs
dash               2.17.0        dependency A modern list library for Emacs
ghub               3.3.0         dependency Minuscule client libraries for Git forge APIs.
git-commit         2.90.1        dependency Edit Git commit messages
magit-popup        2.13.2        dependency Define prefix-infix-suffix command combos
treepy             0.1.1         dependency Generic tree traversal tools
with-editor        2.9.2         dependency Use the Emacsclient as $EDITOR

The relevant part of the ~/.emacs is supposedly:
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-selected-packages (quote (magit))))

And there's no magit directory in ~/.emacs.d/elpa.
I didn't delete magit directory by hand. Supposedly I did d x in the list-packages buffer.
I'm running Emacs 26.3.


texts:
Hello I am new to Emacs and I am currently using it for web development projects. I am currently using Laravel and VueJS on my development. I search online what is the best major mode for this web development tools. I found out that web-mode is good for this.

But as I code I found out that it didn't detect.That I have a missing > on my html tags.

As you can see above I have a missing > on my div. But the syntax highlighting below it is still the same.

I was using Sublime text 3 before and it has the functionality.

I wan't something like Sublime text 3. that can detect missing > and it will display different syntax highlighting below it.

I really want this functionality because I am coding html most of my works.

What is the tool that is good for this on Emacs?

EDIT:
This file is a .vue file. Which is a component file for VueJS.


texts: How to disable the hollow box cursor in auto completion buffer?

texts:
When you hit Tab  in M-x for auto completion, the buffer comes up with options as well as a hollow  box cursor. Is that really required? I don't find it intuitive because I can't actually navigate in that buffer anyway and I usually hide all non selected window cursors using

(setq cursor-in-non-selected-windows nil)


texts: org-mode text expansion macro in src block

texts:
Is it possible to use an org-mode #+MACRO: in an org-babel block?
I'm getting this in the #+RESULTS: block when I evaluate the src block with C-c C-c:
    #+MACRO: COMPILE_FLAGS -std=c99 -Wall -Werror -pedantic
    #+begin_src shell
    echo $"{{{COMPILE_FLAGS}}}"
    #+end_src

    #+RESULTS:
    : {{{COMPILE_FLAGS}}}

But I expected this:
#+MACRO: COMPILE_FLAGS -std=c99 -Wall -Werror -pedantic
#+begin_src shell
echo $"{{{COMPILE_FLAGS}}}"
#+end_src

#+RESULTS:
: -std=c99 -Wall -Werror -pedantic

The org-mode documentation does not hint that source blocks are treated differently, so am I doing this wrong, or should I use a different approach?
EDIT - I just realized that macro expansion is listed under "exporting" so maybe that's my problem... I am evaluating a code block, not "exporting" a document. But I'd still like a solution to replacing the macros when evaluating a code block.


texts: Emacs fails to open gnuplot files with extension .gp

texts:
May I get some help understanding what it is that Emacs does not like about the extension .gp

Using emacs 24.5.2 on Mac OS X 10.13.6
I get the following error message when I try to open a file with extension .gp.

Debugger entered--Lisp error: (file-error "Cannot open load file" "no such file or directory" "gnuplot")
  gnuplot-mode()
  set-auto-mode-0(gnuplot-mode nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer gpiofl.gp> "~/gpiofl.gp" nil nil "~/gpiofl.gp" (8739733818 16777220))
  find-file-noselect("/Users/cizmas/gpiofl.gp" nil nil nil)
  find-file("/Users/cizmas/gpiofl.gp")
  command-line-1(("gpiofl.gp"))
  command-line()

In this case, the file name is gpiofl.gp.  If I change the extension to .gnuplot, all is fine.


texts: How to fix multiline-string indentation in python-mode?

texts:
When adding the docstring to a fuction

def func():
    """|"""

After pressing RET I have this

def func():
    """
"""

Instead of this

def func():
    """
    |
    """

| is a cursor.


texts:
I want to customize cc-mode to execute a function before saving. One solution would be to modify cc-mode keymap to bind C-x C-s to a function which performs the work I need and then saves it.

My question is whether there is a hook I could customize for this? The CC Hooks docs don't mention a before-save-hook specifically for cc-mode. How should this be done through a hook?

Alternatively, how do I do this through defadvice? From reading the manual, the only way I could see was to enable the advice before saving and then disable after the work is done. This sounds cumbersome. What would be the idiomatic way of using advices?


texts: How do you create a robust Python IDE with Emacs (as the Text editor)

texts: Emacs is an excellent editor - however it is said "to program you first need an IDE" - so how would you build an IDE in the extensively customizable  Emacs for PYTHON with all the features of modern IDE. I want to be able to effectively debug, run and compile, and manage code. Thus far I have read up on the subject I have installed the Elpy package but am unsure of what else need to know and do to in order make this possible.


texts:
If I spawn Emacs in --daemon mode, I can then use emacsclient to connect to the daemon from within a terminal window.  If this then dies, I can reconnect my terminal and my Emacs session is still available.

The only problem with this is that whatever window layout I had previously configured is not preserved.  If I'm working on a flakey connection it becomes tedious having to partition up my screen with the window layout I want on each connection drop.

I am aware of commands such as

C-x r f – frame-configuration-to-register
C-x r j – jump-to-register

Which should make it possible to save and reload a frame configuration.  Whilst these work fine in normal mode, in daemon mode I find that the results are very unpredictable.

Sometimes it just looses the layout!  Also you end up having to remember to save the layout and exit using C-x 5 1 or multiple C-x 5 0, which kills the underlying emacsclient window without killing the underlying daemon.

There must be something better!

Firstly - is the daemon/client layout behaviour buggy, or am I misusing it somehow?

Secondly - Is there a stable way of automatically/seamlessly preserving your window layout between connections to an Emacs daemon?


texts: Issuing M-x org-agenda a v y allows me to view my agenda for the current year. Is it possible to view my agenda for next year? More generally, is it possible to view my agenda for a specific year or for a specified block of time?


texts: How to remove cause of an error in loading .emacs: Symbol's function definition is void: defvar-local

texts:
When starting Emacs 23.3.1 under Ubuntu 12.0.4.5 LTS, I get the following message:

Warning (initialization): An error occurred while loading `/home/john/.emacs':
Symbol's function definition is void: defvar-local

When I restart with emacs --debug-init, I get the following response:

Debugger entered--Lisp error: (void-function defvar-local)
  (defvar-local ess-dump-object-function nil "When defined this function is called by `ess-dump-object'.")
(progn (defvar-local ess-dump-object-function nil "When defined this function is called by `ess-dump-object'.") (defun ess-dump-object (object filename) "Dump the ESS object OBJECT into file FILENAME.\n\nUse `ess-defmethod' to define dialect specific overrides." (let ... ... ...)))
  (eval-and-compile (defvar-local ess-dump-object-function nil "When defined this function is called by `ess-dump-object'.") (defun ess-dump-object (object filename) "Dump the ESS object OBJECT into file FILENAME.\n\nUse `ess-defmethod' to define dialect specific overrides." (let ... ... ...)))
  (ess-defgeneric ess-dump-object (object filename) "Dump the ESS object OBJECT into file FILENAME." (let (...) (if ... nil ...) (:override ... ... ... ... ... ... ... ... ...)))
  eval-buffer(#<buffer  *load*<4>> nil "/usr/share/emacs/site-lisp/ess/ess-mode.el" nil t)  ; Reading at buffer position 44237
  load-with-code-conversion("/usr/share/emacs/site-lisp/ess/ess-mode.el" "/usr/share/emacs/site-lisp/ess/ess-mode.el" nil t)
require(ess-mode)
eval-buffer(#<buffer  *load*<3>> nil "/usr/share/emacs/site-lisp/ess/ess.el" nil t)  ; Reading at buffer position 4533
 load-with-code-conversion("/usr/share/emacs/site-lisp/ess/ess.el" "/usr/share/emacs/site-lisp/ess/ess.el" nil t)
  require(ess)
 eval-buffer(#<buffer  *load*<2>> nil "/usr/share/emacs/site-lisp/ess/ess-site.el" nil t)  ; Reading at buffer position 7790
  load-with-code-conversion("/usr/share/emacs/site-lisp/ess/ess-site.el" "/usr/share/emacs/site-lisp/ess/ess-site.el" nil nil)
load("/usr/share/emacs/site-eval-buffer(#<buffer  *load*> nil "/home/john/.emacs" nil t)  ; Reading at buffer position 4844
  load-with-code-conversion("/home/john/.emacs" "/home/john/.emacs" t t)
 load("~/.emacs" t t)
  #[nil "\205\264�  \306=\203�\307\310Q\2027�   \311=\2033�\312\307\313\314#\203#�\315\2027�\312\307\313\316#\203/�\317\2027�\315\2027�\307\320Q\321\322\n\321\211#\210\321=\203_�\323\324\325\307\326Q!\"\322\f\321\211#\210\321=\203^�\n)\203\244�\327!\330\232\203\244�\331!\211\332P\"\333\"!\203\200�\"\202\213�\333
!\203\212�
\202\213�\313\211\203\243�\334
\"\203\241�\335\336
#\210\337\340!\210
*#?\205\263�\313$\322\341\321\211#))\207" [init-file-user system-type user-init-file-1 user-init-file otherfile source ms-dos "~" "/_emacs" windows-nt directory-files nil "^\\.emacs\\(\\.elc?\\)?$" "~/.emacs" "^_emacs\\(\\.elc?\\)?$" "~/_emacs" "/.emacs" t load expand-file-name "init" file-name-as-directory "/.emacs.d" file-name-extension "elc" file-name-sans-extension ".el" file-exists-p file-newer-than-file-p message "Warning: %s is newer than %s" sit-for 1 "default" alt inhibit-default-init inhibit-startup-screen] 7]()
  command-line()
  normal-top-level()

Emacs basic functions work o.k.  But the features I had specified in the .emacs file are ignored.  I have not located the troublesome "defvar-local" definition.  If someone could tell me how to correct the error, I would be most grateful.


texts: Monitoring and restarting background processes in Emacs

texts:
I have a background process to sync and index email. The two function calls in there, (mail-sync) and (mail-index) are calls with start-process. I then run the mail-background function periodically with run-with-timer.

The relevant code is:

(defun mail-background ()
  (set-process-sentinel
    (mail-sync)
    (lambda (p e)
      (when (= 0 (process-exit-status p))
        (mail-index)))))

(run-with-timer 0 (* 5 60) 'mail-background)

There are two issues I have with this setup:

I don't know how to monitor the timer, so I can see failures, when it stopped running, etc.
When my computer (macOS) goes to sleep, sometimes the timer continues when I come back, and sometimes it has stopped, which brings me to the first point.

I'm sure there is a better way to do what I am doing, so any pointer on that appreciated. Or, I'd just like to know how I can monitor and restart the background processes that are being run with run-with-timer as a first step.


texts: How to highlight 80 columns when it contains a single % at the start

texts: How can I highlight 80 columns when a line has a single % at the very start? What I am looking for is that lines with a single % stand out by a colored rectangle 1 character high and 80 columns wide.


texts: Do I have to call all the code blocks in org-mode to chain them?

texts:
Imagine this org file

#+NAME: get-referral-code-payload
#+BEGIN_SRC bash :dir ~/Developer/data :results raw :exports code
curl -H "Content-Type: application/json" -d "@userData.json" -X POST https://api.staging.fake.com/referral
#+END_SRC

#+RESULTS: get-referral-code-payload
{"referral_code":"tom59","zip":"94000","state":"CA","city":"SF"}

#+NAME: parse-referral-code
#+BEGIN_SRC js :var payload=get-referral-code-payload
let parsedPayload = JSON.parse(payload);
return parsedPayload.access_token;
#+END_SRC

#+RESULTS: parse-referral-code

Whenever I try to run the second code block Spacemacs asks me if I want to run the previous blocks (I have several IRL) which is fine, in case I would like to refresh the values, but if I don't run them, the :var is undefined even though the #+RESULTS: get-referral-code-payload clearly has a value.

Is this the desired behavior?


texts:
This question is surprisingly difficult for me to formulate in a google-able way, but how can I stop eshell from correcting away my asterisks? For example, if I try

$ rm ./*~

to remove auto-saved files in current working directory, eshell removes the statement when I type *, and with some lag, in fact, leaving me with this statement (visible just too late for me to stop myself from executing)

$ rm ~

which is fortunately not as dangerous as it appears. But still, this seems like an accident waiting to happen, so what is exactly happening here, and how can I get it to go away?


texts: How to cancel the default in replace-string?

texts:
When I use replace-string for the first time, it asks me for the string to replace and string to replace with. When running it again, it uses the previous values as default:

Replace string (default a -> b):

I want to replace an empty string now. I can't just press Enter, though, as that would confirm the default. Is there a way how to replace the empty string after having previously replaced something else?

When asked for the first time without default, just pressing Enter works.

Note: I know there are other ways how to get the thing done. My question is how to enter an empty string when there's a default.


texts: Org (and org-capture) uses English for calendar dates, no matter what I do

texts:
The problem:

When I use org-capture to write on my journal, it writes the month as April and the day as Friday. But everything in my system is in Portuguese, so it should be "abril" for the month, and "sexta-feira" for the day.

Org-agenda uses the names in Portuguese correctly.

format-time-string outputs in English instead of Portuguese.

Worse, this behavior started yesterday when I rebooted my computer. It did work fine before.

My OS: Windows 10, with the latest updates.

What I've tried:

1) Setting calendar variables like calendar-day-name-array and others have already been set and the buffer re-evaluated. I checked that those are the current values of those variables. NOTHING CHANGED.

2) I looked at Display months/days or timestamps in another language than English and checked if I had any LANG environment variable on Windows. I do not. NOTHING TO DO HERE.

3) I called set-language-environment and set it to Brazilian Portuguese. It was already portuguese before, but I did it again. NOTHING CHANGED.

I don't know what else to try. Tips?

Edit:

The weird thing is that THIS is what shows up when I use org-capture with a datetree:

The calendar itself is in portuguese, but the bottom line shows the date I picked in English. And it's captured in English.


texts: latex export uses lstlisting instead of minted, why?

texts:
I'm running Orgmode 8.2.10 with emacs 24.4 on a Win 7 machine.
I've installed python, pygment and minted and added the following code to my .emacs file:

(setq org-export-latex-listings 'minted
  org-latex-packages-alist '(("" "minted"))
  org-latex-pdf-process
  '("pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"
    "pdflatex -shell-escape -interaction nonstopmode -output-directory %o %f"))

For some unknown reason, when exporting to latex (and consequently to pdf), the minted pkg is loaded in the preamble of the tex file but in the body of that same tex file pkg listings and its corresponding cmds are used. As a result the final pdf shows no formatting of, say, a short python code-block enclosed in #+BEGIN_SRC and #+END_SRC in the org file.

I know minted works because if I manually correct the tex file and recompile it with pdflatex it yields the code block correctly.

Why isn't the latex export of the org-file using the minted command/environment in the body of the document?

EDIT 1

I managed somehow to set minted not listings as the go-to package that handles code blocks enclosed within #+BEGIN_SRCand #+END_SRC in an *.org file. I did that by using the GUI of emacs not the .emacs conf file (will study that file at a later moment). Menu Org > Customize > Browse Org Group then patiently finding the Group Org Export > LaTeX > LaTeX Listings and setting this variable to minted instead of leaving it as listings. Saved for future sessions, and clicked Apply and Save. I see I can set Options (such as background color of code) under Org Latex Minted Options. Here's a screenshot:


texts: Is there a hook I can use to run my function when point moves?

texts:
I'd like to add some navigation context to the modeline. I can figure out where I am just fine and give the name of my function, but I don't know how to run this every time point moves.

post-command-hook is the only thing I've found, but it sounds like it's overkill.  Is there anything more appropriate?


texts: Showing full (unabbreviated) Python output in Org Mode

texts:
The result of a certain Python (statsmodel module) code in org-mode is abbreviated:
#+BEGIN_SRC python
  import pandas as pd
  import statsmodels.api as sm

  auto_df=pd.read_csv('Auto.csv', usecols= ['mpg', 'horsepower'], na_values= ['?'])

  auto_df['horsepower'] = pd.to_numeric(auto_df['horsepower'])

  auto_df.dropna(inplace=True)

  X = auto_df['horsepower']
  X = sm.add_constant(X)

  olsmod = sm.OLS(auto_df['mpg'], X)
  olsres = olsmod.fit()
  pred = olsres.get_prediction([1,98])
  return(pred.summary_frame())
#+END_SRC

#+RESULTS:
: mean   mean_se  ...  obs_ci_lower  obs_ci_upper
: 0  24.467077  0.251262  ...     14.809396     34.124758
:
: [1 rows x 6 columns]

I'm referring to the ellipses in the table below #+Results.
How can I see the full results table?
A comment suggested this could be a a pandas issue, but I don't think so since the output is from a statsmodels function.
And I don't think it's because of statsmodels because here, the full is pred.summary_frame() results table is shown:
#+BEGIN_SRC python
  import pandas as pd
  import statsmodels.api as sm
  import numpy as np

  nsample = 50
  sig = 0.25
  X = np.linspace(0, 20, nsample)
  X = sm.add_constant(X)
  beta = [5., 0.5]
  y_true = np.dot(X, beta)
  y = y_true + sig * np.random.normal(size=nsample)

  olsmod = sm.OLS(y, X)
  olsres = olsmod.fit()

  pred = olsres.get_prediction([1,17])

  return(pred.summary_frame())
#+END_SRC

#+RESULTS:
: mean  mean_se  mean_ci_lower  mean_ci_upper  obs_ci_lower  obs_ci_upper
: 0  13.559089   0.0522      13.454134      13.664043     13.069874     14.048303

One more note, the abbreviate one, from my first example, shows fully in the python shell.


texts: How do I list all key-bindings available in a given buffer?

texts: I am trying out a new major mode, how can I take advantage of Emacs' documentation system to get a listing of key bindings available in that specific buffer?


texts: Text manipulation in next line after replace-match

texts:
I have some function like this:

(defun some-function ()
  (interactive)
  (while (re-search-forward "^(def" nil t)
    (replace-match "hello")
    ;; -- Go to next line and do something here
    ))

Now once the regexp matches on and replaces the word, I want to go to the next line and do some text manipulation in the second line (like inserting some characters at the start of the line). How would I do that ?


texts: I am trying to define an abbreviation for helm-mini, I would like d to expand to *dired. When I try my usual way of *dired C-x a i l, I get an error saying Command attempted to use minibuffer while in minibuffer.


texts: Enter hex numbers continuously in hexl-mode

texts:
In hexl-mode how can I make Emacs enter a state where it takes everything I enter as hex input until I tell it to stop? Eg. I want to tap "A", "B", "1", "0", etc., and have this entered as $AB, $10, etc. in the binary file, be able to cursor around, enter more hex values, and so forth, until I'm satisfied.

By default I have to press C-M-x for every hex value I want to enter, which is very counterproductive at least for the type of binary file I'm working with at the moment.


texts: One directional access to the clipboard (OS to Emacs: no, Emacs to OS: yes)

texts:
Is it possible that Emacs ignores the system clipboard?
I mean when outside of Emacs I copy something, Emacs ignores it.
But not vice-versa, i.e., I would like to be able to have the access to the content of Emacs kill ring when I work in an external program (i.e. notapad). To be precise, the question is related to Microsoft Windows, but it is relavant for ther OS's.


texts:
On my config i have too many add-hook,Is there any way to merge them and make them more beautiful.

  (add-hook 'go-mode-hook #'my-go-project-setup)
  (add-hook 'go-mode-hook #'lsp-deferred)
  (add-hook 'go-mode-hook #'lsp-go-install-save-hooks)
  (add-hook 'go-mode-hook #'rainbow-delimiters-mode)
  (add-hook 'go-mode-hook #'galaxy/go-defun-setup)

maybe write a macro is best? then it will like this? how to write this macro or other best way?

(add-hook-x 'go-mode-hook #'lsp-deferred
                          #'lsp-go-instal-save-hooks
                          ...)


texts: Inline elements of variable list value in rx() macro call

texts:
Is there a more compact way to make use of the rx macro in cases where we want to inline a list of strings from a variable? Such as

(defconst c++20-new-keywords-list
  (list
   "char8_t"
   "import"
   "module"
   "concept"
   "consteval"
   "requires"

   "co_yield"
   "co_await"
   "co_return"

   "synchronized"
   "atomic_cancel"
   "atomic_commit"
   "atomic_noexcept"
   )
  "C++20 language extra keywords.")

 (font-lock-add-keywords
  'c++-mode
  `((,(eval `(rx (group (|
                         "static_assert"      ;C++11
                         ,@c++20-new-keywords-list
                         )))) . 'font-lock-keyword-face)))


texts: "Ignoreheading" Beamer Environment doesn't work with :BEAMER_act: Overlay

texts:
What I would like to do is the following:

I have a beamer frame where I added :BEAMER_act: [<+->].
This works well with all blocks that follow, but not when I set :BEAMER_env: ignoreheading.

Example:

#+OPTIONS: ':nil *:t -:t ::t <:t H:2 \n:nil ^:t arch:headline
#+LATEX_CLASS: beamer
* Greetings and saying goodbye
** What are greetings?
   :PROPERTIES:
   :BEAMER_act: [<+->]
   :END:
*** Greeting
    :PROPERTIES:
    :BEAMER_env: definition
    :END:
A *greeting* is something you say to greet someone.
***
    :PROPERTIES:
    :BEAMER_env: example
    :END:
- ``Hello world''
- ``What's up?''
***
    :PROPERTIES:
    :BEAMER_env: ignoreheading
    :END:
We will discuss ways to say goodbye on the next slide.

(Note that I have set #+OPTIONS: H:2)

What works is that each block and each bullet point comes one-by-one.
The only problem is the last sentence in the ignoreheading "block" (it actually isn't a block, and I guess that's where the problem is...), which appears on every slide of the "What are greetings?" frame.

An ugly solution I found is to enclose the last sentence in beamer code as such: @@beamer:\onslide<+->{We will discuss ways to say goodbye on the next slide.}@@.

Surely there must be a more practical (and prettier!) solution to this.
Can anyone help?


texts: Have different font colours in the same Aquamacs document

texts:
I am writing a document in Aquamacs, and I want some (not all) of the text to be in a different colour. Is this possible?

I googled it but could only see how to change the font colour of all the text.


texts: Search strings, do a list with first occurences and use elements of that list

texts:
I have a LaTeX source, call it main.tex.

Suppose it contains one or more of the classical groups, like "GL", "SL", "SO", "U", "SU", "Sp", "USp" or the spin group "Spin".

I want to write a script that it inserts all the nedeed \DeclareMathOperator{}{} macros in a specified point of main.tex. That's to say, if main.tex contains, for instance, "GL", "SU" and "Spin", script will print in a specified point of main.tex

\DeclareMathOperator{\GL}{GL}
\DeclareMathOperator{\SU}{SU}
\DeclareMathOperator{\Spin}{Spin}

Here there is my code for one group:

(when (search-forward "\\GL" nil t)
  (setq gstring (match-string 0)) ;; this is group with backslash
  (setq gsubstring (substring gstring 1 nil)) ;; this is group without backslash
  (goto-char mypoint)
  (if (search-forward "\\DeclareMathOperator{\\GL}{GL}" nil t)
      nil
    (progn
      (insert "\\DeclareMathOperator{"
              gstring
              "}{"
              gsubstring
              "}"))
    ))

How can I generalize the above-mentioned code?

PS: I am not sure about title of my question. Any suggest?

Test 1

I have tried with StarBug suggestion. So:

(goto-char (point-min))

(setq mypoint (search-forward "\\begin{document}" nil t))

(defun test ()
  (interactive)

  (goto-char (point-min))

    (when (re-search-forward (rx (group (or "\\GL" "\\SL" "\\SO"))))
      (setq gstring (match-string 1)) ;; this is group with backslash
      (setq gsubstring (substring gstring 1 nil)) ;; this is group without backslash
      (goto-char mypoint)
      (if (search-forward (concat
               "\\DeclareMathOperator{"
               gstring
               "}{"
               gsubstring
               "}")
              nil t)
      nil
        (progn
      (goto-char mypoint)
          (insert "\\DeclareMathOperator{"
              gstring
              "}{"
              gsubstring
              "}"))
        ))
    )

I have tested this code on my main.tex:

%% BOF

\begin{document}

\GL

\SL

\SO

%% EOF

The code works without errors, buy it prints exclusively \DeclareMathOperator{\GL}{GL}. Do have I misunderstood?


texts: perform shell variable substitution when using find file at point (ffap)

texts:
Question: is there a way to convince ffap to perform variable substitution on environment variables before attempting to resolve the file path?

I often have lines in shell scripts that read:
variable="${ENV_VAR}/path/to/file"

When I use ffap on the above, it is unaware of what ${ENV_VAR} means. Assume ENV_VAR is properly defined via
export ENV_VAR="/path/to/dir"

in one of the shell's init-files and it can be found in the output of env. Is there a way we can trick ffap to do the variable substitution?


texts: I want to have it enabled every time I open emacs and not type M-x ido-mode each time I open it.


texts: Org-mode: Passing variables between code blocks without sessions

texts:
Org-mode code evaluation seems to be a great tool for literate programming. Unfortunately, I couldn't find many examples on that online. I would like to pass variables (in my case python) between code blocks without the use of the session argument in the header. I know that using sessions you can do it, e.g.

#+BEGIN_SRC python :session sample :results none
x = 12
#+END_SRC

#+BEGIN_SRC python :results output :session sample
print 'x=' + str(x)
#+END_SRC

Is it possible to pass variables by using the "var" header argument?


texts: how to get out of a (R) repl’s multi-line (multiple-line) / line-continuation mode

texts:
My question:  In (an R-repl from ESS layer) in spacemacs, I can’t end a multiple-line after I start it
myDf %>%    # here i hit RET

so then the REPL goes into multi line mode:
+ myDf %>%
myDf %>%
          # REPL echoes nothing, waiting for me to type in anything
sdlfjs    # I type in anything to make it syntax-error and quit, but nothing works

• How to end the multi-line input ?   Ctrl-d does nothing
Thanks!


texts: Trying to bind keystrokes to a menu item

texts:
I have a menu item added to AucTex's Command Menu, Latexindent.  This calls an external process and is added in mu .emacs file by the following:

(with-eval-after-load "tex"
  (add-to-list 'TeX-command-list
              '("Latexindent" "latexindent -w -s %a"
            TeX-run-command nil t
             :help "Run Latexindent on file.")))

I'm trying to bind this a keystoke series C-c i using the following:

(with-eval-after-load "tex"
   (let ((map (make-sparse-keymap)))
      (set-keymap-parent map TeX-mode-map)
      (define-key map "\C-ci" 'forward-char)))

Unfortunately, this is not defining the C-c i at all, much less to a menu item.

Can someone point me in the right direction to get this defined correctly?

Shawn Way


texts: What is the emacs/elisp equivalent of 'include'?

texts:
I added some define-key commands to the dotspacemacs/user-config function in .spacemacs

;; Fix SHIFT + arrow keys inside screen/tmux
(define-key input-decode-map "\e[1;2A" [S-up])
(define-key input-decode-map "\e[1;2B" [S-down])
(define-key input-decode-map "\e[1;2C" [S-right])
(define-key input-decode-map "\e[1;2D" [S-left])

How would I include them directly from an external file which would be a plain text file, ie not a .el so it would be evaluated as part of the dotspacemacs/user-config function?


texts: Web-mode left arrow without the right closing angle bracket

texts:
When using Elixir html template (.eex) in web-mode, I sometimes need to type code like <%= for bid <- @bids do %> . At the moment because the opening left angled bracked is closed immediately with a matching right angled bracket, after I type <-, I'm left with a closing angled bracket that I don't need and have to delete.

I need help coming up with a way to prevent the left angled bracket from auto closing.

Below is my current web-mode and smartpatens configs:

Web-mode

(use-package web-mode
  :ensure t
  :mode (("\\.erb\\'" . web-mode)
         ("\\.mustache\\'" . web-mode)
         ("\\.html?\\'" . web-mode)
         ("\\.eex\\'" . web-mode)
         ("\\.php\\'" . web-mode)
         ("\\.jsx$" . web-mode))
  :init
  (setq web-mode-markup-indent-offset 2
        web-mode-css-indent-offset 2
        web-mode-code-indent-offset 2)
  ;; make web-mode play nice with smartparens
  (setq web-mode-enable-auto-pairing nil)
  ;(setq web-mode-enable-auto-closing nil)
  (setq web-mode-enable-current-element-highlight t)
  (setq web-mode-enable-current-column-highlight t)
  :config
  (sp-with-modes '(web-mode)
    (sp-local-pair "<" nil :actions nil)
    (sp-local-pair "% " " %"
                   :unless '(sp-in-string-p)
                   :post-handlers '(((lambda (&rest _ignored)
                                       (just-one-space)
                                       (save-excursion (insert " ")))
                                     "SPC" "=" "#")))
    (sp-local-pair "<% " " %>" :insert "C-b %")
    (sp-local-pair "<%= " " %>" :insert "C-b =")
    (sp-local-pair "<%# " " %>" :insert "C-b #")
    (sp-local-pair "<-" "")))

Smartparens

(use-package smartparens
  :ensure t
  :hook (prog-mode . smartparens-mode)
  :init
  ;; https://stackoverflow.com/questions/23789962/how-to-disable-emacs-highlighting-whitespace-in-parenthesis
  (setq sp-highlight-pair-overlay nil)
  :bind
  (:map smartparens-mode-map
        ("C-M-f" . sp-forward-sexp)
        ("C-M-b" . sp-backward-sexp)
        ("C-M-a" . sp-backward-down-sexp)
        ("C-M-e" . sp-up-sexp)
        ("C-M-w" . sp-copy-sexp)
        ("C-M-k" . sp-change-enclosing)
        ("M-k" . sp-kill-sexp)
        ("C-M-<backspace>" . sp-splice-sexp-killing-backward)
        ("C-S-<backspace>" . sp-splice-sexp-killing-around)
        ("C-]" . sp-select-next-thing-exchange))
  :config
  (require 'smartparens-config)
  (sp-local-pair 'emacs-lisp-mode "'" nil :actions nil)
  (sp-local-pair 'org-mode "[" nil :actions nil)
  (sp-local-pair 'prog-mode "{" nil :post-handlers '((my-create-newline-and-enter-sexp "RET")))
  (sp-local-pair 'prog-mode "(" nil :post-handlers '((my-create-newline-and-enter-sexp "RET"))))

Thanks.


texts: Save configuration of buffers, buffer positions and windows for later recall

texts:
I have different workflows with emacs: for example Python development and LaTeX. When I code some Python I like to have a wider window to have different buffers opened at the same time, plus a repl buffer. However when I write LaTeX I prefer having a smaller window with a single buffer, so that I can see the output in Preview.app

So my question is the following. Let's say I switch from coding python to writing LaTeX, is there any way I can save the current state of the whole thing (window width, buffer positions, buffers, etc.) so that when I'm done with LaTeX I can go back quickly to my previous emacs environment?

Thanks !


texts: For example, I want to filter table that make it shows the row which only contains "USA" string in the column 3 and 4.


texts: How do I link to an ID on a non org-mode file?

texts:
I'd like to create a link inside an org-mode file to a source code file, say in C++. But I'd like the link to point to a possibly changing position in the file, so I want to use a unique identifier. For example, say the C++ file is as follows:
// {{{ 507ab9d0-d1a5-4fa9-97a9-d78a48a08c3d
<some content>
// }}}

I want to create a link that takes me to 507ab9d0-d1a5-4fa9-97a9-d78a48a08c3d. Can this be done in org-mode? I've been looking at org-id [1], but to the lay person, it does not seem to fit this use case.
[1] https://github.com/tkf/org-mode/blob/master/lisp/org-id.el


texts:
I'm trying to bind M-[ and M-] to the following functions (courtesy of Xah Lee):

(defun xah-forward-block (&optional n)
  "Move cursor beginning of next text block.
A text block is separated by blank lines.
This command similar to `forward-paragraph', but this command's behavior is the same regardless of syntax table.
URL `http://ergoemacs.org/emacs/emacs_move_by_paragraph.html'
Version 2016-06-15"
  (interactive "p")
  (let ((n (if (null n) 1 n)))
    (re-search-forward "\n[\t\n ]*\n+" nil "NOERROR" n)))

(defun xah-backward-block (&optional n)
  "Move cursor to previous text block.
See: `xah-forward-block'
URL `http://ergoemacs.org/emacs/emacs_move_by_paragraph.html'
Version 2016-06-15"
  (interactive "p")
  (let ((n (if (null n) 1 n))
        ($i 1))
    (while (<= $i n)
      (if (re-search-backward "\n[\t\n ]*\n+" nil "NOERROR")
          (progn (skip-chars-backward "\n\t "))
        (progn (goto-char (point-min))
               (setq $i n)))
      (setq $i (1+ $i)))))

(global-set-key (kbd "<M-[>") 'xah-backward-block)
(global-set-key (kbd "<M-]>") 'xah-forward-block)

After I add the above code to the init file and save, and then do M-x eval-buffer or restart, it doesn't take effect. When I try to move or look them up via C-h k it says M-[ or M-] is undefined. But I can see them listed in the describe-bindings buffer via C-h b. I also tried to escape the brackets as \[ and \] because I thought maybe they're special characters, but still I've got the same result. But when I change the brackets to arrow keys it works. The version of Emacs I use is 26.2 and OS is Fedora 30. I've checked a lot of places and still haven't found the solution.


texts: How do i close the *compilation* buffer without visitinig its window?

texts:
I like to work with a vertically split frame with code in both windows. When i call M-x compile the *compilation* buffer shows in the other window (wich is fine as M-g n would show problematic code in the current window while i can still see the error in the other), but, after reviewing code, i would like to kill the *compilation* buffer and show the code that was in that window before, without visiting that window (C-x o) and killing it (C-x k).

Is there a way to do that?

I've come up with something, altough, it does not work; it throws:

wrong-type-argument windowp (#<window 10 on *Backtrace*>))`
window-buffer((#<window 10 on *Backtrace*>))

I believe that window-buffer does take a window as an argument and return its buffer, but I don't know any Lisp.

The code:

(defun kill-other-window-buffer ()
  "Kill the buffer of the other window if there is two windows"
  ;; I thought it will be better this way, to avoid killing an unexpected buffer
  ;; when several windows are in the frame
  (if (= (length (window-list)) 2)
    (kill-buffer
      (window-buffer (last (window-list)))
  )))


texts: From Org code block on *nix run (Power-)Shell (scripts) on MS Windows via SSH

texts:
To better integrate my Windows DevOps into Emacs Org-mode, I'd like to use my local emacs as an IDE for a remote Powershell.

SSH was easily setup, from Linux shell ssh I can successfully login to a powershell powershell shell as a domain user, and run commands, without password, using keys. Non-ASCII characters like 'é' work, and TAB works as usual in cmd and powershell.

I routinely run code blocks on Linux systems via SSH, so I tried:

#+NAME: PSH-Test
#+HEADER: :dir "/ssh:MyWinPC:~/"
#+BEGIN_SRC shell
  ipconfig
#+END_SRC

When I run the above, I get queried for my remote password, and then I get a message

  Tramp: Found remote shell prompt on MyWinPC

Emacs then hangs until I press C-g.

In *scratch* I then executed (setq tramp-verbose 10), and retried. In the debug output buffer I could see my remote prompt, so login seems to have worked, and there was a message indicating, that /bin/sh could not be loaded. So I am assuming this to be the/a problem.

Do I need winexe, If i can successfully ssh?

Using sh, shell, or powershell as code block language makes no difference.
I installed a package for powershell from the package manager.

So, How do I correctly call/execute PowerShell/CMD commands/scripts from linux emacs org-mode code blocks on remote Windows 7+ Hosts via SSH?

Note: In the meantime I use the workaround of wrapping all windows devops scripts into a linux shell block, that does ssh as first step, but that feels ugly.


texts:
I need a hydra with four "heads", each of should exit the hydra when its function is executed.
The hydra intended to be used in dired-mode and direx:direx-mode and pop-up when O pressed. This is what I got so far:

(defhydra dired-open (dired-mode-map "O" :exit t)
        "dired-open"
        ("j" dired-find-file-other-window-below "below")
        ("k" dired-find-file-other-window-above "above")
        ("h" dired-find-file-other-windowd-left "left")
        ("l" dired-find-file-other-window-right "left”))

it kinda works, but:

it's a bit ugly - I would like to learn how to make "proper" hydras, like in magit
it works only dired mode, I don't know how to properly bind it for both modes

upd: apparently Spacemacs has builtin function for introducing transient states. I'm gonna add Spacemacs tag, since I'm using it


texts: How skip gif-images, when going to the next file?

texts:
I use the package image-mode to view images in a directory. When go to the next image in the same directory, I use a function to go the next image in image-mode.

(defun find-next-image (&optional backward)
    "Find the next file (by name) in the current directory.
With prefix arg, find the previous file."
    (interactive "P")
    (when buffer-file-name
    (let* ((file (expand-file-name buffer-file-name))
            (files (cl-remove-if (lambda (file) (cl-first (file-attributes file)))
                                (sort (directory-files (file-name-directory file) t nil t) 'string<)))
            (pos (mod (+ (cl-position file files :test 'equal) (if backward -1 1))
                    (length files))))
        (find-file (nth pos files))))
    (kill-buffer (other-buffer (current-buffer) 1))
    )

However, sometimes Emacs crashes when he tries to load the next image which happens to be a .gif image. This Emacs version doesn't have any gif library to handle it.

So I need to skip .gif-images and go to the next image after the .gif image anyway. When looking to the function, he increments the position of the current file with 1. I thinked about it how I could solve this, that in the case of a GIF-image, he will skip it and increment again. But I couldn't figure out how I could write it.

Any suggestion would be appreciated.

UPDATE: see the solution below.


texts: Sending email fails with `Process smtpmail not running`

texts:
I followed this guide to set up IMAP email with Emacs, mu, and mu4e. I can pull email and view it in mu4e alright, but I can't seem to send email. I press C for Compose, edit the email, then C-c C-c to send, and I get Process smtpmail not running in the mini-buffer window.

My SMTP configuration in ~/.emacs is:

(setq
 message-send-mail-function   'smtpmail-send-it
 user-mail-address "name@domain.tld"
 smtpmail-default-smtp-server "smtp.office365.com"
 smtpmail-smtp-server         "smtp.office365.com"
 smtp-mail-service 587
 smtpmail-local-domain        "name@domain.tld")

I haven't found any pointers to this problem. Am I missing something obvious?


texts: Rebind spacemacs/frame-killer (M-m q z) in Emacs mode

texts:
I found this useful function to configure an internal Spacemacs command:
(evil-leader/set-key
“q q” ‘spacemacs/frame-killer)
Is there a way to do the same, but using C-x q or C-q q instead? (I'm not using Evil mode)
Thanks


texts: Key mapping: Push `M-q` once for fill-paragraph and twice for unfill-paragraph

texts: There is an unfill-paragraph mentioned here that does the opposite of fill-paragraph. I would like to bind the key like the follows. M-q once to fill-paragraph. If the cursor does not move, push M-q again to unfill-paragraph. What is an elegant way to implement this in Emacs?


texts: How to include buffer-file-name in completing-read

texts:
I can use completing-read to choose from several items like this:

(completing-read
 "Complete a foo: "
 '(("apple" 1) ("barfoo" 2) ("elk" 3) ("foobar2" 4)) ;; collection of choices
 nil t )

But the example below does not show the value of buffer-file-name as one of the choices:

(completing-read
 "Complete a foo: "
 '(((buffer-file-name) 1) ("barfoo" 2) ("elk" 3) ("foobar2" 4)) ;; collection of choices
 nil t )

How can I include buffer-file-name as one of the choices?


texts:
I'm trying to customize my agenda. My tasks have the following states: NEXT, WAITING, TODO and DONE. I want to customize my agenda view so that no header is shown. So far, I have:

(setq org-agenda-custom-commands
      '(("b" "Test"
     ;; commands
     ((agenda "" ((org-agenda-span 7)
              (org-deadline-warning-days 30)))
      (todo "NEXT" ((org-agenda-overriding-header "")))
      (todo "WAITING" ((org-agenda-overriding-header "")))
      (todo "TODO" ((org-agenda-overriding-header "")))))))

but in this way, an empty line is shown before each section.
Is there any way to get rid of the header at all?


texts: How to configure git and magit to stream line making pull requests?

texts:
From the main repository on github, I created a fork on github and I keep the master branch of my fork up to date with the main repository by doing:

git checkout master
git pull upstream master
git push

where upstream is set to the URL of the main repository.

I do this on the command line.  It might be nice to be able to do that from within magit (emacs) but that isn't my question right now.

I then make a pull request by doing something like:

git checkout -b new-branch
... create changes including commits within emacs ...
git push --set-upstream origin new-branch

then go to github and make the pull request via its GUI.  I'm fine with the GUI github part but if that can be simplified, I'm interested in that as well.

The last two git commands is what I'd like help with the most.  I've read the documentation but find it hard to follow.

I have magit 2.12.1 and git 2.17.2 but I'm happy to update either if that will help.  Also, I realize that the above sequence may not be optimal so I'm open to changing the sequence.


texts: `M-x` compile always runs the same command

texts:
I'm a very new user (~ 2 days) to Emacs. I switched from vim, because it wasn't working for me. I'm learning C++ and I've run into this issue when I write M-x compile. Upon writing this command, emacs always runs make -k on my small test program. However, I want it that emacs asks me what command to run for instance, in this example I want to run g++ program_ name -o output_name. Can anyone help me out?

Thanks.


texts: Switching default locale of Orgmode-generated output

texts:
Suggestions for a better title are welcome.
Essentially, I want to use Org to write in Ukrainian.
Yet, when I export it (pdf or odt) I get:

Figure 1: Контекстна діаграма

How can I customize Emacs to get the output, so that I could get Рисунок written instead of Figure ?:

Рисунок 1: Контекстна діаграма

or, to go even further, to get:

Рисунок 1 - Контекстна діаграма

True, I can do manual "replace all" in LibreOffice, but this is inconvenient and does not account for other cases when I need to influence Org export behavior.
I am fairly new to Org mode (haven't read the whole manual yet), but which support does Org provide for other languages / locales?
Could you point me to where this is documented?


texts: orgmode math equation inline with sub and superscripting

texts:
I would like to have a similar display of the math equations in orgmode like I have in latex/auctex.
Here is a small example (from the same org buffer):

I found here a similar or same question, but unfortunately without any answer:
https://www.reddit.com/r/emacs/comments/9nqa6r/latex_code_in_org_mode_does_not_fontify_correctly/
From this I understand that this is called "font-latex-fontify-script".
Do you know how I can display the math equation shown in the picture like it is done in the "begin_export latex" region?
Thank you in advance!


texts: Some keybinding stopped working this morning with error "Wrong type argument: arrayp, nil"

texts:
I used counsel-org-goto-all to jump between headings. This morning, the command (which I have bound to C-;) stopped working with this error: Wrong type argument: arrayp, nil.

I have searched on the internet a bit, and found this fix:

(setq projectile-keymap-prefix (kbd "C-c C-p"))

But it does not seem to fix anything for me.

I did some debugging and got this trace from the error after setting debug-on-error to t.

Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
  replace-regexp-in-string("\\[[0-9]*\\(?:%\\|/[0-9]*\\)\\]" " " nil)
  counsel-outline-title-org()
  counsel-outline-candidates((:outline-title counsel-outline-title-org :action counsel-org-goto-action :history counsel-org-goto-history :caller counsel-org-goto) nil)
  counsel-org-goto-all()
  funcall-interactively(counsel-org-goto-all)
  call-interactively(counsel-org-goto-all nil nil)
  command-execute(counsel-org-goto-all)

But I don't know enough elisp and emacs to figure out what is going on.

I don't even know what the error means. Does it mean arrayp was expected and nil was received? The error seems cryptic.


texts: How show minibuffer's history of commands

texts:
windows 10, Emacs 25.1, Helm

I open buffer scratch

and execute 3 commands sequence:

M-x I-search
helm-occur
replace-string

here sreenshots:

Nice. It's work fine.
But now I want to show in list all of this commands in stack mode.

Smt like this:

replace-string
helm-occur
I-search

And then I want to select one of them (e.g. I-search) and execute them.

How I can do this?


texts: How to "escape" a plain list / cannot outdent region

texts:
This is start from:

* Up
** Foo
   - x

Notice that the plain list under Foo is indented. This is what I want next:

* Up
** Foo
   - x
** Bar

But from - x, I don't know how to "escape" the plain list, in other words start a new headline. In more detail:

1:

* Up
** Foo
- x

2: Then, C-x h C-M-\:

* Up
** Foo
   - x

3: Then M-RET:

* Up
** Foo
   - x
   -

4: Then M-RIGHT:

* Up
** Foo
   - x
   -

"Cannot outdent top level regions"


texts: Highlighting shell variables within quotes

texts:
In vim, the following document will cause the $PWD on lines 2 and 3 to be colored in two different ways:

#/bin/sh
echo "Current Directory: $PWD"
echo 'Current Directory: $PWD'

The first instance of $PWD will be in a different color from the rest of the string it is in.  This gives a clear visual indication that the variable will be expanded, rather than treated as literal text. By contrast, the second instance of $PWD will be colored the same as the rest of the string, because the single quotes cause it to be treated as literal text.

Are there any existing emacs modes which provide this type of "shell-quoting awareness?"


texts:
Given a requirements.txt file describing a Python virtual environment, one can run pip install requirements.txt, go for a coffee, then come back to find that the packages in requirements.txt have been installed.

Is there a mechanism in Emacs (25.x, 26.x) to install a list of packages without attending to the installation by running a sequence of M-x package-install?


texts: All Greek letters are capitals, no small Greek letters

texts:
So far, I need some Greek letter every now and then. I enter them through:

C-x8RET GREEK SMALL LETTER LAMBDA RET → λ

or simply by

C-x8RET 03bb RET →  λ

However, I tried this after a long hiatus, and whatever I do, I obtain the upper case Λ. When I try to insert the upper case, I get the upper case too, so the insertions are not just switched.

What's wrong?