texts:
My goal was to improve the php mode. Very often I have to define an array element. And the possible code is this:

$array['key']
$array[$key]

So, I wanted to create Emacs function, reacting upon clicking '[' key like this:

if '[' was clicked once:
    print '[';
if  '[' was clicked twice:
    #this is for the string key
    print "['']";
    move the cursor between "''";
if  '[' was clicked 3 times:
    #this is for the variable as a key
    remove "''" at the center;
    #so we got [<cursor>]

I created a function:

(defvar *kb--bracket-pressed* 0)
(setq *kb--bracket-pressed* 0)

(defun bracket-pressed ()
      "[ key pressed"
      (interactive)
      (cond
            ((= 0 *kb--bracket-pressed*)
                  (insert "[")
                  (setq *kb--bracket-pressed* 1)
                  )
            ((= 1 *kb--bracket-pressed*)
                  (insert "'']")
                  (backward-char 2)
                  (setq *kb--bracket-pressed* 2)
                  )
            ((= 2 *kb--bracket-pressed*)
                  (delete-char 1)
                  (delete-char -1)
                  (setq *kb--bracket-pressed* 0)
                  )
            )
      )

Then I added a function that will set *kb--bracket-pressed* = 0 when any non-bracket key was pressed:

(defun clean-bracket-pressed ()
      (if (stringp (this-command-keys))
            (when (and
                        (not (= *kb--bracket-pressed* 0))
                        (not (string= (this-command-keys) "["))
                        )
                  (setq *kb--bracket-pressed* 0))
            )
            (setq *kb--bracket-pressed* 0)
      )

When opening a php file the following hook is launched:

(defun my-php-mode ()
  "My php-mode customisations."
      (local-set-key (kbd "[") 'bracket-pressed)
      (add-hook 'pre-command-hook 'clean-bracket-pressed nil 'make-it-local)
)

(add-hook 'php-mode-hook 'my-php-mode)

For some reason clean-bracket-pressed doesn't work correctly. When I click '[' twice, and then click any other key *kb--bracket-pressed* is still equal to 2. While I am expecting it to become 0.


texts: Confine avy search to a single line/paragraph

texts: Is there a good way to do this? Much of the time I find myself using avy-mode I only want to jump somewhere within the current paragraph or line. With stock avy, this involves entering numerous keys to select a nearby location. How is this done? Or maybe my usage of avy here is flawed, and there is a better way to use it?


texts: What does a backslash followed by a single quote mean in a regular expression?

texts:
Looking at this stackoverflow answer on an old way for specifying the org-file-apps list, I can see that there is a backslash followed by a single-quote character after each file type extension, e.g. ...pdf\\'"...

What does it mean? What purpose does the backslash plus quote serve?


texts: emacs hangs when loading csharp (.cs) file

texts:
Just upgraded to emacs 26.1 from 25.3 on windows (emacs-version = GNU Emacs 26.1 (build 1, x86_64-w64-mingw32) of 2018-05-30).
I downloaded the latest version of csharp-mode from melpa.

Now when I'm trying to load a (any) csharp file emacs will hang and I have to kill it using process explorer / task manager. I never had this issue with the old emacs version.

My question: Does anybody has the same issue with this combination and is there a possible solution?


texts: Show character count for the current line on mode line

texts:
I don't know how to display in the mode line a character count for the line I'm currently editing.

I tried searching on Google, but nothing came up, only for the whole document or for a selection.  I wanted it to count on its own without need for a manual selection.

Does anyone know how to do it?


texts: major-mode as argument to string-match vs string-equal

texts:
Why is (string-match "lisp" major-mode) not working, while (string-equal "lisp-interaction-mode"  major-mode) is working?

string-match results in debugger message: (wrong-type-argument stringp lisp-interaction-mode)

But help states:

(string-equal S1 S2)

(string-match REGEXP STRING &optional START)

(S1 and S2 is a placeholder for STRING, right?)

I already know that (string-match "lisp" (prin1-to-string major-mode)) can be used to get the expected result.


texts: spacemacs: LatexMk not recognised when building latex

texts:
I am trying to build a LaTeX file from inside spacemacs.

I have LatexMk installed with MiKtex.

I have tried SPC m b to build a test.tex file and it does nothing.

Doing C-h C-l shows:

Running `LatexMk' on `test' with ``latexmk -pdf --synctex=1 -interaction=nonstopmode  -file-line-error  "test.tex"''
'latexmk' is not recognized as an internal or external command,
operable program or batch file.

TeX Output exited abnormally with code 1 at Tue Jul 23 00:15:25

This is strange because running the command latexmk -pdf --synctex=1 -interaction=nonstopmode  -file-line-error  "test.tex" at a command prompt works fine!

What am I missing?


texts: Is there a way to open a local file for editing as a root? I need to make some changes to a config file located at ~/.emacs.d/init.el, but the Emacs tells me that the buffer is read-only.


texts:
This is what I get when starting Emacs from terminal with  emacs --debug-init. I don't know the reason why emacs suddenly started to not working.

Debugger entered--Lisp error: (wrong-type-argument listp <!DOCTYPE)
package--read-archive-file("archives/gnu/archive-contents")
package-read-archive-contents("gnu")
package-read-all-archive-contents()   package-initialize()
eval-buffer(#<buffer  *load*> nil
"/Users/sergiobacelar/.emacs.d/init.el" nil t)  ; Reading at buffer
position 170
load-with-code-conversion("/Users/sergiobacelar/.emacs.d/init.el"
"/Users/sergiobacelar/.emacs.d/init.el" t t)
load("/Users/sergiobacelar/.emacs.d/init" t t)   #[0
"\205\266�    \306=\203�\307\310Q\202?�   \311=\204�\307\312Q\202?�\313\307\314\315#\203*�\316\202?�\313\307\314\317#\203>�\320\321\322!D\nB\323\202?�\316\324\325\324\211#\210\324=\203e�\326\327\330\307\331Q!\"\325\324\211#\210\324=\203d�\210\203\247�\332!\333\232\203\247�\334!\211\335P\336!\203\201�\211\202\214�\336!\203\213�\202\214�\314\262\203\245�\337\"\203\243�\340\341#\210\342\343!\210\266\f?\205\264�\314\325\344\324\211#)\262\207" [init-file-user system-type delayed-warnings-list user-init-file
inhibit-default-init inhibit-startup-screen ms-dos "~" "/_emacs"
windows-nt "/.emacs" directory-files nil "^\\.emacs\\(\\.elc?\\)?$"
"~/.emacs" "^_emacs\\(\\.elc?\\)?$" initialization format-message
"`_emacs' init file is deprecated, please use `.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"] 7]()   command-line()   normal-top-level()


texts: Use default keybindings in Evil in non-text-editing buffers?

texts:
I am using Evil-mode which creates a vi-layer in Emacs. This means you have different modes (e.g., NORMAL; INSERT; VISUAL). Unfortunately this also happens at times when I do not want to be in NORMAL mode. For example when an error pops up in the Cider REPL I want to be able to press q and exit the buffer immediately. Not iq (change to insert mode and quit). Same for the NeoTree navigation where I want to press ENTER to open a directory structure. Instead I have to press i ENTER (change to insert mode and open directory).

Example where I want to press ENTER on the left side, but I have to enter insert mode :

Is it possible to configure Emacs/Evil-mode in such a way that in the case of non text-editing Windows (like NeoTree navigation, REPL or Cider Errors) I can press the normal commands without having to switch to INSERT mode first?


texts: orgmode agenda view doesn´t display any results

texts:
I´m new to emacs and especially org-mode, and I am testing it´s different possibilies. When trying the schedule-function with TODO, I don´t get any results displayed in the weekly or daily list.

 * TODO Get schwifty
 SCHEDULED: <2017-09-03 So>

I then set the global-keys as it is recommended in the manual with C-c a to reach the weekly schedule, but I only get a blank list of weekdates with no content. What´s wrong?


texts:
Simple question here, pretty new to org mode.

I have an assignemnt I want to do once a day until a specific date. How can I have it scheduled for every day, but end on a ceratin day? This is what I have right now but it goes forever, and I want it to stop on monday

*** TODO f, f' , f'' sheet                          :NEXTACTION:MOBILEOFFICE:
    SCHEDULED: <2018-05-10 Thurs +1d>


texts: Evil mode visual block not selecting full lines

texts:
I'm in the process of switching myself over to Emacs from Atom, and I set Evil mode because I do a lot of vim'ing on my personal and non-personal machines.

It seems Evil mode is working all right, but I did find that visual block has issues. If I have say, 15 lines selected and all lines are 30+ characters, but the last one I chose was 10 characters, visual block will only select 10 characters horizontally (ie - the length of the line I'm on). Is there perhaps a misconfiguration in my .emacs file?

EDIT: Forgot to note this is emacs 25.2.2 on Kubuntu 18.04


texts: If start with maximized frame, why do windows open top &bottom, not side by side?

texts:
I have the following in my .emacs:

(add-to-list 'default-frame-alist '(fullscreen . maximized))

And

(add-hook 'window-setup-hook
      (lambda ()
        (find-file "FILE.org")
        (shell)))

However, these buffers open with one on top, and one on the bottom. As far as I can tell, the window-setup-hook is supposed to be run after all frame parameters, so these really should be side by side. If I manually maximize the frame, and then do these two commands in order, it opens them side by side. Any ideas?

EDIT: following Stefan's suggestion, I have submitted a bug report.


texts:
I would like to upgrade my current workflow so I can use Emacs to edit a file on a remote machine. Here is what I have to do now:

ssh remote # password1 required
sudo su -l otheruser # password2 required

I should note that remote is defined in my ~/.ssh/config file and I am using a password to protect my ~/.ssh/id_rsa key.

But (a) I don't know the exact syntax for this command and (b) what I have tried seems to not work.

Here is my first attempt, based on this and this:

C-x C-f /sshx:remote|su:otheruser@remote:

This prompts me first for the password for remote, and then prompts for the password for otheruser@remote. And then nothing - no error message, but also no remote file access.

Is this syntax correct to recreate the basic "first ssh, then su" workflow from above?


texts: scilab-mode : how to interpret a .sci file?

texts:
I work on  ubuntu 14.04 with scilab installed. I put Alexander Vigodner's scilab.el in my init.el load path and I created a scilab-startup.el file loaded by the init file.

My question is, how to interpret a .sci file opened with emacs ?

For instance, if there is only 2+2 in test.sci, when I have opened the file (emacs recognized it and loaded the scilab-mode), how to obtain 4 ?


texts: Why can't EMMS play flac files using the mplayer backend?

texts:
I'm trying to use EMMS with mplayer as its backend. So far, everything works fine, but for some reason, EMMS refuses point-blank to play anything with a .flac extension in my playlist. I've checked the regex EMMS uses for mplayer, and .flac is a viable extension for it. What could be causing this?

For reference, here is my EMMS config:

;;EMMS
(require 'emms-setup)
(require 'emms-streams)
(require 'emms-librefm-stream)
(require 'emms-librefm-scrobbler)
(emms-devel)
(emms-default-players)
(setq emms-source-file-default-directory "~/Music/")
(setq emms-librefm-scrobbler-username "Chuck_Finley") ;not my real name
(setq emms-librefm-scrobbler-password "tequila-miami") ;not my real password
(emms-add-directory-tree "~/Music/")


texts:
NOTE: I use the symbol ␣ to represent the character SPACE (U+0020) for visibility.

I have a template like this:

${1:$$(yas-choose-value (with-current-buffer "foo-buf" (foo-get-name-list)))}␣[label="$1"];

When I pick an entry "Foo" from the list returned from foo-get-name-list, I expect to see an output line like

Foo␣[label="Foo"]

Instead, however, I get

Foo[label="Foo"]

How can I preserve that SPACE after Foo and before the LEFT SQUARE BRACKET?


texts:
How can I call use-package with a variable as the package name?

Something like:

(setq my-pkg "magit")
(use-package my-pkg :ensure t)

It would be, for example, used in a mapc call.

I tried functions like intern or make-symbol but I did not succeed.

Thank you!


texts: How to get the headline title using org-entry-get

texts:
Q:  How can org-mode be configured so that (org-entry-get nil "title") returns the headline title?

I have seen three variations of org-entry-get where the string argument title is in all lowercase, all uppercase, or initial caps.  The default org-mode configuration does not return anything in all three cases:

** Active [#A] 0 @ index. :lawlist:
  DEADLINE: <2016-12-31 Sat>
  :PROPERTIES:
  :Effort:
  :Hash: 8ae546845cebbc4d25ccdcf23eade44e
  :ToodledoFolder: TASKS
  :ToodledoGoal:
  :ToodledoID: 394554265
  :ToodledoLocation:
  :END:

(setq org-todo-keywords '((sequence
  "Active(a)"
  "Next Action(n)"
  "Canceled(c)"
  "Hold(h)"
  "Reference(r)"
  "Delegated(d)"
  "Waiting(w)"
  "Postponed(P)"
  "Someday(s)"
  "Planning(p)"
  "|"
  "None(N)")))

Here is a function I found that uses org-get-heading if org-entry-get fails:

(let ((title (if (org-entry-get nil "title")
                 (org-entry-get nil "title")
                 (org-get-heading t t))))
  (substring-no-properties title))

And, here is yet another method:  (org-element-property :title (org-element-at-point))


texts:
Many languages have a mechanism to signal an attached debugger to pause or break.  For example in JavaScript this is done using the debugger keyword.  In others like C# or Visual Basic the signal is generated by a built-in function.  This functionality is useful in situations where it is difficult or impossible to set breakpoints using the debugger.

Does elisp have an equivalent?


texts: How to tell emacs to separate paragaph by an empty line in quotes

texts:
Wit this text:

> Play with it a few times you will see my point. The command you need is:
>
> $ echo hello

When I use Ctrl+q at the 1st line, I get this

> Play with it a few times you will see my point. The
> command you need is: $ echo hello

Where what I need is:

> Play with it a few times you will see my point. The
> command you need is:
>
> $ echo hello

In short, emacs seems not able to tell where the paragraph ends if it is quoted.


texts: Specify global tangle file for source code export in Org mode 8.x

texts:
I want to specify a default output file for all my tangle exports. I'm using Org mode 8.x. (For Org mode ≥9.0, see How to tangle all code blocks to a common file)

This works:

#+BEGIN_SRC js :tangle "../js/out_file.js"
console.log("hello from org mode");
#+END_SRC
**
#+BEGIN_SRC js :tangle "../js/out_file.js"
console.log("hello from org mode 2");
#+END_SRC

However, I don't want to keep repeating "../js/out_file.js" on each block.

I've looked at these following two links, which seem to be asking essentially the same question:

link 1

link 2

However, none of the recommendations work:  If I just have a SRC block with no tangle arg, I get either "Tangled 0 code blocks from dummy.org" or "Wrote ./org/dummy.org" (which is the default file name)

Here's my final code.  Currently, all the methods are uncommented, so it's possible they are interfering with each other, but I have tried each method in isolation to the same effect:

* Header

# method 1
:PROPERITES:
:tangle: "../out_file.js"
:END:

# method 2
#+TANGLE: "../js/out_file.js"

# method 3
#+BABEL: :tangle "../js/out_file.js"

# method 4
#+PROPERTY: header-args+ :tangle  "../js/out_file.js"

# method 5
#+PROPERTY: header-args :session *my_js_session* :results silent :tangle "../js/out_file.js"

** some js source
#+BEGIN_SRC js
console.log("hello from org mode");
#+END_SRC
**
#+BEGIN_SRC js
console.log("hello from org mode 2");
#+END_SRC

Can anyone see what I'm doing wrong?

Do I have to somehow evaluate the properties before they take effect?

Are there any org commands I can issue to verify if the properties are properly set?


texts: How to combine change `key: foo`, `key: bar`, `key: baz` to `key: foo bar baz`?

texts:
To clarify this is what I'd like to do:

Text Before:

key: foo
key: bar
key: baz

Text After:

key: foo bar baz

Wondering if anyone has a good  technique for this type of operation (simpler the better). Suspect it might be possible with replace-regexp and some back reference trickery - been trying to figure out a way but no inspiration has hit yet :)


texts: How I can download the latest version of Emacs on Linux Mint 18.1?

texts:
Linux Mint 18.1 (64 bit).

I install Emacs by Software Manager.

It download Emacs version 24.5. But the latest version is 25.1.

How I can download the latest version?


texts:
When in org-mode in insert mode, I type \fra (as in when temping \frac), emacs will automatically change this to \far.  I have no idea why, and have no idea how to debug this.
What dictates autocomplete features in emacs, and how might I go about debugging this issue?


texts:
I am using GNU Emacs to display the cover of the album mpd is currently playing, inserting it into a *jukebox* buffer with this code:

(put-image (create-image albumartname 'imagemagick nil :width 1022) 0 albumartname)

(The window is maximized and the screen is 1024 pixels wide.)

I would like to have that image fill the entire width of Emacs' window, but a column of empty space always appears to the right of the image:

The width of this column depends on the font size - if I turn down the font size to 1, there is just a tiny column of empty space. If I turn the font size up to 38, it is much wider.

I have tried both (visual-line-mode 1) and (toggle-truncate-lines 1), without any luck. I have turned scrollbars and fringes off.

Is there a way to coerce Emacs into not showing that column of empty space?

Update:

Some more information:

Here is a screenshot if I do:

(add-to-list 'default-frame-alist '(font . "URW Gothic L-1"))

(I have changed the background-color):

I tried the suggestion of setting

 (setq frame-resize-pixelwise t)

but that didn't help.

I have also tried to add an overlay with a face with height 1 to the picture, which I couldn't make work either.

Could it be a column reserved for the "truncate char"? If I make the window narrower, it looks like this:

Notice how the column has a "$" below the image, where the line is longer than the screen, so Emacs definitely can paint there.

Update 2

I have gotten a little further. If I set the default font size to 1:

(add-to-list 'default-frame-alist '(font . "URW Gothic L-1"))

and I define a face:

(defface jukebox-cover
  '((t (:family "URW Gothic L" :height 380 :foundry "urw" :slant normal :weight normal :width normal)))
  "Jukebox cover workaround face"
  :group 'jukebox-mode)

And then after displaying the image and putting the text in the buffer:

    (put-image (create-image albumartname 'imagemagick nil :width 1020) 1 albumartname)
    (insert (format "\n%s\n%s\n%s " title album artist))

I then add and overlay with the face I defined:

        (overlay-put (make-overlay (point-min) (point-max)) 'face 'jukebox-cover)

then it looks like this:

Now I just need to figure out how to make the minibuffer font readable again as well.


texts: How to enable paredit mode on all clojure, clojurescript and elisp buffers automatically?

texts:
I want to enable paredit-mode on all clojure, cljs and elisp buffers by default, which is probably going to happen through the .spacemacs file. This is what I have so far in the user-config function of my .spacemacs:

;; paredit autoload
  (autoload 'enable-paredit-mode "paredit" "Turn on pseudo-structural editing of Lisp code." t)
  (add-hook 'clojure-mode #'enable-paredit-mode)
  (add-hook 'clojurescript-mode #'enable-paredit-mode)

But it doesn't really work. What am I doing wrong?

-- EDIT --
I've tried

;; paredit autoload
  (autoload 'enable-paredit-mode "paredit" "Turn on pseudo-structural editing of Lisp code." t)
  (add-hook 'clojure-mode-hook 'enable-paredit-mode)
  (add-hook 'clojurescript-mode-hook 'enable-paredit-mode)

and

;; paredit autoload
  (autoload 'enable-paredit-mode "paredit" "Turn on pseudo-structural editing of Lisp code." t)
  (add-hook 'clojure-mode-hook #'enable-paredit-mode)
  (add-hook 'clojurescript-mode-hook #'enable-paredit-mode)

and neither works.

-- EDIT --

The value of clojure-mode-hook is:

(#f(compiled-function
    ()
    #<bytecode 0x464d0c01>)
   (lambda nil
     (set
      (make-local-variable 'sesman-system)
      'CIDER))
   clojure--check-wrong-major-mode clj-refactor-mode cider-mode spacemacs//init-jump-handlers-clojure-mode)


texts: When exporting an org file to html, how do I only get the html body, ignoring other parts?

texts:
I have an org file I am using to write a webpage. I write it in the org file, then export it to an HTML buffer with C-c C-e h H. This exports an entire html document, from the <?xml> declaration to the DOCTYPE to javascript and CSS, to a table of contents, to the ending </body></html>.

My problem is that I only want the org file to be a part of the final page; there is other static content I want there, and that content is controlled by a separate system. My workflow involves taking the org-exported-html and copying part of the resulting html into this second system. This is fine, but I have to manually find the part of the buffer where my content begins, and copy from there to the part of the buffer where my content ends.

Is there a way I can control the "extra" html content org puts into the buffer? It doesn't have to use the org export interface, although it is a convenient way of exporting.


texts:
I was using emacs-ipython-notebook for data visualisation for some days.But then I started getting the error -ein failed to login to 8888.I checked my ipyhton notebook server and it's running on default port 8888 and I also tried to change the port number and login again but failed.I tried ein:dev-bug-report-template and here goes my system info

## System info:

```cl
("EIN system info"
 :emacs-version
 "GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.7)
 of 2014-03-07 on lamiak, modified by Debian"
 :emacs-bzr-version nil
 :window-system x
 :emacs-variant nil
 :os
 (:uname
  "Linux jamesbondu-HP-Pavilion-g6-Notebook-PC 4.2.0-41-generic #48~14.04.1-Ubuntu SMP Fri Jun 24 17:09:15 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
"
  :lsb-release
  "No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.4 LTS
Release:    14.04
Codename:   trusty
")
 :image-types
 (svg imagemagick png gif tiff jpeg xpm xbm pbm postscript)
 :image-types-available
 (svg imagemagick png gif tiff jpeg xpm xbm pbm postscript)
 :request
 (:backend curl)
 :ein
 (:version "0.12.1"
       :source-dir "/home/jamesbondu/.emacs.d/elpa/ein-20170119.927/")
 :lib
 ((:name "websocket"
     :path "~/.emacs.d/elpa/websocket-20161113.1736/websocket.elc"
     :featurep t
     :version-var websocket-version
     :version "1.5")
  (:name "request"
     :path "~/.emacs.d/elpa/request-20161221.1711/request.elc"
     :featurep t
     :version-var request-version
     :version "0.2.0")
  (:name "popup"
     :path "~/.emacs.d/elpa/popup-20160709.729/popup.el"
     :featurep nil
     :version-var nil
     :version nil)
  (:name "python"
     :path "/usr/share/emacs/24.3/lisp/progmodes/python.elc"
     :featurep t
     :version-var nil
     :version nil)))
```

Can anyone help me with this?


texts: How to view package Full Description (commentary section) inside Emacs

texts:
I'm looking for a way to visualize inside Emacs the Full Description of a
package as shown in Elpa index page.

For example the undo-tree package has a nice and comprehensive help
page/description embedded in its source code which is fully shown in its
Elpa page but the only way
I found to see it inside Emacs is opening its source code.

There's some way to see this full description inside Emacs?

What I know so far:

It turns out that the section visualized in Elpa Full Description is named
Commentary: , right below the Copyright section, both inside the
source code's preamble. So one way to solve this question is by looking for
the tools that can extract the source code's preamble and print the commentary
section.


texts: Delete all logs under a heading in org-mode

texts:
Is there a way to delete all instances of, i.e.,

:LOGBOOK:
CLOCK: [2018-01-24 Wed 16:55]--[2018-01-24 Wed 17:15] =>  0:20
:END:

under a header in org-mode? That is, to delete (under a header) all multi-line strings that begin with :LOGBOOK and end with :END:?


texts:
I've bound cmd-P in emacs to some function. It is working in emacs when I start the cocoa version but I can't make it work in console mode when running in iterm.

I made iTerm2 ignore the keystroke in Preferences->Profile->Default->Keys and it is no longer user by iTerm but looks like emacs in console is ignoring command key completely.

Is there any way to use console mode emacs in OsX using command as super?


texts:
I have a buffer with this line of text:

  This is a random test

I want to convert test in T.E.S.T., like this:

  This is a random T.E.S.T.

So far, I came up with this function:

(defun mu-convert-to-acronym (string)
  "Convert the given STRING in an acronym.
An acronym must be uppercase and have each letter followed by a dot."
  (s-upcase
   (s-append "."
             (s-join "."
                     (delete ""
                             (s-split "" string))))))

My question is: how can I turn this function into a command I can call interactively?

I'd like the command to behave like capitalize-word and upcase-word, meaning I don't need to select the word I need to convert but I can just issue the command on the word next to point or, given a negative prefix, the one before point.


texts:
I need to use Tramp to connect to a server that has 2-factor authentication.

When I log in from the command line or from  I get a message asking me to press 1 (and hit enter) which then sends a popup message to my phone asking me to approve the log in.

I can't figure out how to get Tramp to let me interact with the command prompt after it tries to connect. I get a buffer that says "Passcode or option (1-1):" but I can't figure out how to enter a value to have Tramp send back to the server.


texts: How to visualize trailing blanks and any tab characters (even non trailing)

texts:
I would like to visualize tabs. Here, I almost succeeded:

(setq whitespace-style '(face trailing tabs lines-tail indentation))

face is needed for other things to work;
trailing visualizes trailing blanks just perfectly;
tabs doesn't work;
lines-tail highlights tails of too long lines — perfect;
indentation according to documentation should show tabs when you've set up Emacs to indent with spaces and vice versa.

Why tabs doesn't work? Two possibilities:

It's tricky. To make it work you need extra knowledge.
Well, it's just currently broken.

Before reporting a bug, I decided to ask if anyone succeeded in visualizing tabs at any position (I'm particularly interested in indentation). Basically, if there is a tab character in file, I want to see it.


texts: How to make the custom font lock keywords not override the default major mode font lock?

texts:
Following my previous question on making custom highlight rules here: Color-code a new generic character combination
, I have stumbled on a new issue, that possibly merits another question.

I have a group of three rules that I would like to apply (code below). The first one works, the other two (also when alone) seem to break down something in coloring. Under each Org-mode heading, where these particular instances are found, the headline and its subheadings lose coloring. The instances themselves are not highlighted in any way.

The regular expressions are tested with the inbuilt regexp-builder. Example instances would be:

_Theorem 1:

(Author & Author, 2012)

Comment:

While for the first rule, the system seems to work, for the other two rules, it instead breaks down the heading coloring.

(add-hook 'org-mode-hook
          (lambda ()
                (font-lock-add-keywords nil
                                    '((
                                    "\\(^\\|\\s-+\\)\\(_\\([a-zA-Z0-9]+\\s-?\\)\\{0,4\\}:\\)" 2
                                    font-lock-type-face t)))
                (font-lock-add-keywords nil
                                    '((
                                    "(\\w+\\(\\s-&\\s-\\w+\\)?,\\s-[0-9]\\{4\\})" 2
                                    font-lock-string-face t)))
                (font-lock-add-keywords nil
                                    '((
                                    "^\\w+:" 2
                                       font-lock-constant-face t)))
))

Unfortunately I am new enough to Emacs that I don't know where exactly the problem should lie. Many thanks if you can point it out, or provide some advice.


texts:
When I try to start Emacs I get the following warning:

symbol's function definition is void: slime-face-inheritance-possible-p

This happens most of the time, only sometimes it seems to work. If I remove all installed packages (package.el) and install them again, then it works fine on the first start, but not on subsequent starts.

I'm using the packages slime, slime-repl and slime-company.


texts: Org-plot with gnuplot (searching for program: No such file or direcotry, aspell)

texts:
I am trying to plot simple examples in org-mode by using gnuplot. But it keeps telling me
"Searching for program: No such file or directory, aspell".
I installed gnuplot both to on emacs and on system wide. Also installed gnuplot-mode in emacs.
The table that I am trying to plot is:
#+PLOT: title:"Grades in Physics and Mathematics" ind:2 deps:(3 4) type:2d with:histograms set:"yrange [0:]" set:"xlabel 'Student'" set:"ylabel 'grades'" set:"output './img/gnuplot-grades.png'" set:"terminal png size 600,500"
|---+--------+-------------+---------|
|   | Grades | Mathematics | Physics |
|---+--------+-------------+---------|
| # | Ben    |         9.2 |     9.9 |
| # | Tom    |         6.7 |     7.7 |
| # | Tim    |         7.5 |     6.7 |
| # | Dean   |         8.0 |     7.0 |

I am using org-mode 9.3.7 which came by default. Is the issue related with emacs/org-mode version?
B.R.


texts: How to display several pages of a PDF simultaneously in Docview?

texts:
I'm using Emacs, AUCTeX, and latex-preview-pane-mode to create a PDF presentation. However, the preview only displays one page at a time.
Is this the only way? It wastes some of the vertical space available on the screen.

Is it possible for Docview to preview several pages of a PDF in one page?


texts:
I am currently trying to install spacemacs on my Arch Linux. I am following the standard installation instructions that have been put up here.

Now, I am at the part where I need to launch emacs (Instruction no.3 of the Default Installation bit). This is the one after the one below:

git clone https://github.com/syl20bnr/spacemacs ~/.emacs.d

But I get the error below when emacs comes up. What's wrong with the installation?

Warning (initialization): An error occurred while loading
‘/home/sharand/.emacs.d/init.el’Warning (initialization): An error
occurred while loading ‘/home/sharand/.emacs.d/init.el’

What should I do?

Debugging

I ran it with --debug-init

Debugger entered--Lisp error: (file-error "Creating directory" "Permission denied" "/home/sharand/.emacs.d/.cache/")
  make-directory-internal("/home/sharand/.emacs.d/.cache/")
  make-directory("/home/sharand/.emacs.d/.cache/")
  (if (file-exists-p spacemacs-cache-directory) nil (make-directory spacemacs-cache-directory))
  eval-buffer(#<buffer  *load*-432897> nil "/home/sharand/.emacs.d/core/core-load-paths.el" nil t)  ; Reading at buffer position 2713
  load-with-code-conversion("/home/sharand/.emacs.d/core/core-load-paths.el" "/home/sharand/.emacs.d/core/core-load-paths.el" nil nil)
  load("/home/sharand/.emacs.d/core/core-load-paths.el" nil nil t)
  load-file("/home/sharand/.emacs.d/core/core-load-paths.el")
  (if (not (version<= spacemacs-emacs-min-version emacs-version)) (message (concat "Your version of Emacs (%s) is too old. " "Spacemacs requires Emacs version %s or above.") emacs-version spacemacs-emacs-min-version) (load-file (concat (file-name-directory load-file-name) "core/core-load-paths.el")) (require (quote core-spacemacs)) (spacemacs/init) (spacemacs/maybe-install-dotfile) (configuration-layer/sync) (spacemacs-buffer/display-info-box) (spacemacs/setup-startup-hook) (require (quote server)) (if (server-running-p) nil (server-start)))
  eval-buffer(#<buffer  *load*> nil "/home/sharand/.emacs.d/init.el" nil t)  ; Reading at buffer position 1302
  load-with-code-conversion("/home/sharand/.emacs.d/init.el" "/home/sharand/.emacs.d/init.el" t t)
  load("/home/sharand/.emacs.d/init" t t)
  #[0 "\205\266 \306=\203\307\310Q\202? \311=\204\307\312Q\202?\313\307\314\315#\203*\316\202?\313\307\314\317#\203>\320\321\322!D\nB\323\202?\316\324\325\324\211#\210\324=\203e\326\327\330\307\331Q!\"\325\324\211#\210\324=\203d\210\203\247\332!\333\232\203\247\334!\211\335P\336!\203\201\211\202\214\336!\203\213\202\214\314\262\203\245\337\"\203\243\340\341#\210\342\343!\210\266\f?\205\264\314\325\344\324\211#)\262\207" [init-file-user system-type delayed-warnings-list user-init-file inhibit-default-init inhibit-startup-screen ms-dos "~" "/_emacs" windows-nt "/.emacs" directory-files nil "^\\.emacs\\(\\.elc?\\)?$" "~/.emacs" "^_emacs\\(\\.elc?\\)?$" initialization format-message "`_emacs' init file is deprecated, please use `.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"] 7]()
  command-line()
  normal-top-level()


texts:
Emacs and I agree on many things.  That's good.  However, there is one thing we disagree on – the default value for fill-column for different major modes.  In order to alleviate this, I added the following to my init file:

(let ((fill-column-mode-alist '((org-mode . 80)
                                (markdown-mode . 80)
                                (tex-mode . 80)
                                (python-mode . 79))))
  (defun modify-fill-column-maybe ()
    "Call `set-fill-column' with a value according to the major mode."
    (let ((value (assoc major-mode
                        fill-column-mode-alist
                        #'provided-mode-derived-p)))
      (when value
        (set-fill-column (cdr value))))))

(add-hook 'after-change-major-mode-hook #'modify-fill-column-maybe)

My question is whether there is something fundamentally wrong with my approach.  Any pitfalls that I am overlooking?  Is there maybe a built-in functionality for this that I am not aware of?


texts: How to stop the need to dotspacemacs/sync-configuration-layers each time upon startup

texts:
I start my spacemacs using the command
emacs file.txt

However, the spacemacs doesn't load any layers at all upon startup (that are specified in dotspacemacs/layers). So I have to run the command M-x dotspacemacs/sync-configuration-layers. How to make sure that the configuration layers are loaded automatically upon startup, that the .spacemacs file is actually loaded? Right now it doesn't seem to load unless the M-x dotspacemacs/sync-configuration-layers command is run.


texts: Recursively find all files from a folder containing a regexp in the filename, using helm

texts:
How can I find all files from a folder and its subfolders recursively, containing a regexp in the filename, using helm?

For example: how to search for all files with the extension .el and containing the string dired in the directory emacs-24.3 its subdirectories, using helm?


texts:
Running Doom Emacs v2.0.9 on Emacs 27.1.
In the agenda buffer, how do I get the current line highlighted?
global-hl-line-mode is enabled and the current line in other buffers is highlighted as expected.
However, agenda buffer does not show this highlighting.


texts: Pop-up documentation with pos-tip or popup?

texts:
Is there a package to get a popup of the documentation for the thing at the point?

Here's an example that flycheck uses.


texts: How do you hook up git to emerge through emacsclient?

texts:
I previously had the following script in a file called .emacs.d/emerge-for-git:

#!/bin/sh
emacs -Q $*

And In my .gitconfig:

[merge]
  tool = emerge
[mergetool "emerge"]
  path = /home/rovanion/.emacs.d/emerge-for-git

But wishing to improve upon that so that it would connect to the already running emacsclient  I ended up with the following lines:

#!/bin/sh
emacsclient -nw  --eval "(emerge-files nil \"$3\" \"$4\" \"${4}.out\")""\")"

But that ended up saving the merged file to source/path/path instead of source/path. So to save myself some grey hairs, and posterity of course, I decided to ask you instead:

How do you hook up git to your emacsclient?


texts:
I'm new to Emacs, and dislike the default indentation in LaTeX mode. I want the indentation to do the following:

insert a \t character (not spaces)
be completely manual (I want to have to press Tab on each line to indent, rather than to have Emacs automatically make it match the previous line)
display the \t characters as 4 spaces.

Essentially, I want Emacs to behave the same way as MS Notepad, XFCE's Mousepad or Vim do by default with respect to indentation (after setting \t to be displayed as 4 spaces).

I got close to this result by using the following .emacs file (taken from this q/a):

(add-hook 'LaTeX-mode-hook
      (lambda ()
        (setq indent-tabs-mode t
              indent-line-function 'indent-relative)))

But it causes the following (strange) problem: if I type something like

\begin{thm}[Liouville 1851]

followed by pressing Return and Tab, it indents all the way to the "1" in "1851". I suspect this has something to do with the 'indent-relative, but I am not sure how to fix it.

Do anyone know how I can make Emacs indentation work this way, without having the above problem? Any help is highly appreciated.

-Aleks


texts: Let switch-to-buffer to already open buffer switch to that window, rather than open it in this one

texts: Is there a way to make switch-to-buffer more dwim in this regard? Let's say I have two windows with foo.el and bar.el open. With my point in foo.el, if I switch-to-buffer and open bar.el, I'd like to just be taken to the other window, rather than be left with two windows of bar.el.


texts: Line highlighting canceling out syntax highlighting

texts:
I use hl-line-mode and I really like the built-in misterioso theme. However, the way that lines are highlighted with this theme cancels out syntax highlighting or any other properties of the highlighted lines, as can be seen in this screenshot.

How can I keep the highlighting the same color, but avoid covering up the face properties of the highlighted text? I would be willing to compromise and change the color if necessary, but that doesn't seem to be the issue. I have tried changing the color, but still get the same effect. I have also tried this solution, but only succeeded in getting rid of highlighting altogether.

This question seems to be the same or similar to mine, but I am honestly not sure if it is the same. I tried the solution suggested there but couldn't get it to work. Rather than having a discussion in the comments of that question, I thought I would ask a new one, but my feelings will not be hurt if this gets marked as duplicate.


texts: Elpy - Close Window when invoking elpy-shell-kill

texts:
Elpy helps a great deal, when editing Python-Code. For example it let's you run the current file with C-c C-c in a new Window with a REPL. When i'm done with this, i can hit C-c C-k (elpy-shell-kill) to kill the associated shell process.

The process itself gets killed, however, the window stays opened until i manually close it with C-x k. Is there a way to close the buffer and let the buffer disappear altogether?


texts: How to delete the text between the tags of an XML element?

texts:
I need to delete a block of text between 2 tags, including tags themselves. I tried this:

(defun my-delete ()
      (interactive)
      (beginning-of-buffer)
      (search-forward "<%ARGS>")
      (move-beginning-of-line nil)
      (set-mark-command nil)
      (search-forward "</%ARGS>")
      (delete-region))

It selects the text, but delete-region doesn't work. When I click del it removes the text. What function should I use?


texts:
I'm recursively grepping a large project using M-x rgrep.

After a few seconds pass I see the text I was searching for. At this point how can I cancel the search whilst preserving the buffer contents?


texts:
I'm using org-mode with C-c C-x C-c (org-agenda-columns) like a organizer, the format which I use for that
(setq org-columns-default-format
      "%TODO %30ITEM %30DEADLINE %15SCHEDULED %3PRIORITY %TAGS %5Effort(Effort){:} %6CLOCKSUM")

As you see in DEADLINE column, all dates format are DD.MM.YYYY It's not easy to understand how many days that we have for due date.

Regular org-agenda (C-a a) shows to us what is the due date.

I want to learn how to change DEADLINE column like in org-agenda (In 2 days,10 d. ago)
Maybe this links can help

Use formula in agenda clockreport to convert time? (pomodoro count in Agenda)
Org Agenda Special Properies
Column Attributes


texts: How can I look up help for a key sequence that I can't type

texts: I know that I can look up help for a key sequence using C-h k <key sequence>, but I use Emacs in the terminal, and my terminal emulator doesn't pass all key sequences through to Emacs. Sometimes I'll see the notation for a given key sequence written somewhere without explanation, and I want to look up what it does, but I can't even type it. Is there an equivalent to C-h k where I can just type the key sequence (like literally C-<character>)?


texts: Keybindings with Shift key does not work when CAPS is on

texts:
I have this mnemonic keybinding which I placed in my config
;; Switching window backwards
(global-set-key (kbd "C-x O") (lambda ()
                                (interactive)
                                (other-window -1)))

Which works fine, but works in the opposite direction when my CAPS are on.
I have tried
;; Switching window backwards
(global-set-key (kbd "C-x S-o") (lambda ()
                                (interactive)
                                (other-window -1)))

but this does not work at all, it just gives me the regular forward buffer


texts: org-mode 9 too slow with long code blocks

texts:
Emacs gets extremely slow when one code block in an org-mode file becomes of reasonable size -- say > 2000 lines
(Emacs 26.1 & org-mode 9.1.9).

Pointed out in this thread of 2015, the problem comes from syntax highlighting, activated by font-lock-mode.

Here's the profiling report

M-x profiler-start
Type a character in the code block (inside, before or after)
M-x profiler-report

- redisplay_internal (C function)                               39467  84%
 - jit-lock-function                                            39454  84%
  - jit-lock-fontify-now                                        39454  84%
   - jit-lock--run-functions                                    39418  84%
    - run-hook-wrapped                                          39418  84%
     - #<compiled 0x11fd819>                                    39418  84%
      - font-lock-fontify-region                                39418  84%
       - font-lock-default-fontify-region                       39418  84%
        - font-lock-fontify-keywords-region                     39334  84%
         - org-fontify-meta-lines-and-blocks                    38967  83%
          - org-fontify-meta-lines-and-blocks-1                 38963  83%
           - org-src-font-lock-fontify-block                    38911  83%
            - org-font-lock-ensure                              37567  80%
             - #<compiled 0x52bfbd>                             37567  80%
              - font-lock-default-fontify-buffer                37567  80%
               - font-lock-fontify-region                       37559  80%
                - c-font-lock-fontify-region                    37559  80%
                 - font-lock-default-fontify-region              37559  80%
                  - font-lock-fontify-keywords-region              37435  80%
                   - c-font-lock-declarations                   35256  75%
                    + c-find-decl-spots                         34937  75%

From the same thread, quoting Adam M. :

According to the Emacs documentation:
'In Emacs 21 and later, turning on font-lock-mode automatically activates
the new Just-In-Time fontification provided by jit-lock-mode.'

It would appear, therefore, that just-in-time fontification is not taking
place in the code block with the whole code block being fontified at once -
and hence the delay.

Any help to confirm this hypothesis and how to enable just-in-time
fontification in the code block would be appreciated.

Does anybody know how to fix this ?


texts: I create vcf files for all my clients. At times, I am required to include their Surname name \ DOB \ Phone number in the org document. Is their any way I can import the data directly from vcf file. ?


texts: How to navigate most efficiently to the start or end of the main text of an org headline?

texts:
It's easy to navigate quickly from the start of one org-mode headline to another using speed keys.

Suppose now I'm at the start of a headline, and I want to add to the main text, in the beginning immediately after the TODO keyword. Then M-f Space will get me where I want to go. If there is no TODO keyword, then it's M-f M-b.

If I want to get to the end of the headline text, it's trickier. If there are no keywords at the end, and no folded text hidden under the headline, it's as easy as C-e. But that's rarely the case. If there is folded text, but no keywords, then I can do C-e M-b. But if there is a keyword or two at the end of a folded headline, then I will find myself typing (the horror) C-e M-b M-b M-b M-f! And if there are more then two keywords, it gets worse.

When I'm jumping around and editing a lot of headlines one after the other, this can be a lot to think about and it really mess up my whole flow. Ideally I'd like to re-define s and e as speed keys to get me exactly I want to go, in all of these cases.

Has anyone seen an existing solution to this problem? My elisp skills are minimal and it would be daunting to solve this on my own.


texts:
Problem

Some versions of diff (notably, busybox diff in every build of BusyBox I've seen) only produce "unified" diff format output, they don't produce the output that GNU diff produces by default.

When I try to run diff-refine-hunk in a vc-diff buffer (git repository, if that matters), it fails, and prints the following error in the minibuffer:

  Unexpected patch hunk header: --- /tmp/diff*

(Where the asterisk is some number of randomly generated characters, obviously.)

Question

Is there a way I can get diff-refine-hunk to handle a diff-command whose output is always just unified diffs?

Detailed Example

Steps

I start with this dummy file, version-controlled in git:

00 00
11 11
22 22
33 33
55 55
66 66
77 77
88 88
99 99
bb bb
cc cc
dd dd
ee ee
ff ff

I edit/replace it with this, and save it to disk (but don't stage/commit in git):

00 00
22 22
33 33
44 44
55 55
66 66
7x 77
88 x8
99 99
aa aa
bx bb
dd dd
ex ee
ff ff

Run vc-diff with C-x v =, so far so good.

Run diff-refine-hunk with C-c C-b. And if the invoked diff command is BusyBox diff (or GNU diff with the -u option) it fails with the "Unexpected patch hunk header" error. If the diff command is just regular GNU diff without the default output, it works fine.

Example Output emacs sees from various diffs

From what I've gathered since I first posted this, diff-refine-hunk runs diff-command on several temporary files (one for each hunk?), and parses the output from each to refine the hunks. What follows are the output diff-command produces for one of those hunks (the one with the "77" and "88" 'words'). In the case of the failure cases, this hunk is the one diff-refine-hunk stops at (in the success case, it keeps calling diff-command on other hunks).

GNU diff output

When called by diff-refine-hunk in the setup above, this isthe output of GNU diff (normal, successful case):

2,3c2,3
< 77
< 77
---
> 7
> x
12,13c12,13
< 88
< 88
---
> x
> 8

GNU diff -u output

When called by diff-refine-hunk in the setup above, this is the output of GNU diff -u (failure case):

--- /tmp/diff122272NoN  2016-11-26 00:43:54.796744201 +0000
+++ /tmp/diff222272ayT  2016-11-26 00:43:54.832744689 +0000
@@ -1,6 +1,6 @@
 -
-77
-77
+7
+x

 77
 77
@@ -9,6 +9,6 @@
 88
 88

-88
-88
+x
+8

BusyBox diff output

When called by diff-refine-hunk in the setup above, this is the output of Busybox diff (failure case - same output except no datetime in header):

--- /tmp/diff122272bly
+++ /tmp/diff222272NvB
@@ -1,6 +1,6 @@
 -
-77
-77
+7
+x

 77
 77
@@ -9,6 +9,6 @@
 88
 88

-88
-88
+x
+8

How I captured the above outputs

I created a script like this and pointed diff-command in emacs to it to test each variant and capture the outputs of each background run of diff (unlike a prior edit to this question, this script captures each diff-command run in a separate file, since diff-refine-hunk can call the diff backend program multiple times.

#!/bin/sh
exec busybox diff "$@" | tee "`mktemp /tmp/busybox_diff.XXXXXX`"
#exec diff -u "$@" | tee "`mktemp /tmp/gnu_diff-u.XXXXXX`"
#exec diff "$@" | tee "`mktemp /tmp/gnu_diff.XXXXXX`"

Question - Re-Worded

Is there a way to get diff-refine-hunk to work correctly when the underlying diff command that it calls in the background on temporary files always produces output in that unified format?


texts: Dead keys not working in Emacs-Lisp mode *only*

texts:
I've been having a really annoying bug when editing elisp files recently: dead keys do not work, but only when I am in Emacs-Lisp mode. If I type a key that is configured as a dead key (say, '), I get a prompt that says Emacs-Lisp: on my mini buffer. Then, typing any normal letter gives me the corresponding accented character (say, á), but hitting SPC, which should give me the single quote character ', does nothing instead. Deactivating Emacs-Lisp mode and going into fundamental mode solves the issue. Does anyone know how to fix this?

Just a disclaimer: some people (including myself) were affected a while ago by a seemingly similar issue that required them to explicitly require iso-transl to get dead keys. I've already done this, and it did fix most of my problems with dead keys, but this weird issue in Emacs-Lisp mode appeared afterwards.

Edit:

If I don't require iso-transl (or do emacs -q) then the problem changes: I get undefined dead keys, just like I did before, but they don't bring up the Emacs-Lisp: prompt on my mini buffer. If I do e.g. C-h k <dead-acute>, then the Emacs-Lisp: prompt comes up and no help gets shown, except that if I try to type <dead-acute> several times and then hit C-g the following slightly different message pops up:

<dead-acute> C-g (translated from <dead-acute> <dead-acute> <dead-acute> C-g) is undefined

I'm running Emacs 24.3.1 on Ubuntu 14.04. I think before I had it compiled from source and it was giving me the same problem, but I can't quite remember.

Edit 2

If I do (describe-key [dead-acute]), Emacs says that it is undefined. If I try this trick to find where the key is bound, it still shows me the Emacs-Lisp: prompt as above, except that if I hit C-g right after I get

At Point: (nil nil nil nil)
Minor-mode:
Local: 1
Global: 1

This is different from the message it prints for C-g on its own. If I try to do the same on a different mode, I need to press SPC after <dead-acute> to get an answer

At Point: (nil nil nil nil)
Minor-mode:
Local:
Global: self-insert-command


texts:
I am looking to write my own major mode.

The programming language that I need to write it for has //... and /* ... */ style comments. I am having a very hard time getting the syntax tables working for both at the same time.

How would I get both of them at the same time?


texts: How to log all state changes of recurring tasks to a drawer just like clock segments?

texts:
I have a recurring task with multiple state changes:

* TODO Some task
SCHEDULED: <2019-09-23 Mon 08:00 ++1d>
:PROPERTIES:
:LAST_REPEAT: [2019-09-22 Sun 16:40]
:END:
:LOGBOOK:
CLOCK: [2019-09-23 Mon 16:42]--[2019-09-23 Mon 16:43] =>  0:01
:END:
- State "DONE"       from "TODO"       [2019-09-22 Sun 16:40]
- State "DONE"       from "TODO"       [2019-09-17 Tue 19:22]

How can I move the state changes at the bottom, State "DONE"       from "TODO", to their own drawer, similar to the clock segments that are in their own drawer?


texts: How to generate a clock table in reverse chronological order?


texts: Prevent org export from expanding \ as $\backslash$

texts:
When using the org's ox-koma-letter, I'm having a problem with org exporting LaTeX commands expanding the leading \ as $\backslash$.

Using the example letter (from Romeo to Juliet) on the orgmode.org site, if I change the closing section as follows:

* Yours truly,                                                      :closing:
#+LaTeX: \hspace{2em}
Romeo of House Montague

But org's export to LaTeX is expanding the line with the \hspace{2em} command as:

\setkomavar{signature}{$\backslash$hspace\{2em\} Romeo of House Montague}

How do I prevent this?

[edited to specify precise environment in which issue is occurring.]

[edit 2: As of 20180702, the org-koma-letter Signature definition in org-contrib is:

 ;; Signature.
 (let* ((heading-val
     (and (plist-get info :with-headline-opening)
      (org-string-nw-p
       (org-trim
        (org-export-data
         (org-koma-letter--get-tagged-contents 'closing)
         info)))))
    (signature (org-string-nw-p (plist-get info :signature)))
    (signature-scope (funcall check-scope 'signature)))
   (and (or (and signature signature-scope)
    heading-val)
    (not (and (eq scope 'global) heading-val))
    (format "\\setkomavar{signature}{%s}\n"
        (if signature-scope signature heading-val))))

Which still produces the same issue. ]


texts: I am relatively new to emacs. I'm wanting to set up cc-mode. I'm having trouble with the process. When I initially viewed list-packages, a search brought up cc-mode, but something I've done means it is not there any more. I am using the default package source at elpa. I have downloaded and byte-compiled cc-mode into ~/.emacs.d/ and made sure it is in the load path (although I'm not confident I've done this correctly). I have tried the tests mentioned on http://cc-mode.sourceforge.net/installation.php and c-version isn't recognised, just as an incremental search does not recognise 'cc-'. I would be grateful for any help.


texts: Display property value of each section in table like in clocktable

texts:
Context As far as I know it is possible to define properties for a section in a PROPERTIES drawer like this:

* Introduction
:PROPERTIES:
:PlannedPages: 0.5
:ActualPages: 0.5
:END:

You can see that there are two properties, that should reflect the number of pages that I plan to write for this section and the number of pages that I actually wrote.

Question
Do you know an example that shows to some extent how to program a dynamic block similiar to CLOCKTABLE which maintains a table that contains sections in it's rows and the values of some properties in it's columns?

:DOCUMENTSCOPE:
|                   | Planned | Actual |
| Section           |   Pages | Pages  |
|-------------------+---------+--------|
| Introduction      |     0.5 |        |
| Background        |       2 |        |
| Thesis objectives |       1 |        |
| Time schedule     |     0.5 |        |
:END:


texts: Re-bind helm-bibtex actions to number keys

texts: The default behavior for helm-bibtex is to bind actions to the function keys F1, F2,.... How can I change this to use the number keys 1,2,... instead?


texts: Does eshell support directory-stack expansion ala bash?

texts:
Does eshell support directory-stack expansion ala bash ?

bash> pushd dir
bash> ls ~-1
      <Outputs contents of dir>


texts: Editing a string with lots of escape characters

texts:
Let's say I'm editing my config file and there is a very long string like this:

(setq my-string "very\nlong\nstring [...] \"hello world\"")

How do edit the string without the escape characters (and maybe in a different mode) and than save the result back in the config file with the escape characters?


texts: Symbol's value as variable is void: ‘yes-or-no-p

texts:
I have the following lines in my config file:

(fset 'yes-or-no-p 'y-or-n-p)
(setq confirm-kill-emacs ‘yes-or-no-p)

The latter line is what's throwing the error.  I would like to be able to use 'y-or-n-p for some commands, like confirm-kill-emacs.


texts: Syntax/indentation problems with Vue mode in Emacs 27 nightly

texts:
I'm using vue-mode, based on mmm-mode with Emacs 27 nightly from 10/10/2019. Since that Emacs update, I don't get any indentation support in the script section of a Vue file.
Try this file with emacs -q after (use-package vue):

<template>
</template>

<script lang="ts">
import * as d3 from 'd3'
  function foo() {

  }
</script>

<style>
</style>

Go into function foo at the blank line and type TAB. No indent. :-(

And indeed if you eval (syntax-ppss (point-at-bol)) at that point, it returns (0 nil 2381 nil nil nil 0 nil nil nil nil) which means it thinks the indent should be 0, not 2.

Anyone have any idea what changed recently that could cause this?
Or any ideas for how I can debug it?


texts:
I am trying to make the Evil function evil-jump-to-tag, C-] behave like the Emacs binding M-..

The normal behaviour is fine for browsing Tags files, but I want it to work also for Slime's slime-edit-definition, Elisps' elisp-slime-nav-find-elisp-thing-at-point, Clojures cider-jump-to-var, etc...

These major modes and many more have bound some equivalent of jump-to-definition to the keybinding M-..

To get the same behaviour for Evil-mode, do I need to bind a keybinding locally for every of these modes, or is it possible to take a keybinding and tell Emacs, that whenever this key is pressed, use the function bound for that key in Emacs mode?


texts: How to autosave a buffer to the original file on disk?

texts:
I want Emacs to auto-save a buffer or buffers so that I don't have to press C-x C-s each time.

With auto-save turned on, I see the label "Auto-saving.... Done", which appears once in 30 seconds or so.  But why is the document still not saved?

After the label "Auto-saving.... Done" appears, there are still ** which means the buffer I am working on has not been saved. If so, then what is "Auto-saving.... Done" really saving?


texts: Running emacs server via systemd prevents inverse search and nice view

texts:
Background: I am using systemd to run my emacs server and my usual workflow always involves invoking emacsclient. Both server and client are on the same computer running Debian Jessie. The method is explained in the following links:

https://www.emacswiki.org/emacs/EmacsAsDaemon#toc8

http://blog.refu.co/?p=1296

https://www.reddit.com/r/emacs/comments/3b0qpa/if_you_cant_beat_em_join_em_using_systemd_to/

Question: When I work on a Latex document, the view function for AuCTeX used to jump to the pdf document and show a nice redbox; a Ctrl-mouse click successfully performed an inverse search. However, after implementing emacs server as a systemd unit, inverse search does not work any more. In addition, the C-c C-v which is the view function no longer displays the nice red box in the pdf document. How can I fix this problem?

thanks in advance!


texts: 1024 char limit on command line in emacs shell mode on OSX

texts:
I am running into a 1024 character limit for a bash command line in emacs shell mode.  For example the command:

echo xxxxxxxxxxxxx...x

with 1018 x's (for a total line length of 1023 chars) works fine, echoing the x's. However with 1019 or more x's (for a total line length of 1024 or more chars) it just starts generating ^G characters, one per character over 1023, and not returning (must ^C^C out of it). It does not matter if some of those 1023 characters are spaces, so it is not an issue of argument length.

This is of course not a problem running bash outside emacs.

Is there any way to change this emacs shell limit?

(version: Aquamacs 3.2 GNU Emacs 24.4.51.2)


texts: How to go to matching pattern after org-occur?

texts:
After typing C-c / / and a regex, org shows a sparse tree containing matches of the pattern.

How do I move point through these matches, in a way similar to C-s?


texts: How to paste to another app from a shell script

texts:
I've been getting very vexed by the following.

Goal: Take the clipboard contents and paste them into another application by using a shell script called by Emacs, followed by a Return. [This is for entering a command in another application.]

Problem: A shell script using automation tools (to simulate typing) which works from a Terminal window acts goofy when called by Emacs, because all paste actions happen only after the Emacs function has completed, so the Return precedes the pasting. [Negating the value of entering the command from Emacs.]

I put steps to illustrate the problem below.

The simplified example uses xdotool, but I had the same problem when using xte. The example pastes into gedit, but the problem exists for other applications as well. Finally, I tried both shell-command and call-process-shell-command and tried all possible settings of select-enable-clipboard and select-enable-primary, all to no avail. If only I could trip the paste before the Return, I would be happy.

FWIW, I've tried such things as shell-scripts calling shell-scripts and emacs functions calling emacs functions, but all I can get is having the paste happen at the very end. I'm clearly very lost.

Any ideas about how to get the paste to happen when it happens in the script?

Thanks,

Bill

Steps to duplicate problem, because the explanation above is likely not sufficient.

Here is hunh.sh---copy, paste, save it, make it executable.

#!/bin/bash
xdotool search --name --onlyvisible "gedit" windowactivate

# select text to replace
xdotool key ctrl+a
# paste in the clipboard
xdotool key ctrl+v
# do stupid stuff before finally hitting Return, so that it's clear
#    that the paste (ctrl-v) gets misplaced
xdotool key space space h u n h
sleep 1
xdotool key BackSpace BackSpace BackSpace BackSpace BackSpace BackSpace
sleep 1
xdotool key Return

Here is in hunh.el. Copy it, paste it, save it as hunh.el, then load it in Emacs

(defun hunh ()
 (interactive)
 (funcall interprogram-cut-function "Fighting with clipboards is no fun")
 (shell-command "hunh.sh")
 )

Be sure that you have xdotool.
Assuming you have it, open a single window for gedit.
Type a bunch of garbage in the gedit window so that it can get replaced later.
Run the script hunh.sh from the place you're working: ./hunh.sh

Result: Everything will work fine, with the text being replaced, some extra typing and deleting, and then a Return.

Start emacs
Within emacs, load hunh.el, then run its one function
M-x hunh

Result: The text in gedit will be replaced with the extra typing and deleting, then a Return, and finally the paste of the text.


texts: Since upgrading to Emacs 24.5.1 and org-mode 8.3.3 (Kubuntu 16.04), I can no longer export org-mode files as ODT; only as iCal, HTML, LaTeX, or plain text. Is that normal? Is there a way to get ODT export back?


texts: Make "org-latex-preview" load package so that it properly renders "tcolorbox" environments

texts:
The context
The following org buffer
* Random name

This is an equation

\begin{equation}
  x = a + b
\end{equation}

This is a box

\begin{tcolorbox}
  a
\end{tcolorbox}

is previewed as

The question
Just as it is possible  to preview the content of a equation environment. Is it possible to preview the content of the tcolorbox envionment?
It seems that Emacs is not loading the tcolorbox environment. Is there  any way I can make Emacs load a given LaTeX package? so that when previewing a LaTeX code snippet that uses the tcolorbox environment, the actual content is displayed.
Additional information
Have you installed the tcolorbox package?
Yes. I can confirm this because I've compiled several documents that uses the tcolorbox environment with pdflatex without any problems.
Have you checked the variable org-latex-packages-alist contains the tcolorbox package?
Yes. When describing the variable, I get the following value: (("" "tcolorbox" t))
What's the value of the variable org-preview-latex-default-process?
Its value is dvipng. This is the default value and I've not changed it.
If you add #+LATEX_HEADER: \usepackage{tcolorbox} at the top of your Org mode file and export to PDF. Do you see the box?
Yes, I can see the box in the generated PDF file but still can't see when executing org-latex-preview within a tcolorbox environment. tcolorboxes are still being previewed as tiny empty boxes.
I tested this when org-latex-packages-alist was equal to nil.
if you try to export without the header, is there a \usepackage{tcolorbox} in the generated .tex file?
Without the header and with org-latex-packages-alist equal to nil, there is no \usepackage{tcolorbox}. However, the environment tcolorbox is used within the .tex file. In the resulting PDF file, only the text within the tcolorbox is rendered as normal text but no box is rendered.
Without the header and with org-latex-packages-alist equal to (("" "tcolorbox" t)), \usepackage{tcolorbox} does appears within the document. In the resulting PDF file, the tcolorbox environment is properly displayed (i.e. its content and the actual box).
Post screenshoots of the tiny empty box
Actually, it is not a tiny empty box. I wrote that because I tested it with a black background. Actually, the text within the tcolorbox is rendered in the preview but the box is not. See how the following Org file is previewed
#+LATEX_HEADER: \usepackage{tcolorbox}
#+LATEX_HEADER: \usepackage{lipsum}

This is random text.

\begin{tcolorbox}
  a b c d
\end{tcolorbox}

This is random text

\begin{tcolorbox}
  \lipsum[1]
\end{tcolorbox}

This is random text.

Preview and resulting PDF of the Org mode file shown above

This was tested when these variables had the following values

org-latex-packages-alist: nil
org-preview-latex-default-process: dvipng


texts: How to treat region between conflict markers as comment?

texts:
While resolving complex conflicts manually, I usually want emacs to treat conflict markers and region between them as comment, since it breaks major-mode's syntactic analysis (fontification, electric-indent, etc) :

<<<<<<< HEAD          <- comment
aaa
bbb
=======               <- comment
ccc                   <- comment
>>>>>>> brabrabrabra  <- comment

It seems possible to visually highlight them as comment with search-based fontification, but is it possible to treat them as comment not just visually but also syntactically ?


texts: My vim-using co-worker came by, and since he wanted to do something with files on my PC, I installed evil-mode to allow him to do this more efficiently (vim user trying to accomplish anything in emacs is a sad view). Now I've got a problem: I don't know how to quit evil-mode! I want to turn it off; how can I do that?


texts: Invoke minor mode upon visiting an org file (on a per-file basis)

texts:
I have certain org files (scientific manuscripts) that I want to automatically show in Olivetti mode with a specified width upon opening. Is it possible to enable Olivetti (or generally, any minor mode) with something like this?
#+STARTUP: indent linum

Here's what I'm currently using at the top of the file, but of course I have to evaluate it with C-c C-c...

#+BEGIN_SRC elisp :exports none :results none
(olivetti-mode)
(olivetti-set-width 110)
#+END_SRC

Thanks.


texts:
When i'm working in a LaTeX-File everything works as expected. Compilation and completion via company-auctex are working perfectly. However when i want to make use of any preview-functionality inside my editing buffer (For example with C-c C-p C-p "preview at point" there is no preview, but an error buffer that ends with

Preview-PDF2DSC finished at Mon Mar 26 10:30:58
Running `Preview-Ghostscript' with ``/usr/bin/rungs -dOutputFile\=\
(_region_.prv/tmp696XBB/pr1-\%d.png\) -q -dDELAYSAFER -dNOPAUSE -
DNOPLATFONTS -dPrinted -dTextAlphaBits\=4 -dGraphicsAlphaBits\=4 -
sDEVICE\=png16m -r86.5414x86.6274''

Preview-Ghostscript exited abnormally with code 1 at Mon Mar 26
10:30:58
Unable to read environment locale:exit now.

Preview-Ghostscript exited abnormally with code 1

Configuration and AucTeX-setup is just

(use-package auctex
  :defer t
  :ensure t)

Does anyone have an idea what to do? Is maybe something missing in my config?

Emacs Version: 25.3.1
AucTeX Version: 12.1.1
Ghostscript Version: 9.22

All help will be highly appreciated.


texts: Retrieving All Tasks "CLOSED" Inside a Time Interval

texts:
Question: How can I retrieve, over a set of files S (in particular: over my agenda files + their archive files) all org-mode headers that are marked "CLOSED" (i.e., have a "CLOSED" stamp like CLOSED: [2019-05-11 Sat 18:11]), so that I may then run an operation over them? My particular use case is to grab all headers that satisfy the above property, so that I can then grab each of their org-property :T:, and sum them together. So for example if I have

# File1
* SATISFICED Header1
  CLOSED: [2019-05-01 Wed 18:13]
:PROPERTIES:
:T: 1
:END:

# File2
* SATISFICED Header2
  CLOSED: [2019-05-11 Sat 18:13]
:PROPERTIES:
:T: 2
:END:
* SATISFICED Header3
  CLOSED: [2019-05-11 Sat 18:13]
:PROPERTIES:
:T: 3
:END:

I'd like to run a function like (sum--all-T-from "[2019-05-10]" "[2019-05-11]") to get as answer 5.


texts: How to highlight in different colors for variables inside `fstring` on python-mode

texts:
I am using python-mode which colors the parameters.

When I concatinate strings the variable color is represented as different:

On the other hand, if I use fstring, the variable is not represented as different color:

Please note that, if I enter non-existing variable, python-mode detects it:

[Q] Is there any way to give a color to variables inside a fstring under python-mode?


texts: isearch with invisible text properties, not overlays?

texts:
Q: how can I get isearch to understand invisible text
properties, not just overlays?

I'm writing a major mode that uses text properties rather than
overlays to toggle visibility.  I'd like to use isearch to be
able to find invisible text and make it visible, but don't know
how to convince isearch to do so.

As an example, evaluate the following function in a buffer:

(defun try-me ()
  (let ((text (concat (propertize "Visible text" 'invisible nil)
                      (propertize "\nOtters" 'invisible t))))
    (insert text)))

It will insert one line of visible text "Visible text", and
another line of invisible text "Otters" below it.

Using isearch to search for "Otters" results in no hits.

How can I get isearch a) to find text with the invisible text
property, and b) get it to toggle the invisible text property so
it's visible?  (I imagine I'll need a custom function to do that,
but don't know how to get isearch to use that function.)


texts: Let say I want to add a Toolbar icon to emacs which when clicked should "Select all" text in the current window. We know for selecting text we can use M-x mark-whole-buffer. How can I  use this command to make emacs toolbar icon?


texts: How can I specify the filename for org-mode export in Emacs?

texts:
My org file is named README.org and I want to export to Markdown into a file named README. Every time I run the export it writes to README.md. Here is my org file:

#+PROPERTY: EXPORT_FILE_NAME thing

* Test export

I'm using the EXPORT_FILE_NAME property based on this link: http://orgmode.org/manual/Export-settings.html#index-property_002c-EXPORT_005fFILE_005fNAME-1617 but it doesn't seem to do anything.


texts: How to remove spurious whitespace in `org-add-note` LOGBOOK drawer

texts:
When using org-add-note (C-c C-z) in Org, I'm unable to automatically remove whitespace that is inserted when finalizing the note and the text is filed into the LOGBOOK drawer.  global-whitespace-cleanup-mode is enabled but does not seem to affect the result.

I was unsuccessful with manually calling whitespace-cleanup using the Org Capture finalize hooks:
(add-hook 'org-capture-after-finalize-hook (lambda () (whitespace-cleanup)))

OR
(add-hook 'org-capture-before-finalize-hook (lambda () (whitespace-cleanup)))

How can I capture notes using org-add-note and automatically remove the extra whitespace?
Edit
Since I may be looking at the wrong hooks, I've tried adding whitespace-cleanup-mode to org-log-buffer-setup-hook via:
(add-hook 'org-log-buffer-setup-hook (lambda () (whitespace-cleanup-mode t)))

Though, this is running when the capture buffer is created, not when the content is moved into the drawer, so it's too early to be effective.


texts: Is it possible to replace regex like query-replace-regex without asking for each matching ?


texts:
I want to transform some of the opening and closing tags in an html document to other tags. That is I would like to transform

<div class='foo'> This is some text. </div>

to something like

 <p> This is some text </p>.

Is there a way to find and replace matching html tags?


texts: How to group together tags in a headlines made by org-capture?

texts:
I use the following capture code for making notes.

(setq org-capture-templates '((
     "n"                                         ; key
     "Add a note to abc.org file "               ; description
     entry                                       ; type
     (file+headline "p.abc.org" "logg")          ; target
     "* %^{Logg}  :NOTE: %(org-set-tags)  \n%?"  ; template
     :prepend t                                  ; properties
     :empty-lines 1                              ; propertiesc
     )))

The template line consists of two sources of tags to the note. (1) I want all notes to be tagged with ":NOTE:", therefor this tag is written directly into the target line. (2) in addition I want to chose tags from my tags list by means of the function org-set-tags.

If I chose the tag :FAMILY: from my tagg list, the note heading end up looking like this:

* Note about something :NOTE: :FAMILY:

In this case only :FAMILY: is behaving as a tag (shown in bold in the headline). How can I change the target line so that the heading line will look like this: ?

* Note about something :NOTE:FAMILY:

where the two tags are collected into the single group :NOTE:FAMILY: and both function as tags?

It does not help to remove the space between :NOTE: and %(org-set-tags) in the target file, because the org-set-tags function insert spaces befor entering the tags you chose from you tags list.


texts: Why are my org tables no longer exporting?

texts:
Today I tried to export an org table by issuing M-x org-table-export <RET> table.csv <RET> <RET>. To my surprise, I received the error message

Symbol's function definition is void: org-export-create-backend

I believe this is happening because of my recent upgrade to org-mode version 8.3.1 from version 7. Any ideas what is going wrong?


texts: outline-show-all reveals the contents of all headers in org-mode. How can I do the opposite? There's no outline-hide-all command.


texts: Magit-process shows every frame of dynamic "animated" output

texts: I'm working with a project that has a pre-commit hook that outputs an "animated" progress bar and updates the output to show which step is completed.  In the magit-process buffer it shows every frame in the output window rather than in-place as in the terminal.  Is it possible to get this to work in the emacs buffers?


texts: how to automatically add org-emphasis properties to list titles?

texts:
I use org-mode lists, both plain-text lists and numbered lists. I precede my lists with a "list title," which for me is any line ending in a colon.

Grocery list:
- tomatoes
- spinach
- blueberries

I'd like these list titles to be automatically italicized in export to HTML and LaTeX PDF.

I don't want to do this by making it a headline, since by design, as we know, there is no way to end an org-heading and return to the parent level without creating a new heading.

So instead, I want org to automatically consider any lines ending with a colon as list titles. (Even better would be to exclude headlines and lines that have a period somewhere before the ending colon.)

I figured out how to fontify such lines within the Emacs buffer itself by defining a new face:

(defface list-title-face
'((t (:background "pale green")))
"fontify list titles")

 (font-lock-add-keywords 'org-mode
'(("^.*:[ ]*$" . 'list-title-face)))

But how do I create an org-emphasis type so that the emphasis will be respected in org-export?

UPDATE: org-emphasis-regexp-components looks promising.


texts:
I want to escape a underscore in a filename with a backslash (\). So file_01.jpg would become file\_01.jpg.

I tried:

(replace-regexp-in-string "_" "\_"  "file_01.jpg" t t)

but that produces file_01.jpg. And:

(replace-regexp-in-string "_" "\\_"  "file_01.jpg" t t)

gives file\\_01.jpg.

How can I insert a single backslash?


texts:
CentOS 7, Emacs 25.1
http://elpa.gnu.org/packages/gnu-elpa-keyring-update.html
M-x package-install RET gnu-elpa-keyring-update RET

But I get error:
Failed to verify signature gnu-elpa-keyring-update-2019.3.tar.sig:
No public key for 066DAFCB81E42C40 created at 2019-09-21T20:55:14+0300 using RSA
Command output:
gpg: WARNING: unsafe permissions on homedir `/opt/opencm/.emacs.d/elpa/gnupg'
gpg: Signature made Sat 21 Sep 2019 08:55:14 PM IDT using RSA key ID 81E42C40
gpg: Can't check signature: No public key


texts: How to make end-of-buffer move to the last line not beyond it?

texts: I'm playing with evil-mode and this is one of the things where evil differs from vim. In vim G takes you to the last line, but evil uses Emacs end-of-buffer which for some reason takes me beyond last line to some imaginary line.


texts: Looking for strong inline verbatim environment

texts: By "strong" I mean that it will work unconditionally.  '=verbatim=' does not fit the bill.  It fails, for example, in =[[0]]=.  Same for goes for '~verbatim~'.


texts: split every single org headline in a org file to separate md/org files

texts:
I want to be able to create a function that splits or exports every single headline in a org mode file (recursively) into a separate file.

Ideally that would be a .md file but I can also live with a .org file

Does anyone have any examples on how to achieve this? Previous answers found here/org forums were focused only on top level headers and had issues with looping over the file.

to illustrate this org file:

* Title of Heading 1
  Text 1

** Sub-Heading 2
   Text 2

* Title of Heading 2
  Text 3

would result in the files

Title of Heading 1.md
Sub-Heading 2.md
Title for Heading 2.md


texts: I'm not finding a lot of examples/documentation for the non-REPL world of C/C++ in Emacs org-mode babel. For example, is there a way to break a program up into separate source code blocks, i.e., a block for main, then separate blocks for its func1, func2, ... called by main? Or, is there any way to have just a stand-alone function lonefunc in a block, then call it from another place? I suppose this is all a form of literate programming, but typically you're pulling it all together with tangling. I'd like not to tangle, but have things running in the org-mode session.


texts: Change emacs generated image size in org-mode export

texts:
I'm using PlantUML to generate a UML diagram inside an orgmode file. I've looked everywhere, and either I'm using the wrong terms (likely) or I'm missing something (also likely). When I view the raw tex file generated by C-c C-e l p, I get the following:
\includegraphics[width=.9\linewidth]{test.png}

What I need to know is how to change the width that is in the generated tex file. I could do it by manually changing the source image size, and then rerunning latex, but there must be a way that I'm missing to control it from within the orgmode file itself. Any ideas?
Edit: this is the relevant section of the org-mode file:
#+BEGIN_SRC plantuml :file test.png
Bob->Alice : hello
#+END_SRC


texts: Why does one argument need to be quoted but not the other?

texts:
In the following code I have a reproducible example of strange behavior (the macro body is probably not important):

(setq annoying-commands ())

(defmacro add-annoying-arrows-advice (cmd alternatives &optional evil-cmd evil-alternatives)
  `(progn
     (add-to-list 'annoying-commands (quote ,cmd))
     (put (quote ,cmd) 'aa--alts ,alternatives)
     (put (quote ,cmd) 'aa--evil-alts ,evil-alternatives)
     (put (quote ,cmd) 'aa--evil-cmd ,evil-cmd)
     (defadvice ,cmd (before annoying-arrows activate)
       (when annoying-arrows-mode
         (aa--maybe-complain (quote ,cmd))))))

(add-annoying-arrows-advice next-line
'(ace-jump-mode) evil-next-visual-line '(evil-search-backward))

Evaulating this buffer gives the error:

Symbol's value as variable is void: evil-next-visual-line

This is a shame because I'd like to leave the third argument to the defmacro, namely evil-next-visual-line unquoted, just like next-line (the first argument) is.

Some really flaky behavior shows if I do the following:

(add-annoying-arrows-advice evil-next-visual-line '(smart-up) 'evil-next-visual-line '(evil-find-char-backward))

Now all of a sudden having evil-next-visual-line as an unquoted argument is okay!

How could this possibly be?


texts:
If I define a new mode using define-derived-mode or define-minor-mode, can the mode setup somehow signal failure so that the mode is not activated?

All of the following modes are activated despite the error.

(define-derived-mode foo-major-mode fundamental-mode "Foo"
  "Docstring"
  (error "Unable to set up Foo major mode"))

(define-minor-mode foo-local-minor-mode
  "Docstring"
  (when foo-local-minor-mode
    (error "Unable to set up Foo local minor mode")))

(define-minor-mode foo-global-minor-mode
  "Docstring"
  :global t
  (when foo-global-minor-mode
    (error "Unable to set up Foo global minor mode")))


texts: How do I change the mode indicators for evil-mode in the spaceline mode line package?

texts:
The mode line shows <N> or <I> or <V> and I would like it to show NORMAL, INSERT, VISUAL, etc.

I'm new to Emacs so my Elisp skills are non-existent.


texts:
I'm a beginner on emacs and I don't understand packages autoloading and use-package.
I see a lot of configs online which use 'use-package' and recommends installing packages with package manager (which autoloads them).
So in the end use-package seems useless because package manager does that autoload thing.
Though it seems interesting to use 'use-package' because it's clever.
So:

Should I disable package autoloading ? How ?
Should I use 'use-package' with autoloading anyway ? Is autoload off when I use 'use-package'

Also I cannot find good documentation on package autoloading, it seems like magic and It's never really good.


texts: Org-Mode: Link files with IDs and not Filenames

texts:
I want to use Org-Mode as a wiki so I need to have an index of all my org files. In it I want to have a list of links to all those files, but my problem is that I have found no way to link pages with IDs and not their names.

Obviously  I want the names of the files to not appear anywhere on the link. The reason for this is that I change the name of files regularly so if I use them, the links are going to break constantly. How can I achieve it?


texts: Emacs via X: how to use higher resolution fonts?

texts:
I have attached a screenshot of Emacs 24.5 running in X-Quartz in a Debian VM.  Does anyone know how to configure Emacs to use higher resolution fonts?  For instance, like the ones Mac Terminal.app is using in the same screenshot?

Thank you]1

 $ dpkg -l|grep emacs
ii  emacs24                               24.5+1-11+deb9u1                            amd64        GNU Emacs editor (with GTK+ GUI support)
ii  emacs24-bin-common                    24.5+1-11+deb9u1                            amd64        GNU Emacs editor's shared, architecture dependent files
ii  emacs24-common                        24.5+1-11+deb9u1                            all          GNU Emacs editor's shared, architecture independent infrastructure
ii  emacs24-el                            24.5+1-11+deb9u1                            all          GNU Emacs LISP (.el) files
ii  emacs25                               25.1+1-4+deb9u1                             amd64        GNU Emacs editor (with GTK+ GUI support)
ii  emacs25-bin-common                    25.1+1-4+deb9u1                             amd64        GNU Emacs editor's shared, architecture dependent files
ii  emacs25-common                        25.1+1-4+deb9u1                             all          GNU Emacs editor's shared, architecture independent infrastructure
ii  emacs25-el                            25.1+1-4+deb9u1                             all          GNU Emacs LISP (.el) files
ii  emacsen-common                        2.0.8                                       all          Common facilities for all emacsen


texts: ido mode keeps suggesting mismatching buffer name

texts:
Here is the relevant part of my configuration file:

(require 'ido)
(setq ido-enable-flex-matching t)
(setq ido-everywhere t)
(setq ido-auto-merge-work-directories-length -1)
(ido-mode 1)

The problem is, I want to create a new buffer named *work*, but ido mode keeps "suggesting" me to switch a buffer named *code-concersion-work*, despite their mismatching names. To make things more confusing, the suggested buffer doesn't even exist in the output of ibuffer.

How can I create a new *work* buffer?


texts:
I have Emacs running in deamon mode at /usr/bin/emacs --daemon

I have been told to start emacs as client I can type emacsclient -c -a "" $*

However, that command starts up a new version of the GUI emacs.

I am on Ubuntu and have both the GUI and non-GUI version of emacs installed but when I run that command I only want to connect to the non-GUI emacs daemon I have running.

I can get to this by typing emacs -nw but I use emacsclient -c -a "" $* so that any time a program opens with the default EDITOR (like a git commit message) it too opens in the emacs daemon.

How can I prevent the GUI emacs from opening?


texts: Can I modify whitespace mode to distinguish hard and soft newlines?

texts:
Currently, whitespace.el shows me newline characters by changing the display table to show a $ at the end of lines.

I don't actually find this useful, so I disable it while I enjoy the many other benefits of whitespace-mode.

When I'm composing emails in message-mode I want to show the newline characters that have the 'hard text property, because it affects how the flowed text shows up.

Can I hack this distinction into the display table logic of whitespace-mode?  My backup plan relies on longlines-show-hard-newlines but I'd prefer to extend  whitespace.el if possible.


texts: Caption and figure reference to .docx (org-export)

texts:
Captions and figure references by label are lost when converting .odt to .docx with Open Office.
Captions get hidden under the image and truncated by a box.
Numeric references are replaced by “Illustration”.

Is there a way to export to .docx from org-mode and preserve these feature?

MWE:

#+ATTR_ODT: :width 10
#+CAPTION: Caption text get hidden by image
#+LABEL: fig:label_image
[[file:./Carl_Spitzweg.jpg]]

See in figure [[fig:label_image]].


texts: How to run Python code and obtain its result in the minibuffer

texts:
I am using the following answer for How do you run Python code using Emacs.
I was wondering instead of opening python shell using C-c C-z and running C-c C-c to get results;
=> Can only the output results show up on the mini-buffer?
Opened Python shell buffer takes half of the window. I just want to see the output results in the minibuffer, or most compact buffer windows as possible.


texts: normal-erase-is-backspace-mode does not work over ssh when included in .emacs

texts:
In my .emacs file I have the following line:

(normal-erase-is-backspace-mode)

to change <backspace> to backwards delete and ^H to help over the terminal. Unfortunately when I use emacs with -nw over ssh, this mode is not applied. When I run M-x normal-erase-is-backspace-mode RET after emacs is loaded, the mode is applied.

Is there a way to make normal-erase-is-backspace-mode work as expected (e.g. by executing (normal-erase-is-backspace-mode) after loading emacs)?

My Emacs version 23.1.1


texts: Generate mouse-2 event from MacBook trackpad

texts:
I have Emacs.app version 24.5 (9.0) on a MacBook with Mac OS X 10.11.3 (15D21). How can I generate mouse-2 from my MacBook's trackpad? I've googled and found references to mac-emulate-three-button-mouse (this question) (not found in such Emacs version) and similar tricks that do not work.

It is possible to generate such an event, or there is some other way, like binding globally something like s-<mouse-1> to <mouse-2>, etc.?


texts: mypy FileNotFoundError: [Errno 2] No such file or directory: '.mypy_cache/3.8/utils.data.json'

texts:
I keep having following warning message, even I have the recent version of python-mypy not sure why this warning message is generated; is there any way to fix this:
Try installing a more recent version of python-mypy, and please open a bug report if the issue persists in the latest release.  Thanks!
Suspicious state from syntax checker python-mypy: Flycheck checker python-mypy returned 1, but its output contained no errors: Traceback (most recent call last):
  File "/home/alper/venv/bin/mypy", line 8, in <module>
    sys.exit(console_entry())
  File "/home/alper/venv/lib/python3.8/site-packages/mypy/__main__.py", line 11, in console_entry
    main(None, sys.stdout, sys.stderr)
  File "mypy/main.py", line 90, in main
  File "mypy/build.py", line 180, in build
  File "mypy/build.py", line 254, in _build
  File "mypy/build.py", line 2638, in dispatch
  File "mypy/build.py", line 2957, in process_graph
  File "mypy/build.py", line 3032, in process_fresh_modules
  File "mypy/build.py", line 1960, in load_tree
  File "mypy/metastore.py", line 98, in read
FileNotFoundError: [Errno 2] No such file or directory: '.mypy_cache/3.8/utils.data.json'

Try installing a more recent version of python-mypy, and please open a bug report if the issue persists in the latest release.  Thanks!

When ever I open .emacs this message pops-up in the mini-buffer. I keep seeing this error message in the mini-buffer and it is very annoying. Can I completely make it disable? Is it possible to completely ignore this message?

my setup:
$ pip freeze | grep mypy
flake8-mypy==17.8.0
mypy==0.800
mypy-extensions==0.4.3


texts: Whenever I create an Org file, a ~ backup file is created. How can I prevent this behaviour?


texts: How can I keep dired in sync with a shell buffer?

texts:
I have some work that requires I move around between various sub-directories. Thus, the easiest way I have found to do that is to use dired. I also have to view some files (plain text or code), so another benefit is I can just hit RET on the filename to do that. However, I sometimes need to run shell commands on these files. Before I used Emacs, I would just use Bash (navigating with pushd and popd, which is less convenient than dired), so this allowed me to run the commands I needed.

How can I easily combine the best of both methods? I see a couple options:

Somehow keep a shell buffer in sync with the dired buffer. (Maybe somehow trigger pushd/popd/cd?)
Set up some keyboard shortcuts for the shell buffer, to simulate movement and file viewing (the latter especially seems more difficult).
Something else?

Note that I would prefer not to call shell-command (M-!) every time, because it is harder to execute multiple commands in quick succession, and interact with the command output, in addition to having a less-than-convenient default keybinding.


texts: Page up in Mac OS X and in Ubuntu under Virtualbox in Mac OS X?

texts:
What are the keystrokes for page up

In Mac OS X,
In Ubuntu installed in Virtualbox in Mac OS X?

both alt-V and command-V don't perform page-up.

I am running emacs in a terminal emulator.

Thanks.


texts: how to check if a babel block finished the execution

texts:
I am searching for a piece of emacs-lisp code that checks if an emacs-babel block finished its execution.

I am trying to write smth like

(while (babel-block not finished its execution)
       (sleep-for 0.1))

(do smth)

Thank you in advance.

I will maybe try to be more specific to foster the understanding.

I have the following piece of code for executing a babel block after the cursor.

(defun execute-after-cursor ()
  "Execute the block up until after the cursor"
  (interactive)
  (let* ((el (org-element-context))
       (p (point))
       (language (org-element-property :language el))
       (switches (org-element-property :switches el))
       (parameters (org-element-property :parameters el)))

      (insert (format "\n#+END_SRC
                     ,#+BEGIN_SRC %s %s %s\n" language (or switches "") (or parameters ""))))

    (org-babel-execute-src-block)
    (previous-line 3)
    (kill-line 3)
)

The issue is now that when I execute the above in EIN; I do not get the results displayed. I noticed that if I put a time (sleep-for 1) it works. I guess that EIN binds the results to the named babel block and if emacs deletes the name of the cell before EIN finishes the execution works but the results do not show.

Hope this gives you a better intuition of why I need the piece of code above.


texts: Errors using calc-degrees-mode with calc-base-units

texts: In algebraic mode, with calc-degrees-mode arctan(ga/(9.8 m/s^2)) gives 0.7857 (close pi/4 radians) instead of 45°. I'm converting units with calc-base-units, bound to u-b. Is it a bug or is there another way to make the units simplification ?


texts: Org-mode Agenda view - how to turn on and off tasks with deadlines

texts:
In my work routine, I schedule tasks to days of the weeks according to their urgency and effort levels. If there is a deadline of a scheduled task two of them (one entry for deadlined and one for scheduled) are shown in the agenda view of the current day.

Although I can remove scheduled entry by

(setq org-agenda-skip-scheduled-if-deadline-is-shown t),

it is not the solution that I am after since some of the deadlines that I will work on later still show up on the agenda view.
I like to see scheduled items instead of the deadline since I am also viewing efforts of the item. However, from time to time I need to see deadlined items so that I can schedule the tasks to the days of the week.

What I really want to do is turning on and off deadlined items when I need to. There should be an easy command but I could not find it, I would appreciate any help.

Best,


texts: In latex-mode is it possible to disable auto-fill-mode in between `\begin{figure}, \end{figure}`

texts:
I am working on tex files with LaTeX-mode.
If possible, I want to use auto-fill-mode  in some conditions. I was wondering is it possible to disable it in  between some patterns like:
\begin{figure}[ht]
…
\end{figure}

where I want to apply auto-fill-mode only for pure text? and not apply it under \begin{figure} ... \end{figure} or any matematical formula notations.


texts:
That is, how can I (from Lisp) create a frame similar to the one that x_create_tip_frame (called by x-show-tip in the C sources) creates when x-gtk-use-system-tooltips is nil?

My original guess was that the relevant part of the C code was this call:

x_default_parameter (f, parms, Qborder_width, make_number (0),
             "borderWidth", "BorderWidth", RES_TYPE_NUMBER);

Unfortunately, neither (set-frame-param (selected-frame) 'border-width 0) nor (make-frame '((border-width . 0))) (both inspired from the call above) yield a borderless frame. Still, x-show-tip works fine, so there must be a reliable way :)

Bottom line: How do I create a frame without a border added by the window manager?


texts: How to toggle regex for helm/ivy user input?

texts:
IIUC, all helm commands (including helm-swoop, swiper-helm) have regex enabled by default for user input.  Can we toggle/disable it by some command/shortcut?  Let me know if I missed something.

Using isearch as an analogy: default helm is similar to isearch-forward-regexp that always uses regex engine. Do we have helm-no-regex that is similar to isearch-forward which doesn't use regex?

For example, in helm-mini, when I search for "xy .c", I would like to match files like "xy_test.c", but not "xyzc.h".  I know that we can escape the '.' (i.e., search for "xy \.c"), but I would like to escape all regex symbols by default.  Is it possible?

I guess a possible solution is to pre-process input string by escaping all special characters?

(If it's not possible for helm, how about ivy/counsel/swiper?)


texts: How do I clear a buffer completely with elisp?

texts: If I want to delete everything in a buffer with elisp, how do I do that?


texts: Shortcut to restart sql-postgres process from sql-mode buffer?

texts:
Is there a shortcut key or command in Emacs (25.x under Unbuntu 18.04 LTS) to restart the sql-postgres process?

I need to quit and restart sql-postgres very often (for debugging purposes). Currently, my work flow is to

switch to the sql-postgres window/buffer
type \q
M-x sql-postgres again.

This is OK for occasional use, but I was wondering if there's a faster way to restart the database connection in one key combination.