texts: Can't run Windows 10 Bash with ansi-term

texts:
I've got this error, when running M-x ansi-term C:/Windows/System32/bash.exe RET

Spawning child process: invalid argument

after running M-x debug-on-entry RET start-process RET when running M-x ansi-term I've got this stack trace:
Debugger entered--entering a function:
* start-process("terminal" #<buffer *terminal*> "/bin/sh" "-c" "stty -nl echo rows 20 columns 97 sane 2>/dev/null;if [ $1 = .. ]; then shift; fi; exec \"$@\"" ".." "C:/Windows/System32/bash.exe")
  apply(start-process "terminal" #<buffer *terminal*> "/bin/sh" "-c" "stty -nl echo rows 20 columns 97 sane 2>/dev/null;if [ $1 = .. ]; then shift; fi; exec \"$@\"" ".." "C:/Windows/System32/bash.exe" nil)
  term-exec-1("terminal" #<buffer *terminal*> "C:/Windows/System32/bash.exe" nil)
  term-exec(#<buffer *terminal*> "terminal" "C:/Windows/System32/bash.exe" nil nil)
  make-term("terminal" "C:/Windows/System32/bash.exe")
  term("C:/Windows/System32/bash.exe")
  funcall-interactively(term "C:/Windows/System32/bash.exe")
  call-interactively(term record nil)
  command-execute(term record)
  execute-extended-command(nil "term" nil)
  funcall-interactively(execute-extended-command nil "term" nil)
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)

It try to execute /bin/sh on Windows, is this correct? I'm using GNU Emacs 25.3.1 installed from choco.
M-x term was working but after I've try to fix ansi-term it stops, but the issue was that I have ssh-add in my .bashrc and it didn't work. I couldn't enter the pass phrase.
EDIT: after a while I've learned that on Windows only eshell is working , since most shells depend on internals of Linux system. The option may be to install Emacs inside WSL.


texts:
In a nutshell, the problem I'm having is that evaluating the expression

(read-char "some prompt")

sometimes fails to show the specified prompt (but works as expected otherwise).

Unfortunately, from my perspective, the problem shows up completely randomly.  I'm sure it is not really random; it just looks this way to me, because I have no idea of what's going on.

As a result of this complete unpredictability, I can't guarantee that the silly example below will reproduce the problem.  I show it only to describe the setting.

(defun foo (arg)
  (interactive "P")
  (let ((read-1-char (lambda () (string (read-char "Type one char" t)))))
    (let ((bar
           (cond ((equal arg '(4)) (funcall read-1-char))
                 (t (error "foo: the C-u prefix is required")))))
     (message ">%s<" (prin1-to-string bar)))))
(global-set-key (kbd "C-c M") 'foo)

The intended behavior of this code is that, if one types C-u C-c M, the message Type one char will appear in the minibuffer; if one then types, say, x, the message >"x"< will be displayed.

In some cases, however, after typing C-u C-c M, instead of Type one char, the "message" in the minibuffer is just C-u C-c M-.  (The subsequent behavior remains the same; e.g., if the user then types x, the message >"x"< does get displayed.)


texts: OrgMode, Is it possible to group options and pass them to LaTeX listings?

texts:
I have got an Org buffer like

#+LaTeX_CLASS_OPTIONS: [a4paper]
#+LATEX_HEADER: \usepackage{listings}
* How to group ATTR_LATEX options?
#+ATTR_LATEX: :options language=bash,basicstyle=\small\ttfamily, numbers=left,numberstyle=\tiny,numbersep=3pt,frame=tb
This is a demo of what the listings package produce.
#+BEGIN_SRC sh
echo "hello world"
#+END_SRC

Which I can export to LaTeX. However, I would like to group the options passed to the LaTeX listings by defining a macro for the lstlisting environment. For example, I want Org Mode to generate something like :

\documentclass{article}
\usepackage{xcolor}
\usepackage{listings}
\lstdefinestyle{BashInputStyle}{
    language=bash,
    basicstyle=\small\ttfamily,
    numbers=left,
    numberstyle=\tiny,
    numbersep=3pt,
    frame=tb
}
\begin{document}
\section{How to group ATTR\(_{\text{LATEX}}\) options?}
This is a demo of what the listings package produce.
\begin{lstlisting}[style=BashInputStyle]
echo "hello world"
\end{lstlisting}
\end{document}

I am able to get the lstdefinesstyle into the LaTex buffer with:

#+LATEX_HEADER: \lstdefinestyle{BashInputStyle}{language=bash,basicstyle=\small\ttfamily, numbers=left,numberstyle=\tiny,numbersep=3pt,frame=tb}

However, I do not know what do to go get that definitions exported to \begin{lstlisting}[style=BashInputStyle]. Any advice ?


texts: Memory Profiler reporting error upon profiler-report

texts:
After calling profiler-report after doing profiler-start and selecting mem I get the following error:

maphash: Wrong type argument: number-or-marker-p, unbound

Any Idea why?


texts: When split-window-sensibly is called, how to make the decision depend on the width height ratio?

texts: I would like to have split-window-sensibly splitting the window horizontally if the width is larger than height, or vertically otherwise. How can I achieve this?


texts: Where is cl-constantly and what to use instead?

texts:
In Common Lisp, there is
constantly
function, which creates new function without side-effects that takes any
number of arguments and always returns specified value.

For some reason cl-lib doesn't provide cl-constantly, so I guess it
should exist in pure Emacs Lisp under different name. Do you know that name?

Please don't post answers showing how to achieve effect of constantly manually (and how to define such function), since it's absolutely trivial. This question about name of already existing function. If there is no such function, a comment about the fact will do. I've sent a bug report asking to add the function.


texts: When I save my file, I can see output of some commands in the echo area. The thing is, that it's very fast and the next message will overwrite the previous one. So I just see the message Wrote FILE. Is there a way, how can I look on the previous messages?


texts: Tag inheritance respecting mutual exclusivity in org mode

texts: Is it possible to have tag inheritance respect mutually exclusive tag groups in org-mode? What I would like to do is set a default tag on a top-level entry, and override it with one of the other tags in a mutually exclusive group on some children in the tree. My expectation is that the child tag would override the ancestor because they are mutually exclusive. But currently this doesn't work as the child will have both the ancestor tag and its own, even though they should be mutually exclusive.


texts: Use PDFView as default AucTex PDF Viewer

texts: I'd like to use PDFView mode as the default PDF reader when editing LaTeX code in AucTeX, using Emacs 24. For example, after compiling with C-c C-c, redoing this command would open the PDF file in a second buffer in the same window, using PDFView mode instead of Doc View.


texts: url-retrieve-synchronously on github doesn't return any response

texts:
Running the function

(url-retrieve-synchronously "https://api.github.com/users/lawlist/gists")

returns an empty buffer.  This only happens with github.

What could possibly be the cause?


texts: Add whitespace as indentation with `indent-region`

texts:
When using indent-region, emacs will indent code and leave bank spaces untouched. It seems to me that the majority prefer to delete whitespace. However I prefer white space indented with the code. An example is shown below.

void foo(){
    do_something();
--->
    do_something_else();
}

Let's say that the code is wrapped in an if block, then using indent-region the result is as follows.

void foo(){
    if(...){
        do_something();
--->
        do_something_else();
    }
}

How would I edit my .emacs file to include the whitespace with the indentation? The result should be the following.

void foo(){
    if(...){
        do_something();
------->
        do_something_else();
    }
}

Also note that I have replaced the electric-indent-post-self-insert-function with one that does not delete whitespace.


texts:
it's not clear for me how should I set use-package to load a package when a mode is activated.

I have read different things about :mode, :init :config and I am now confused.
Could someone explains it to me ?

A good exemple to me would be to start yasnipped in prog-mode.


texts: Cannot jump to definition in js2-mode or Tern

texts:
I am performing Nodejs development in emacs, but my environment seems incorrect. For example, when I run ac-js2-jump-to-definition, I get "no jump location found" in the minibuffer. Also when I run 'tern-find-definition`, I get "No definition found.".

How can I correctly jump to a Javascript definition in emacs?

Here is a sample of code, where I am using the "jump-to-definition":

In auth.js, I have this:

module.exports = function (options) {
  options = options || {}
  auth = {}

  auth.someFunction = function () {
    return "someFunction has been called"
  }

  return auth

}

Then I call auth from here:

var auth = require('auth')()
auth.someFunction()

But it does not work when I put the point over someFunction() above and run M-x ac-js2-jump-to-definition or tern-find-definition. Also, when I run js2-next-error, the require function in require('auth')() above is selected and gives the message "Undeclared variable or function 'require'".

I suspect that my Javascript environment is incorrect, but I don't know what it is. Any suggestions would be appreciated.

Here is my relevant configuration from my init script:

;; JAVASCRIPT-MODE

;; js2-mode provides 4 level of syntax highlighting. They are * 0 or a negative value means none. * 1 adds basic syntax highlighting. * 2 adds highlighting of some Ecma built-in properties. * 3 adds highlighting of many Ecma built-in functions.
(setq js2-highlight-level 3)

(add-hook 'js2-mode-hook
          (lambda ()

            ;; allow window resizing via M-l and M-h
            (local-unset-key (kbd "M-l"))
            (local-unset-key (kbd "M-h"))
            (local-unset-key (kbd "M-j"))

            (local-set-key (kbd "C-j") 'ac-js2-jump-to-definition)
            (local-set-key (kbd "C-c C-n") 'js2-next-error)
            (define-key js2-mode-map (kbd "C-j") 'ac-js2-jump-to-definition)
            (linum-mode)
            (js2-reparse t)
            (ac-js2-mode)))

(add-to-list 'interpreter-mode-alist '("node" . js2-mode))

(add-to-list 'auto-mode-alist
      '("\\.js$" . js2-mode))

(require 'js2-refactor)
(js2r-add-keybindings-with-prefix "C-c C-m")
(add-hook 'js2-mode-hook #'js2-refactor-mode)

(add-to-list 'load-path "~/.emacs.d/tern/emacs/")
(autoload 'tern-mode "tern.el" nil t)
(add-hook 'js-mode-hook (lambda () (tern-mode t)))


texts:
When typing ls in my home directory, I amm greeted by a lot of this:

#%2Ascratch%2A#1399_po# #%2Ascratch%2A#14484YsZ# [...]

I also have the following in my init.el

(defvar autosave-location (concat user-emacs-directory "data/autosave"))

(setq auto-save-file-name-transforms
  `((".*" ,autosave-location t)))

Why, then are the scratch autosaves not being sent to ~/.emacs.d/data/autosave and instead are being blasted around my file system? Ideally, I just want it to save to that folder, however if that can't be done, disabling autosave for *scratch* buffers entirely would suffice.

I believe this started with Emacs 24.4.


texts:
What is the right way to perform hierarchical logging in Emacs Lisp?

As a representative example…

(scoped-message
 "baking cake"
 (progn
   (scoped-message
    "making batter"
    (progn
      (scoped-message "whisking eggs" (whisk-eggs))
      …))
   …))

I would like to see something like baking cake → making batter → whisking eggs in the Messages butter and in the mode line.

Is there a library, macro, or standard idiom that makes this easy?

The library straight.el does this when building dependent libraries (e.g. building org-drill → org-contrib), but it's built in a very custom way. Is there a standard solution available?


texts: Dired ranger not working loading it with use-package

texts:
I added the package dired-ranger using use-package, but when I open a folder with dired C-x d , I see the regular single panel instead of the two or three panels from dired-ranger.
I'm loading the package like this:
;; --- Dired Ranger ---
;; Loads dired-ranger
(use-package dired-ranger
  :ensure t
  :bind (:map dired-mode-map
              ("W" . dired-ranger-copy)
              ("X" . dired-ranger-move)
              ("Y" . dired-ranger-paste))
  ;; C-u W  to keep adding files to the ring

  )


texts:
I'm trying to configure company-mode to activate in all buffers, with the appropriate back-ends depending on file-type. To that end, I've added the following to my init.el file. However, regardless of which file-type I open, company-mode does not automatically activate. Help in sorting this out is appreciated.

;; Enable global company mode
(require 'company)
(add-hook 'after-init-hook 'global-company-mode)
(setq company-idle-delay 0.1)
(setq company-minimum-prefix-length 1)
(setq company-backends '((company-capf company-files company-elisp company-inf-ruby company-anaconda company-go company-irony company-clang company-cmake company-css company-yasnippet) (company-dabbrev company-dabbrev-code)))

Complete init.el posted here: http://pastebin.com/eyvvzUPW


texts:
Suppose I has text:

test hello

The cursor is after word test. I need to insert random number? Also I need to set range of random (e.g. from 0 to 1000)

The result maybe like this:

test100 hello


texts:
At times, especially when taking notes, a literate org file can contain one-line source blocks, as follows:

* Taking notes
:PROPERTIES:
:tangle: whatever.pl
:comments: org
:END:

Perl set command
#+BEGIN_SRC perl
set $random_var=1;
#+END_SRC

Perl unset command (just making it up... :P)
#+BEGIN_SRC perl
unset $random_var;
#+END_SRC

For such applications, the #+BEGIN_SRC...#+END_SRC pragma looks to be an overkill. Easy templates reduce the typing, but the org doc still looks a bit overflowing.

Is there an easy way to do this? I know that a line starting with a : gets to verbatim text automatically. Is there a way to do something similar with org-tangle?

I am looking for a solution something like this, or at least close to these lines, while still retaining the source highlighting and tangling facilities for parent mode:

* Taking notes
:PROPERTIES:
:tangle: whatever.pl
:comments: org
:mode: perl
:END:

Perl set command
: set $random_var=1;

Perl unset command (just making it up... :P)
: unset $random_var;

It's cleaner, easy to look at and, IMHO, a bit less noisy.

Any suggestions would be appreciated. Thanks in advance!


texts: Save output from ob-mermaid to the org-attach director

texts:
I have recently started playing with the fantastic ob-mermaid (and its companion mermaid-mode) package. Combined with the mermaid CLI, these let you generate mermaid diagrams from org-babel source blocks. ob-mermaid requires a :file argument but I am wondering whether there is a way to redirect this to the default org-attach director?

Here is an example code block:

#+BEGIN_SRC mermaid :file graph_td.svg

graph TD
  start --> stop

#+END_SRC

Any ideas?


texts: Date range queries for Custom Properties

texts:
While capturing I set a custom property CREATED like:

* Mynote
:PROPERTIES:
:CREATED: [2017-10-12 17:40]
:END:

How can I create an agenda view which contains all the Items I created this week?

(I am aware of file+olp+datetree to capture items in a datetree but I regulary refile them to a "proper" location, so this tree doesn't help me)


texts:
Using Emacs with Evil Mode, I wonder if there's a way to quickly re-enter all the characters that were typed before a whitespace character is entered.

Example: you type \hat{\beta}_{OLS,j} and then you add a whitespace  , now you want to re-type \hat{\beta}_{OLS,j} automatically, so that in the end you have

\hat{\beta}_{OLS,j} \hat{\beta}_{OLS,j}

Example 2: you type foo foo complicated_formula and then enter a whitespace , now you want to retype complicated_formula automatically, so that in the end you obtain:

foo foo complicated_formula complicated_formula

How can I achieve this functionality? Is there something similar or better than this already available?

Thanks for helping me out! Keep in mind I'm extremely newb. Thanks again! :D


texts: How can I setup eshell to use ivy for tab completion?

texts: I'm very fond of ivy for completion and love that a simple (ivy-mode 1) is enough to get ivy almost everywhere that Emacs uses some sort of completion (that is acomplished by overriding completeing-read, I believe). But this doesn't setup eshell to use ivy for tab completion. I do like eshell's list of completion candidates, but would prefer the ivy UI to pick among them. Is there some way to reuse whatever eshell does to produce completion candidates and hand that off to `ivy'?


texts: org-agenda TODO list gives error "trying to switch to non-existent buffer"

texts:
I just started emacs with doom-emacs.  I open my org-agenda with SPC o A then t to my TODO list.
When I try to go to one of the TODO items with a ENTER, sometimes I'm given the following error.
Trying to switch to non-existent buffer

Am I doing something wrong?


texts:
I like the way org-capture works, it promotes a buffer for selecting
predefined templates. I am trying to do something similar for setting
variables.

For example, I have three HTML themes, one for office, one general
use, and one for journal. I am trying to define a
choose-html-themes() function which has similar behaviour.

I defined a list of options,

(setq html-themes-list
  '((Office . "<link rel=\"stylesheet\" ..... " )
    (General . "<link rel=\"stylesheet\" ..... ")
    (Journal . "<link rel=\"stylesheet\" ..... "))

When I call choose-html-themes function, then type

"o" to set the /entry/ variable to "Office"
"g" to "General"
"j" to "Journal".

Then it will look up the list using entry as key, and set
the org-html-head variable to the returning value, something like

(setq org-html-head (assoc entry html-themes-list))

I wonder how to popup a buffer, and capture keyboard input from that buffer?


texts:
I'm really confused with the . notation. Is '(a . b) a list?

(listp '(a . b)) returns t but when I want to know its length (length '(a . b)) gives an error Wrong type argument: listp, b. The same is for other functions as nth,mapcar etc. they all give the same error

Is there any function which can I distinguish between '(a b) and '(a . b)?

Context: I encountered this problem when I wanted to implement recursive version of mapcar. Here is my implementation

(defun true-listp (object)
"Return non-`nil' if OBJECT is a true list."
(and (listp object)  (null (cdr (last object)))))

(defun recursive-mapcar (func list)
"Evaluates func on elements of the list, then on elements of elements  of the list and so forth."
(let ((output nil))
(flet ((comp (a b) nil)
       (call-fun-and-save (x) (add-to-list 'output (funcall func x) t 'comp))
       (recursion (l)
                  (mapcar
                   (lambda (x)
                     (call-fun-and-save x)
                     (if (and (true-listp x))  ;; HERE I use true-listp, testing for list or cons is not sufficient
                         (recursion x)))
                    l)))
   (recursion list))
  output))

I use this to extract all specific tags from parsed html. Example of html to parse

;; buffer 'html'

  Jill	  Smith	  50

  Eve	   Jackson	   94

Then I extract all  as

(with-current-buffer (get-buffer "html")
  (let ((data (libxml-parse-html-region (point-max) (point-min))))

    ;; gat only  tags
    (-non-nil
     (recursive-mapcar
      (lambda(x) (and (consp x) (equal 'td (car x)) x))
      data))
    data
    )
  )


texts: Complex multi machine init setup: suggestions on improving the Lisp code

texts:
I'm trying to configure my org based init file to work on 2 different machines where some of my org file would be accessed remotely.
For example I want to define within the same config different org capture based on which machine I'm currently on (hostname).

I have this initial code:

(when (string= system-name "home")

(add-to-list 'org-capture-templates
'("z" "web capture " item
         (file+headline "/home/zeltak/org/files/web/wbookmarks.org" "Temporary Links")
         "%?\nEntered on %U\n \%i\n %a"))
)

(when (string= system-name "work")

(add-to-list 'org-capture-templates
'("z" "web capture " item
         (file+headline "/sshx:work:~/org/files/wbookmarks.org" "Temporary Links")
         "%?\nEntered on %U\n \%i\n %a"))
)

I have 30 captures like this where I have to reproduce for both machines. I am sure there is a more intelligent way to do this and am looking for suggestions. Perhaps define a Path variable that changes based on machine?


texts: Managing my bookmarks and the related file .emacs.bmk

texts:
Is there a way to change the location of the file .emacs.bmk? I tried doing it but then my bookmarks would not be found. I could not find how to customise the location of this file (similar issue with .emacs.d). Now I have a symlink but I would rather declutter my home folder.

Also, I just deleted a lot of my bookmarks from the list (using C-x r l (bookmark-bmenu-list) then d for the bookmarks to delete, x to execute) and the bookmarks were deleted (I can't find them using C-x r b) but they are all still in the file .emacs.bmk . Why is that the case? How can I delete bookmarks and have them removed from .emacs.bmk?


texts: should I gitignore my elpa/gnupg directory?

texts:
I keep ~/.emacs.d/ under version control with git. I used to gitignore the elpa/ directory, but recently started including it in case I ever want to rollback a package upgrade.

I just noticed an untracked directory on my work machine: ~/.emacs.d/elpa/gnupg/. I'm not sure where it came from. I remember trying to set up a gnupg key at some point on this machine, but I don't know if that's the cause.

Should I gitignore it? I don't understand it's role well enough to say for sure.


texts:
I am writting a LaTeX document using org-mode, and there is a section where I want to include a proof, which has the following code.

#+LaTeX_HEADER: \newcommand{\dem}[1]{\textcolor{gris}{\small{Demostración. #1}}}

If I write

\dem{(1) Esto es una demostración}

There is nothing wrong when exporting to LaTeX, and the text appears formated correctly. However, if I add an equation with some braces in it, like

\dem{Esto es una demostración con ecuación: \(x = x^{-2}\)}

then, the document is exported as

\dem\{Esto es una demostración con ecuación: \(x = x^{-2}\)\}

and the format is not correct. Is there any way I can "escape" those curly braces in my org-mode text to format the text correctly?


texts: Using the `:set` and `:initialize` keywords of `defcustom`

texts:
I recently encountered a situation in which specifying a :set function for a defcustom raised a Symbol's function definition is void error.

This is because the :set function relies on another function in the same package, which is not yet loaded when the defcustom is initialized.

The way I handled this is to explicitly define the :initialize function to be custom-initialize-default. Is this the best way? If I wanted to use the :set function for initialization, how best to do that[1]?

[1]: Elisp does not have forward declaration AFAIK; declare-function doesn't seem to work for functions in the same file


texts:
I'd like to match either word start or subword start in a simple way.

So I went with this regex: "\\(\\b\\sw\\)\\|\\(?:[^A-Z]\\([A-Z]\\)\\)".

Note that I want to skip [^A-Z] and only get the bounds for [A-Z], otherwise it would be simple.

What I expected: since there are two capturing groups, tied with an \\|, (match-string 1) should give me what I want.

What I got: if a word start matches it's in (match-string 1), and if a subword start matches it's in (match-string 2).  That seems pretty useless with no chance to collect the matches in a generic way.  How could I rebuild the regex to have both cases in (match-string 1)?


texts: org-shift[up/right/left/down] gives error on Org Clock Table pattern `yyyy-mm-dd`

texts:
I am having an issue viewing my time logged for individual days. I want to easily traverse through each day, and view the Org Clock Table for that day. When my pointer is on the clock table's config row that starts with #+BEGIN, I can easily traverse through each week using org-shift[up/down/left/right]. For example, with my pointer on the line #+BEGIN: clocktable :scope tree :maxlevel 4 :block 2016-W01 :step day :link, I can press S-right to traverse to the next week by changing the :block 2016-W01 to :block 2016-W02, which updates my org clock for that week.

But org-shift does not work on the date pattern when it is defined for a specific day. For example, on the second Org Clock Table in my example below, I changed 2016-W01 to 2016-01-05, in an effort to traverse each day instead of each week. But now, org-shift[up/down/left/right] does not work. I want to easily move through my timesheet and traverse 2016-01-06, 2016-01-07, etc. but org-shift gives me the error: org-clocktable-shift: Wrong type argument: integerp, nil.

* tasks

#+BEGIN: clocktable :scope tree :maxlevel 4 :block 2016-W01 :step day :link

Daily report: [2016-01-04 Mon]
| Headline     | Time   |
|--------------+--------|
| *Total time* | *0:00* |
#+END

#+BEGIN: clocktable :scope tree :maxlevel 4 :block 2016-01-05 :step day :link

Daily report: [2016-01-05 Tue]
| Headline          | Time   |      |      |      |
|-------------------+--------+------+------+------|
| *Total time*      | *1:20* |      |      |      |
|-------------------+--------+------+------+------|
| [[file:nil::tasks][tasks]]             | 1:20   |      |      |      |
| \_  [[file:nil::Community][Community]]     |        | 1:20 |      |      |
| \_    [[file:nil::Contractors][Contractors]] |        |      | 1:20 |      |
| \_      [[file:nil::more%20work][more work]] |        |      |      | 1:20 |
#+END

** Community
*** Contributors
**** getting work done
:LOGBOOK:
CLOCK: [2016-01-06 Wed 19:30]--[2016-01-06 Wed 21:30] =>  2:00
:END:

*** Contractors
**** more work
:LOGBOOK:
CLOCK: [2016-01-08 Fri 19:38]--[2016-01-08 Fri 21:38] =>  2:00
CLOCK: [2016-01-05 Tue 16:10]--[2016-01-05 Tue 17:30] =>  1:20
:END:

I investigated a little further, and I found that org-shift[up/down/left/right] works when I use the form [2016-01-06 Wed] for my :block (ie using the line #+BEGIN: clocktable :scope tree :maxlevel 4 :block [2016-01-05 Tue] :step day :link for my table below), but the Org Clock Table does not recognize that format. Is there a fix for this issue? Are others experiencing this same issue? Should I file a bug?

Or, is there an easier way to traverse daily Org Clock Table reports, via :step day?


texts: Why must I set and reset `buffer-multibyte` to correctly view multibyte buffers?

texts:
In an ongoing project, we are inserting multibyte text into a
buffer and experiencing strange behavior.  When the question is first
viewed, we receive something like:

Quote Environment à la Strunk\341\200\231s \342\200\230The Elements of Style\342\200\231

which, obviously, should be

Quote Environment à la Strunk’s ‘The Elements of Style’

Note the special quotes; reference question here.  Interestingly, using

(set-buffer-multibyte nil)
(set-buffer-multibyte t)

in succession will fix the issue.  Note not one or the other, but both in this order. What is going on here?  It's interesting to note that à is correctly displayed.

Shameless plug: that ongoing project posted this question.


texts: Why emacsclient say to quit with C-x 5 0?

texts: As soon as I open emacsclient I found the following message in the minibuffer: When done with this frame, type C-x 5 0, I find it strange that it advices how to close the frame with delete-frame, any reason to display the message or prefer it over C-x C-c in this case?


texts: In emacs while using M-x replace-regex, the expression matches except when i put a ^ and $ at the beginning and end. This is confusing to me!

texts:
The search query is : ([\s]*print)[^(](.*)

It matches, BUT when I put ^ and $ like this :
^([\s]*print)[^(](.*)$, it doesn't.

Again both work in search-forward-regex but the 2nd one does not work in replace-regex. I was curious about this behavior


texts: Detect when a key is rebound to another command

texts:
First, some context:

I am in the process of debugging a strange interaction between smartparens and Org Speed Keys:

After editing an .org file for a while, specific speed keys for navigating the outline start to be treated as though they are modifying the buffer. For instance, if I press n on a heading after saving the file, the portion of the mode line that indicates whether the file has been modified or not changes from -- (unmodified) to ** (modified). No characters are inserted into the buffer though.

I tried to figure out what might be causing this problem by doing C-h k n right after opening the .org file and then again after the problematic behavior started. Turns out that initially, n is bound to org-self-insert-command, and gets rebound to sp--self-insert-command later on.

The problem is that I have no idea when the command bound to n changes. I also tried C-h l (view-lossage) a few times after the behavior changed but I couldn't detect any patterns that would give me a hint as to what might be triggering the change in behavior.

Question:

I think in order to solve this problem I need to pinpoint the exact command that is causing n to be rebound to sp--self-insert-command (if only to be able to automatically reset the binding).

So my question is: How can I detect when the command bound to n changes?


texts: How to know which function triggered an autoload of a library

texts:
How can I monitor when Emacs loads a library because of an autoloaded function, and also know the name of that function?

EXAMPLE:  I type M-x eval-buffer in a buffer where one of the functions uses setf (and I have not previously used this function during my Emacs session).  I would like to see a message similar to:  "setf called within name-of-function, causing it to load macroexp.el by virtue of a require statement within gv.el."

Here is a start ...

  (defun load-tracing-function (orig-fun &rest args)
  (message "`load' called with args %S" args)
  (let ((res (apply orig-fun args)))
    (message "`load' returned %S" res)
    res))
(advice-add 'load :around #'load-tracing-function)

(defun require-tracing-function (orig-fun &rest args)
  (message "`require' called with args %S" args)
  (let ((res (apply orig-fun args)))
    (message "`require' returned %S" res)
    res))
(advice-add 'require :around #'require-tracing-function)


texts: Test existence of org "special source editing" buffer

texts: How can I test whether an Org "special source editing" buffer exists?


texts: Org mode table- make entire column to contain checkbox

texts:
I have a table like this using Org mode (by typing |-- and then tab to complete

|-- Item-- |--Notes---|
| blah blah|blah blah |

Now I would like to add another column just before Item and contains checkbox.  This is so that I can go down the table and check which item I have done.  I know another way to do this is via a simple todo list. However, I would like to know how to do this via table.

In other words, I want:

|--Check--  |-- Item-- |--Notes---|
|  [    ]   | blah blah|blah blah |

And so on and so forth. I would like to be able to do C-c-C-C on [ ], as I move down the column and it would check X in the box.

In contrast to the example above, my actual table is very long (around 7 columns and 15 rows)


texts: Alias doesn't work for aptitude search in Eshell

texts:
alias works very well in Eshell. I've used it like this:

alias sau sudo aptitude update

However, it doesn't work for the search command:

$ alias aps aptitude search
$ aps emacs
search: You must provide at least one search term

What's wrong with this?


texts:
Q: how can I get the last time I built the org agenda buffer?

I've set an idle timer to rebuild my org agenda buffer every x minutes.  It works fine, but it's inefficient to rebuild if the agenda files have not been modified since the last rebuild.

I can get the last modification time of, say, the first agenda file with (nth 5 (file-attributes (car org-agenda-files))) and compare it to some hypothetical last-agenda-rebuild variable with time-less-p.  However, I don't know where to look for the last rebuild time (or if it's even stored anywhere).


texts: Misaligned chart in the habits agenda mode in orgmode

texts: After upgrade from Ubuntu 18 to 20 my agenda habits chart now is broken. Any ideas in how to fix that?


texts: Org-Ref: Managing multiple projects, each with own notes.org files and bibtex-pdfs folders

texts:
When using org-ref, the bibliography:ref.bib directive in the notes.org file can be used to direct it to the corresponding ref.bib bibliography. Is there a similar such directive or approach to enable the ref.bib file to "discover" its corresponding notes.org file and bibtex-pdfs folder?

One can set the following within their init.el, or emacs-init.org file:

(setq org-ref-bibliography-notes "~/Dropbox/bibliography/notes.org"
      org-ref-default-bibliography '("~/Dropbox/bibliography/references.bib")
      org-ref-pdf-directory "~/Dropbox/bibliography/bibtex-pdfs/")

However, in the case of multiple projects, each with their own notes.org and ref.bib files, and bibtex-pdfs directories, how can one specify and associated a ref.bib file with a specific notes.org file and bibtex-pdfs folders?

Specifically when working on an article within a project, it's pretty neat to click on a reference that's been inserted with C-c ], and then "Add Notes" to that particular reference 3 RET.

Without the above snippet in my init.el, I get the following error:

org-ref-open-bibtex-notes: Org-ref-bib-bibliography-notes is not set to anything

This error persists even after setting up file local variables:

* File Local Variables
# Local Variables:
# org-ref-bibliography-notes: "~/Dropbox/bibliography/notes.org"
# org-ref-pdf-directory: "~/Dropbox/bibliography/bibtex-pdfs/"
# End:

or:

# -*- org-ref-bibliography-notes: "~/Dropbox/bibliography/notes.org"; -*-
# -*- org-ref-pdf-directory: "~/Dropbox/bibliography/bibtex-pdfs/"; -*-


texts: Getting `dvisvgm` to work with `org-latex-preview`

texts:
I am relatively new to Emacs and org-mode, and I would like the images displayed by org-latex-preview to be svg. I am trying to follow the instructions from this Stack Exchange question.
I have
(setq org-latex-create-formula-image-program 'dvisvgm)
in my configuration file, but the image I'm seeing is definitely not svg and rather seems to be the same as what appears with that variable set to dvipng instead.
Changing the variable to imagemagick does visibly change the image, so I know that Emacs is reading this line of the config file. I can open and view a separate svg image with Emacs, so I know that Emacs is able to view svg files. Also, when I include #+OPTIONS: tex:dvisvgm, the LaTeX is rendered as an svg, so I know that Emacs can talk to dvisvgm.
I am using:

Doom with Emacs 26.3
org-mode 9.4
MacOS Catalina


texts: Is there a way to use python instead of elisp for extending emacs?

texts: I'm interested in using languages other than elisp to write emacs extensions, is this possible at all? If python is not supported, what languages are?


texts: Delaying (require ...) for packages that define minor modes

texts:
With a package that defines a minor mode which calls an external function at run-time.

Is it reasonable to move this:(require 'my-runtime-dependency) in the body of the code which enables the minor mode? or should it always be at the top of the file?

e.g:

(eval-when-compile
  ;; Quiet warnings.
  (require 'my-runtime-dependency))

;; --- Snip

(defun my-mode-enable ()
  (require 'my-runtime-dependency)
  ;; body.
  )

(defun my-mode-disable ()
  ;; body.
  )

;;;###autoload
(define-minor-mode my-mode
  "Toggle `my-mode' in the current buffer."
  :global nil
  (cond
    (my-mode (my-mode-enable))
    (t       (my-mode-disable))))


texts: Org-ref, Exporting org file to HTML with its style exactly same as a specific scientific journal

texts:
I've been writing articles with Google Docs and Zotero. Recently, I tried Org-mode with Org-ref package, but the output was not so good.
My Problems:

The citation is verbose without any rule. I expected it will be concisely expressed in numbers, etc., following some rule or style of a certain scientific journals, but it was not.
The bibliography is not numbered. It is difficult to find out which part of the text the reference is cited.

I don't use LaTex. What I want is only HTML output following some style of a specific scientific journal.
Question: Can my problems be fixed by some advanced configuration of Org-ref? If possible, how can it be fixed?
Many Thanks.

My "~/.emacs" configuration (Windows 10 pro 64bits)
    (use-package org-ref
      :after org
      :init
      (setq reftex-default-bibliography '("C:/Users/k/Documents/emacs_practice/news.bib"))
      (setq org-ref-bibliography-notes "C:/Users/k/Documents/emacs_practice/notes.org"
            org-ref-default-bibliography '("C:/Users/k/Documents/emacs_practice/news.bib")
            org-ref-pdf-directory "C:/Users/k/Documents/emacs_practice/pdf/")

      (setq helm-bibtex-bibliography "C:/Users/k/Documents/emacs_practice/news.bib")
      (setq helm-bibtex-library-path "C:/Users/k/Documents/emacs_practice/pdf/")

      (setq helm-bibtex-pdf-open-function
            (lambda (fpath)
              (start-process "open" "*open*" "open" fpath)))

      (setq helm-bibtex-notes-path "C:/Users/k/Documents/emacs_practice/notes.org")
      :config
      (key-chord-define-global "uu" 'org-ref-cite-hydra/body)
      ;; variables that control bibtex key format for auto-generation
      ;; I want firstauthor-year-title-words
      ;; this usually makes a legitimate filename to store pdfs under.
      (setq bibtex-autokey-year-length 4
            bibtex-autokey-name-year-separator "-"
            bibtex-autokey-year-title-separator "-"
            bibtex-autokey-titleword-separator "-"
            bibtex-autokey-titlewords 2
            bibtex-autokey-titlewords-stretch 1
            bibtex-autokey-titleword-length 5))

Emacs captured

HTML output


texts: Org mode quote block indentation (highlighting)

texts:
Can indentation of the Org mode quote block be configured? I would like to highlight quote blocks with indented margins, both left and right if possible:

The example above demonstrates org-quote face properties (e.g.: :height :foreground, etc.) modified in my theme. However the left and right margins shown in the quote block are faked using spaces. Perhaps indentation is set by wrap-prefix, which is a special text property? If this is the right direction, how could I set a custom wrap-prefix for org-quote blocks only?


texts: Control or set the emacs mouse button event polling rate?

texts:
I have been using artist-mode and noticed that even at moderate mouse movement speeds the mouse event polling rate (here for down-mouse-1) does not seem to keep up (so lines end up with scattered holes in them instead of being continous).

Is there a way to modify or increase the mouse (down) button event polling rate?


texts: Have an org-protocol that opens a file and moves point to it

texts:
I would like to have an org-protocol that supports line numbers. For example

org-protocol://open-file?file=/foo/ss/subdir/foo.js&line=132

This would open file /foo/ss/subdir/foo.js at line 132.

How do I create an org-protocol that supports opening a file at a particular line?


texts: How to mark / cursor inside of curly braces when opening set of curly braces

texts:
I am using js2-mode as well as electric-pair-mode and autocomplete.

When I create a function using function () { and press enter the second curly brace is made on the next line but my cursor is placed on the same line, right next to it.  I wind up with something that looks like:

function test () {
*}

Where my cursor is where the * is.  I am used to behavior that would leave it like this:

function test () {
   *<-cursor here
}

Is there a way to re-enable that?


texts: How to set up custom layout for spacemacs?

texts:
I want to ask something regarding making my own custom layout for spacemacs. I have read the documentation. They have an example  like this:

This is the custom layout for ERC buffers.

(spacemacs|define-custom-layout "@ERC"
  :binding "E"
  :body
  (progn
    ;; hook to add all ERC buffers to the layout
    (defun spacemacs-layouts/add-erc-buffer-to-persp ()
      (persp-add-buffer (current-buffer)
                        (persp-get-by-name
                        erc-spacemacs-layout-name)))
    (add-hook 'erc-mode-hook #'spacemacs-layouts/add-erc-buffer-to-persp)
    ;; Start ERC
    (call-interactively 'erc)))

Since I am still beginner is Emacs Lisp, I don't really know what is happening here.

Let say I have four files in my home directory:

~/file1.org
~/file2.org
~/file3.org
~/file4.org

I want them automatically to be opened like this in my spacemacs:

|-----------+-----------|
| file1.org | file2.org |
|           |           |
|           |           |
|-----------+-----------|
| file3.org | file4.org |
|           |           |
|           |           |
|-----------+-----------|

Can anyone show me how can I achieve this (I am hoping that it comes with explanation since I am trying to learn through implementation)? Or at least can anyone tell me some keywords or Elisp functions that I can try to google on?

If it helps, I do regularly program in Python. So, a quite simple explanation is maybe enough for me.


texts: Tangle only selected src blocks using org-babel on export

texts:
I have a document with only several source code blocks that should be tangled. So the structure is:

    # Some main.org
    ...
    #+BEGIN_SRC awk :tangle file1.awk
    ...
    #+END_SRC awk
    ...
    ...
    #+BEGIN_SRC awk :tangle file2.awk
    #+END_SRC
    ...

Firstly, I have noticed that just exporting main.org is not goint to trigger tangling. Then, I decided to add a call to (org-babel-tangle) somewhere at the top of main.org. This call will produce file1.awk and file2.awk, but will also have an undesired side-effect of tangling the entire main.org file (#+INCLUDE directives substituted with contents of the included files, macros substituted, ...) into, well, main.org. How to avoid this behavior and produce only the files intended for tangling?


texts: How to format/fill poorly-formatted bullet items in org-mode?

texts:
Q: how can I format/fill poorly-formatted items in an org-mode bulleted list?

I'm trying to figure out how to make fill-paragraph work on poorly formatted bulleted items in an org-mode list.  By "poorly formatted," I mean long-ish bullets that use multiple lines but need to be cleaned up to make them readable.  The difficulty is that org-mode does not seem to recognize subsequent lines as part of the same bullet when the first non-whitespace character is in the same column as the bullet itself.

Hence, in the example below, bullet (1) does not need filling, bullets (2) and (3) need filling and respond as expected to fill-paragraph, but bullets (4) and (5) do not fill as expected:

* a header

  1) a simple bullet
  2) a bullet that responds nicely
     to
     fill-paragraph
     (try it!)
  3) another bullet that also responds nicely
    to
     fill-paragraph
    even though the "t" in "to" and the
     "e" in "even" line up with the space
         in between the "4)" and the start of the bullet
  4) a bullet that does
  NOT respond to fill-paragraph
  because the "N" in "NOT" is in the same column
  as the start of the bullet
  5) a similar problem:
the text is flush entirely to the left

First of all, why does this happen?  Second, and more to the point, how can I convince org-mode to treat all of the lines up to the next bullet as part of the same bullet for fill-paragraph purposes?


texts: How to prevent a key-binding from registering as an evil-mode operator?

texts:
When wrapping save in a function so it always writes, (used so I can trigger compilation which I have set to watch my files).

(defun save-buffer-always ()
  "Save the buffer even if it is not modified."
  (interactive)
  (set-buffer-modified-p t)
  (save-buffer))

(global-set-key (kbd "C-s") 'save-buffer-always)

While this works, evil mode 'dot' operator now registers saving as an operation, so repeat-last (dot operator) doesn't repeat my last edit.


texts:
I want to use only one org file to export both .tex and .html.

I use begin_latex in my org files to embed maths and I can use C-c ' to use the org-edit-src-code feature which help fast typing latex(Thus I can use Auctex and more). But it seems that the contents in begin_latex will not be formatted into equations when exporting to html.

After I read the org manual, I know that latex code can be embedded without begin_latex, and can be export to both html and tex. In this situation, I have to use cdlatex to type latex in a org file and can not use the org-edit-src-code feature, which means that I lost the latex code highlighting when typing. That really annoys me.

Any suggestions about this?


texts: Too many empty prompt lines when repeating the last command in GDB in Emacs

texts:
GDB has a feature: when the user wants to repeat the previous command (for example "n"), she can simply hit Enter.

When using GDB with a source code viewer in a terminal (gdb -tui), repeat the last command simply does not create new command prompt lines and preserves what is currently displayed on the screen. However, when doing this in Emacs, this will create a lot of empty command prompt lines.

How can I make Emacs not create new lines when repeating the previous GDB command?


texts: Why do regular expressions created with the regex builder use syntax different from the interactive regular expressions?

texts: So, using the regular expression builder (M-x re-builder), finding lines that end in \ takes "\\$", while in search and replace by regex, it only takes "\$".  I would have expected the regex builder to build directly usable expressions, so what accounts for this difference?


texts: How to shorten signature display in echo area?

texts:
Currently, the signature of the current function the pointer is on is shown as follows:

as you can see, the signature is so large that it overflows the echo area. I was wondering if there could be a way to shorter to something like this:
1/1 | FunctionName(..., current_arg type, ...) (return_type_n, return_type_m)

in other words, the signature from the screenshot shows as:
1/1 | CreateSubscription(..., identificacion_tipo model.IdentificacionTipo, ...) (*service.Subscription, error)


texts: Persistently setting display-line-numbers to relative in emacs init file

texts:
I am attempting to set up the new emacs 26.1 display-line-numbers-mode as described in this comment: hybrid line number mode in emacs?

I have added this to my .emacs file:

(setq display-line-numbers 'relative
      display-line-numbers-current-absolute t)

When I evaluate the above expression the desired behavior is produced, but it is not persistent. For example, it is not automatically evaluated on restarting emacs, and when I try to use my keybinding toggle:

(global-set-key (kbd "C-c l") 'display-line-numbers-mode)

The line numbers that are toggled are not relative.

What is the appropriate way to set display-line-numbers to relative in my configuration file so that using the keybinding results in relative line numbers?


texts: How can I suppress emacs' cursor moving into the empty last line of a file?

texts:
One of vim's quirks is that it doesn't show an empty line at the end of a file if the file ends with the newline character. This way, if the file doesn't end with a newline, the display is the same, only with the [noeol] marker in the modeline.

Emacs on the other hand, displays the last line if the file ends with a newline, and doesn't otherwise.

While Emacs' behaviour is fundamentally more sensible, for better or worse, I've gotten used to the former.

Is there any way to suppress the display of the last empty line, while still requiring that the file be newline terminated?

The screenshot shows three windows (view image in new tab if too small):

Large emacs window on the left in hexl-mode, showing you that there really is a newline at the end of the file (0a, where the cursor is positioned).
Emacs window on top right, with cursor on the empty third line.
Vim window on bottom right, with cursor on the last text line. The cursor cannot move below this point, even though the file ends with a newline (there is no [noeol] marker on the vim statusline).


texts: prevent yas from inserting a new-line after expansion

texts:
So I'm doing a recursive snippet with yas

$>name: "${2:`(file-name-nondirectory (file-name-sans-extension (buffer-file-name)))`}"${3:,
$>np}$0

but yas inserts a new-line at the end of every snippet, and after a while, it looks like this:

foo: {
    name: "bar",
    name: "bar",
    name: "bar",
    name: "bar",

}

how do I stop this?


texts: how I can set the org-agenda to start my week on monday?

texts: I'm cant set org-agenda to start a week on other day that isn't sunday.


texts: Is there an Emacs equivalent to Vim's arglist?

texts:
I often find myself in the situation of needing to open a bunch of files at the same time and run through them all and do something (search/replace, verify something or other, etc.). In vim, I'd do this by populating the arglist (blog post on VimCasts for people who aren't familiar).

It's essentially a subset of the buffer list that maintains its order. Vim provides commands for navigating through this list; once the list is populated, you can step through it with :next and do the edits. Vim tells you when you've hit the end of the list, and if you try to quit before you've edited them all it will gripe at you.

Is there any way to get Emacs to emulate this feature?


texts: echo the sql-command after sql-send-region

texts:
Currently I can select a region and call sql-send-region, it can be executed well. But if the command needs a long time to run, I am not sure if the command was send or not until the command is completed.

so do we have a method to show the command I send with 'sql-send-region' before it is run?

thanks


texts: view-scroll-half-page-forward messes up scrolling

texts:
I have the following in my config
(setq scroll-preserve-screen-position 1)
;;scroll window up/down by one line

(global-set-key (kbd "s-n") (kbd "C-u 1 C-v"))
(global-set-key (kbd "s-p") (kbd "C-u 1 M-v"))

(global-set-key "\C-v"   'View-scroll-half-page-forward)
(global-set-key "\M-v"   'View-scroll-half-page-backward)

and using C-v and M-v works as expected. But after using s-n or s-p, invoking C-v and M-v just behaves as if I use s-n and s-p again, namely scrolling the buffer up/down one line at a time.
It seems that this overwrites the half-page scrolling somehow and the only thing that helps to reset the behaviour to default, is to close and reopen the respective buffer. Can anyone tell me what the problem is and how to solve it?


texts: A quick way to copy the word before the cursor

texts:
By M-backspace (or by M-x backward-kill-word), I can remove the word before the cursor. Is there a built-in equivalent of this command for copying instead of deleting?

Obviously one can do M-x backward-kill-word then M-x yank (or M-x undo), but I am wondering if there is a better solution (aside from not to be so quick, the inconvenience is that it first changes the status of the buffer).


texts: How to make Emacs capture the next key in EXWM?

texts:
The context
I'm currently using GNU Emacs 27.1 and EXWM 0.24.
I've mapped the <f5> key to org-capture.
When <f5> is pressed in Firefox, the current tab is refreshed. I want org-capture to be executed instead of refreshing the current tab in Firefox.
The question
How can I make <f5> to execute org-capture while being in Firefox?
Is there a function that does the opposite of what exwm-input-send-next-key does (i.e. make Emacs capture the next key instead of the current application? Recall that the exwm-input-send-next-key function make the current application to capture the next key. This function is useful when we need the application to capture any key from exwm-input-prefix-keys, (e.g. C-x, C-h)


texts:
I have 2 markers (created with copy-marker): b and e and I want to run occur for the string "foo" on the region between b and e. What's the correct syntax?
I tried:
(occur "foo" 1 '((b . e)))

because the help says:

Optional arg REGION, if non-nil, mean restrict search to the specified region. Otherwise search the entire buffer. REGION must be a list of (START . END) positions as returned by ‘region-bounds’.

but it doesn't work.
I also tried:
(occur "foo" 1 '(((point-min) . (point-max))))

to try to understand the syntax, but it doesn't work.


texts: How to export an org file containing code blocks to a code file including comments?

texts:
Suppose I have the following org file (pdguide.org):
* Creating a Pandas =DataFrame=
  The pandas =DataFrame= can be created by loading the data from the external, existing storage like a database, SQL or CSV files. But the pandas =DataFrame= can also be created from the lists, dictionary, etc. One of the ways to create a pandas data frame is shown below:
  - import pandas library
    #+begin_src python
    import pandas as pd
    #+end_src
  - Dictionary of key pair values called data
    #+begin_src python
    data = {'Name':['NickD', 'John', 'Sam', 'crocefisso', 'Debbie'],
         'Age': [24, 23, 22, 19, 10]}
    #+end_src
  - Calling the pandas DataFrame method by passing the dictionary (data) as a parameter
    #+begin_src python
    df = pd.DataFrame(data)
    df
    #+end_src

How can I export it to a pdguide.py so the parts that are not code blocks become comments?
Also would it be possible to have it exported as pdguide.ipynb so the part that are not code blocks become markdown?


texts: How do I have helm select the literal text I typed in, not one of the options in the menu?

texts:
I've been getting deeper into org, and I've started using more properties. I have helm set up, so when I try to set an org property, helm is what is used to select both the property name and property value.

Helm prefills the selection list with the property names it knows about, and propery values it's seen before, which is normally great. But sometimes, I want to select a property name that's a substring of an existing property name (e.g., instead of the default CATEGORY property, I want to set the CAT property), or a property value that's a substring of an existing property value (e.g., a property value is Brian Jones, but I want to set one to Ian Jones), or I want to set a property to something that's a valid regex value (e.g., I want to set a single period, ., as a  property value).

Sometimes (e.g., in #'helm-find-files), at the top of the list is the literal value you've typed in. But I don't see that in these org property prompts. How can I get them to appear?


texts:
Is there a better alternative to this function I use to remove parens around a region? I'm looking for an Emacs builtin, or something better written, something that will remove any pairs around the selected region (ex: brackets, curly brackets, double quotes, single quotes)

(defun my-delete-surrounded-parens ()
  (interactive)
  ;; save where region begins & ends
  (let ((beginning (region-beginning))
        (end (region-end)))
    (cond ((not (eq (char-after beginning) ?\())
           ;; if region not begins by (, trigger error
           (error "Char at region-begin not an open-parens"))
          ((not (eq (char-before end) ?\)))
           ;; if region not ends by ), trigger error
           (error "Char at region-end not a close-parens"))
          ;; save mark, pt, current buffer & execute body
          ((save-excursion
             (goto-char beginning)
             (forward-sexp)
             (not (eq (point) end)))
           ;; if parens are not balanced, trigger error
           (error "parens not balanced"))
          (t (save-excursion
               (goto-char end)
               (delete-char -1)
               (goto-char beginning)
               (delete-char 1))))))


texts: View the log of the staged files while editing a git commit message

texts:
When I'm editing a Git commit message, I sometimes like to browse recent commits to the same file(s). That is, I'd like to view the output of git log $list_of_files_with_staged_changes.

Git commit mode (from Magit) provides some nice features, including a history of my recent commit messages (M-p/M-n = git-commit-prev-message/git-commit-next-message). But these are only commits that I've done in the same session, not necessarily in the same repository. Here I only want to see commit messages that are relevant to the files I'm committing, and I want them no matter how old they are. I also want the commit IDs.

I also have Egg (Emacs's Got Git) installed, and it provides a quick way to access the log for all the files in the repository (C-x v l: egg-log). But that's too much noise.

While editing a Git commit message, how can I view the log of the files I'm committing? I can use both Egg and Magit if convenient, as well as the built-in vc-git.


texts:
Began using RCS Version Control within Emacs with no problem while locally, but having dificulty on Tramp mode, once it says:

Debugger entered--Lisp error: (error "This file is already registered")
  signal(error ("This file is already registered"))
  error("This file is already registered")
  vc-register((RCS ("/scp:user@192.168.1.3#2222:/home/user/Teste/Teste01.txt") ("/scp:user@192.168.1.3#2222:/home/user/Teste/Teste01.txt") unregistered locking))
  vc-next-action(nil)
  funcall-interactively(vc-next-action nil)
  call-interactively(vc-next-action nil nil)
  command-execute(vc-next-action)

Created file, stroke C-v-v, set RCS as backend, made some changes, saved it, when stroke C-v-v to insert changes, received upward error massage.

Already certified that both directory and files were on Tramp user login.

Anyway that RCS could be used within Tramp mode?


texts: emacs ediff show all buffer diff word-wise (like vimdiff)

texts:
Issue description

When launching Ediff color scheme is very poor and i do not have word wise diff highlight. It seems that diff color faces are not activated at ediff startup.

I use emacs -Q to avoid installed themes interference.

But as you can see, down the pic, Auto-refining is ON and hitting * has no change.

Workaround

Fólkvangr provided a working solution : the j key magically highlight the buffer with great colors and show word wise diff.

What i'm expecting

I would like diff to open like on the second picture by default AND show all differences of the buffer - not only by chunks ( where you have to type j, then n / p to sequentially move to chunks).

Broadly, I'd like it to display vertical side by side files with all diff highlighted at character level the way vimdiff and vscode do.

Here is my ediff config made of things i read and the gnu doc :

;; turn off whitespace checking:
(setq ediff-diff-options "-w")
;; side by side diff
(setq ediff-split-window-function 'split-window-horizontally)
;; ne pas ouvrir de fenêtre séparée pour les contrôles :
(setq ediff-window-setup-function 'ediff-setup-windows-plain)
;; refinement:
(setq-default ediff-forward-word-function 'forward-char)


texts: Make org-delete-char (C-d) delete extra space after deleted word

texts: Hitting C-d (org-delete-char) in an Emacs org file deletes the word following the cursor. I would like to delete the extra space left also without having to use DEL. I.e. one action to delete word and extra space.


texts: How to show full path in `helm-source-locate` in `helm-mini`?

texts:
When I use helm-locate directly, it shows a list full path of candidate files.  However, only basenames are shown in helm-source-locate section, when I use helm-mini.  How can we make helm-source-locate to show full path in helm-mini as well?  Because sometimes there are files with the same basename.

I tried to use and modify some codes in helm-locate.el, but didn't succeed.


texts:
I would like to change the default behavior in emacs when '\n' meta-characters are encountered by the cursor. The default behavior is such that at '\n',
(1) right-key sends the cursor to the beginning of the next line,
(2) up-key sends the cursor to the end of the prev line,
(3) down-key sends the cursor to the end of the next line.
How can I get emacs to ignore '\n' meta-characters in a given buffer? Or how can I get emacs to ignore either one of the keys identified in (1), (2) and (3)?


texts:
My current configuration of Emacs (24.5.1 on U15.10) has auto-suggest set up for find-file, that is, when I do C-x C-f, the mini-buffer fills with possible completions that I can tab to and hit enter to select. I'd like to do that on an interactive function I'm writing where it would auto-suggest each element of this list

((thing1a . thing1b) (thing2a . thing2b) ... )

Is there boilerplate code for this someone knows about?


texts: How to set the local dictionary in a *Org Note* buffer?

texts:
I am using different flyspell/ispell dictionaries for different buffers/files setting the file local variable ispell-local-dictionary, respectively.

But if I want to log e.g. a TODO state change a *Org Note* buffer is opened with org modeas its major mode, as expected. Is there a way to tell Emacs to change the dictionary for every *Org Note* buffer to a specific language?

I did not find a specific hook.


texts: What keystrokes brings up the prompt to issue Lisp commands?

texts:
I am editing a file and I want to set the tab width (more likely the indent width) to 2 and I have come across a command (setq tab-width 2) but when I use M-x (i.e. Alt-x) on my system and I enter (setq tab-width 2) I get the message [No match].

I think the keystroke M-x is the wrong one. I get list of commands to select from, but what I am looking for is the right place to change a setting in Emacs with a Lisp command.


texts: Can I have separate tags lists for journal and todo/notes?

texts:
I use fixed tags for tasks and notes. These are tags either represent different physical places where I do my tasks (e.g. @home or @errands), or represent different areas of responsibility for me (e.g. %FAMILY, %HOME, %CAR). I define these tags by mean of org-tag-alist.

However, these tags are of little relevance when I want to tag my journal entries, which are mainly reflections of political, philosophical and ethical nature. Can I have another tag list for journal entries, or could I get a tag list to chose from which only consists of tags already used within the journal.org file? The %^g and %^G tools gives me all tasks used in my journal.org file AS WELL as those defined by org-tag-alist.


texts:
I have several tasks in an org file, some of which which have an Effort property and some of which which don't.

** Example Task 1, with effort
   :PROPERTIES:
   :Effort: 1:30
   :END:
** Example Task 2, without effort
   :PROPERTIES:
   :END:

When I run a match query in the agenda (C-c a m) and want to check by effort, this tutorial suggests the following. Suppose I want to match all todo tasks whose efforts are estimated to be less than 2 hours. I would do:

Match: +Effort<2/TODO

However, this also displays todo items which do not have an Effort property. (Example Task 2 would be shown along with Example Task 1.)

How can I make it so that having no Effort property results in not appearing in an Effort query?


texts:
Is there a way to select a buffer by part of its name using elisp?

For instance, the ag package may create a buffer called

*ag search text:MyPtyhonClass dir:c:/projects/my_module/*

or the realgud package may create a buffer called

*ipdb my_program.py shell*

My usual approach is to select a buffer by name with switch-to-buffer-other-window.  Here is how I might do it for a buffer called *Occur*:

(switch-to-buffer-other-window "*Occur*")

When I try the same pattern using only part of a buffer name, such as ag search text: or ipdb, a new buffer called ag search text: or ipdb is created rather than selecting the buffer whose name contains that substring.  That is, supposing there exists a buffer called *ag search text:MyPtyhonClass dir:c:/projects/my_module/*, calling

(switch-to-buffer-other-window "*ag search text:")

creates a new buffer called *ag search text:.


texts: Additions to org-agenda files not persisting across launches

texts:
My init file contains the following

(custom-set-variables
'(org-directory "~/Dropbox/org")
'(org-agenda-files (list (concat org-directory "/mylife.org")
       (concat org-directory "/inbox.org"))))

which seems to work. When I add a file to org-agenda-files using C-c [, it works as expected for as long as Emacs is open. Once I close and relaunch Emacs, I'm back to just the original two files in org-agenda-files. Is there a way to get additions to org-agenda-files to persist?


texts:
I'm currenty using emacs line highlighting and I found it useful when doing my work in GUI version of emacs. However, I find it uncomfortable to have such mode during my work in terminal. The color of higlight there makes current line being edited almost impossible to read.

The line in my .emacs file which is responsible for enabling this mode globally is: (global-hl-line-mode t).

My question is: is there a way to disable hl-line-mode only in terminal? I'm using xfce4-terminal and guake.


texts: How to change emacs font size on the fly from commandline?

texts:
Using 1autorandr for multimonitor detection, the script below is runned
each time I dock my machine. In order to use spacemacs on the 4k monitor I
curently must hit M-x zoom-frm-in.

What command could I add to have emacs's zoomed in on the fly as well?

$ cat /.config/autorandr/docked/postswitch

export GDK_SCALE=2
xrdb -merge ~/.XdefHiDPI

Footnotes

1 https://github.com/phillipberndt/autorandr


texts: Using C-h inside the box to delete character [company-mode]

texts:
I am using company-mode for word suggestions.

In company-mode, when I use C-h instead of deleting a character it says No documentation available.

I have added following lines to .emacs, which did not solve it.

(add-hook 'after-init-hook 'global-company-mode)
(with-eval-after-load "company"
  (define-key company-search-map (kbd "C-h") #'company-search-delete-char))


texts: Saving Python matplotlib figures with source-code blocks

texts:
So I am trying to create a Data Science workflow using org-mode source-blocks. Basically, I need to emulate the jupyter notebook functionality where you create a plot and it shows the figure.
Now, following this link, you can do this:

#+begin_src python :results file
import matplotlib, numpy
matplotlib.use('Agg')
import matplotlib.pyplot as plt
fig=plt.figure(figsize=(4,2))
x=numpy.linspace(-15,15)
plt.plot(numpy.sin(x)/x)
fig.tight_layout()
plt.savefig('images/python-matplot-fig.png')
return 'images/python-matplot-fig.png' # return filename to org-mode
#+end_src

The problem with this is that, you have to save the figure manually and then you have to return the path to the figure (Because org is wrapping that code in a function).

That is super awkward to me, because I don't want to be saving the figure manually nor have that return statement at the end, because I want to export these org files to my blog using orig-publish, and that return statement is not valid code outside of the org source blocks code context.
I then tried to do this:

#+begin_src python  :file example.png :dir images/ :results file
  import numpy as np
  import matplotlib.pyplot as plt
  import seaborn as sns

  sns.set()  # Enable Seaborn theme

  random_points = np.random.randint(0, 10, (100, 2))

  plt.scatter(random_points[:, 0], random_points[:, 1])
  plt.show()
#+end_src

#+RESULTS:
[[file:images/example.png]]

But the problem is that, it does not save any figure at the images/example.png path. What I would want to do would be that org-mode would save that figure on the path I specified in the header, and then allow me to visualize it in the results.

How could I achieve this? Thank you!


texts: How can I quickly switch between source namespace and test namespace?

texts:
In Cider, I can use C-c , to run the tests for the current namespace. This will work whether I'm currently in the source namespace or the test namespace itself (and indeed, this magic behavior is discussed in detail in the README).

Given that Cider already knows how to find the test namespace for a given source namespace (and I'd assume that finding the reverse is a similar problem), is there a function that I can use to quickly switch from a source buffer (e.g. src/example/core.clj) to its test buffer (e.g. test/example/core_test.clj) and vice versa?


texts: How can I show a quick menu for the user from Emacs Lisp?

texts:
I found EasyMenu and and I tried the example:

(easy-menu-define my-menu global-map "My own menu"
  '("My Stuff"
    ["One entry" my-function t]
    ("Sub Menu"
     ["My subentry" my-obscure-function t])))

But when I try to show the menu with M-x my-menu then it says:

my-menu must be bound to an event with parameters

So it apparently should be added to a keymap, so the user can activate it. But how can I show this menu from elisp? (like (my-menu) or something)

So how can I programmatically show a simple menu like the above? I prefer built in solutions, so without external packages like Hydra and similiar.


texts: yasnippets - finding and modifying some snippets

texts:
I'm struggling a bit with yasnippet. My question must be very basic but I would like to modify some snippets but I can't locate them.
I have for example a snippet style for html-mode but it does not appear where it should be that is either under :

~/.emacs.d/elpa/yasnippet

or

~/.emacs.d/snippets

My config is the following:

(add-to-list 'load-path
         "~/.emacs.d/elpa/yasnippet-20160801.1142")
(require 'yasnippet)
(yas-global-mode 1)
(add-to-list 'yas-snippet-dirs "~/.emacs.d/snippets")

Any would be appreciated!


texts: Emacs cursor color is different in daemon and non-daemon modes

texts:
There's some weird stuff I encounter when running Emacs under KDE.

Here's how it looks when I run it normally, via the emacs command:

If I run it as a daemon, here's what I see:

And if I run customize-face cursor in the emacsclient, here's what I see:

The face is changed outside customize. What could've changed it? How can I prevent it?

I need to say that under Xfce I don't get anything of sorts.

P. S. Apparently, --no-init-file solves the problem. Here's my .emacs. The rest of the files are located here.

P. P. S. This recipe worked for me. In fact, it worked so well that even removing these lines from ~/.Xresources and restarting the PC didn't bring back the errors. I can set the cursor face with customize-face and it'll start in the daemon keeping that setting. So that's nice.


texts: Always show expanded Magit sections by default

texts:
Sometimes the sections such as "Recent commits", will be closed by default. Can I set it so they are all always open by default?

But before I made the commit, recent commits was opened. After the commit, the unmerged section (with 1 commit in it) is closed. Is this intended?


texts: How to use the echo area to display useful information?

texts:
Since the echo area at the bottom of a frame is blank when the minibuffer is not active, I'd like to use it for something I don't always need but is informative (like showing org's clocking, battery level etc).

How can I accomplish this?


texts: Virtual space for rectangular selections (at least)

texts:
In Vim there is the virtualedit variable which can be set so that Vim allows the cursor to move past the end of the line always or only when in visual block mode. Is it possible to configure Emacs to do at least one of these?

picture-mode is not what I'm looking for because it inserts actual spaces.

I'm on Emacs 24.5 (from the Ubuntu package).


texts: How to get an value from a buffer local variable

texts:
I have the following code in the file1.el:

(with-current-buffer (get-buffer-create "TestBuffer")
  (read-only-mode -1)
  (erase-buffer)
  (make-local-variable 'source)
  (setq source (get-source-language))
  (my-package-insert text))

In the file2.el:

(with-current-buffer "TestBuffer"
  (message "Source: %s" (buffer-local-value 'source (get-buffer "TestBuffer"))))

First executes the code from file1.el and then from file2.el.

I expect that the source will be retrieved from the buffer "TestBuffer" but I get the error:

 Symbol's value as variable is void: source

Why that happens so? How could I retrieve the variable from the buffer? I can declare that variable by means of defvar but I don't want to hold temporal variable just for such a little need. Is it possible to avoid additional variable declaration?


texts:
I'm using emacs with org mode tempo tags,
based on this questions and answers

Q and A 1
Q and A 2

I get the feeling that I need to require org-tempo, but I get the following error:

Debugger entered--Lisp error: (wrong-type-argument stringp ("#+BEGIN_NOTES\n?\n#+END_NOTES"))


texts:
I want to prevent julia-repl from splitting my screen, which seems like a common request given the numbers of questions I have found relating to this. Drawing on advice found here and here, I came up with the following code for my init.el:
(setq display-buffer-alist
             '((".*" (display-buffer-reuse-window display-buffer-same-window))))

(setq display-buffer-reuse-frames t)

(setq pop-up-windows nil)

And yet when I open Emacs (emacs) and start julia-repl (M+x julia-repl), it still splits the window. My understanding is that the regex in the first command should catch all buffers and prevent splitting.
I also tried,
(add-to-list 'display-buffer-alist
           '(".*". (display-buffer-reuse-window .
                                  ((reusable-frames . t)))))

from here, too, without any success. What am I doing wrong here? Is this a quirk of julia-repl since the standard solutions don't work?


texts: Setting up shortcut using tramp-default-proxies-alist

texts:
Not being very LISP-literate, I am having trouble figuring out from the documentation here how to set up a shortcut to allow me to edit a remote file as root.

I've successfully set up an ssh-config file to allow pretty low-overhead entry for remote editing (see this question for the background), and would like a similar approach for editing remotely as root.


texts:
The find-function-at-point command finds a function and displays its definition in the other window, while moving point to the other window as well.

I'd like to have a version of find-function-at-point that opens the function definition in the other window, but leaves point in the current window.

I thought I could accomplish this with save-excursion in a lambda expression as follows:

(lambda ()
 (interactive)
 (save-excursion)
 (find-function-at-point))))

However, this doesn't seem to work. Point remains in the other window.

My understanding of save-excursion is that it should restore point and mark after the body of save-excursion is evaluated. What am I missing here?


texts: spacemacs: how to unset the keybinding of undo with 'u'

texts:
I don't want to have key 'u' bound to undo-tree-undo, as it's too conveniently dangerous to confuse with  u for universal argument prefix.

I tried

(global-unset-key "u")

But it didn't have any effect. How can I achieve my goal?

Furthermore, the above code has a disasterous effect of redenring key 'u' not working at all. I could not even input letter 'u'.

Edit: based on Drew's suggestion, here is the likely relevant key map:

undo-tree-map is a variable defined in ‘undo-tree.el’.
Its value is shown below.

  This variable may be risky if used as a file-local variable.

Documentation:
Keymap used in undo-tree-mode.

Value: (keymap
 (24 keymap
     (114 keymap
          (85 . undo-tree-restore-state-from-register)
          (117 . undo-tree-save-state-to-register))
     (117 . undo-tree-visualize))
 (27 keymap
     (95 . undo-tree-redo))
 (67108927 . undo-tree-redo)
 (31 . undo-tree-undo)
 (67108911 . undo-tree-undo)
 (remap keymap
        (redo . undo-tree-redo)
        (undo-only . undo-tree-undo)
        (undo . undo-tree-undo)))

I still need help (an example) on how to manipulate it. Especially, how to translate the numbers to the key name to understand further how to modify.


texts: Gnus: Don't show negatively scored articles

texts:
I use a Gnus score file to mark certain Usenet articles that I don't want to read. For example, a line from my $HOME/News/name.of.newsgroup.SCORE might look something like:

("troll@example.com" -1000 nil e)

When I enter the newsgroup, articles from that user are marked as read, but they still show up in the list of articles in the Summary buffer.

It's easy enough to type x (gnus-summary-limit-to-unread) to remove those articles from the list, but is there a way to configure Gnus so I don't see them in the first place?

If so, is it also possible to configure my score file so that some articles are not shown at all, while others are shown but automatically marked as read? (For example, I might assign a larger negative score to articles I don't want to see at all.)


texts:
After looking at this answer I find it hard to believe there is no way to clear the eShell.

Does anybody know of a short function or method to delete the entire buffer. Pressing C-l just scrolls the text, as soon as enter is pressed all of that text comes back.

Thanks


texts: How to hierarchically find available functions in the minibuffer with stock emacs

texts:
I accidentally pressed some keys and found a feature that looked really useful. It gave me the option to hierarchically select a command/function to run in the minibuffer. There was some explanatory text at the top, saying I could use PageUp to go to the window to select completions. I hesitate to call it completions, because, while it was very similar to the window you get with M-x ?, it wasn't that (for one, that text about PageUp isn't there).
With the latter you get an alphabetical list of commands. With the feature I stumbled upon, there was some hierarchy to it. E.g. there was an option "file". When I selected that with  f I got more options, like find-file.
I immediately installed command-log-mode, but I haven't reached it again so far.
Emacs version: GNU Emacs 27.1 (build 1, x86_64-w64-mingw32) of 2020-08-21


texts:
I've need a function which convert a paragraph into the line, sort each space separated set of characters and fill it back to paragraph.

In:

  Supposedly there are over one million words in the English Language.
  We trimmed some fat to take away really odd words and determiners.
  Then we grabbed the most popular words and built this word randomizer.
  Just keep clicking generate chances are you won't find a repeat

out:

  English Just Language Supposedly Then We a and and are are. away built
  chances clicking determiners fat find generate grabbed in keep
  million. most odd one over popular randomizer really repeat some t
  take the. the there this to trimmed we won word'words words words you

Trying to adopt function from EmacsWiki

   (defun sort-words (reverse beg end)
      "Sort words in region alphabetically, in REVERSE if negative.
    Prefixed with negative \\[universal-argument], sorts in reverse.

    The variable `sort-fold-case' determines whether alphabetic case
    affects the sort order.

    See `sort-regexp-fields'."
      (interactive "*P\nr")
      (sort-regexp-fields reverse "\\w+" "\\&" beg end))


texts: Emacs interface to a pastebin site that supports org-mode-style syntax highlighting?

texts:
I've been using emacs-pastebin but all my pastebins wind up as plain text. Is there a way to set emacs-pastebin so that pastebins are set to LISP format by default?

Better yet, is there a pastebin site that can disentangle Emacs discussions and highlight syntax correctly in lines based on SRC tags like the following, including both the code snippet and the non-lisp commentary?

* org-toggle-todo-heading
Here's what I have so far. See if it works for you.

#+BEGIN_SRC emacs-lisp
(defun org-toggle-todo-heading ()
"Toggles the current line between a non-heading and TODO heading."
(interactive)
(let ((is-heading))
(save-excursion
(forward-line 0)
(when (looking-at "^\\*")
(setq is-heading t)))
(if is-heading
    (progn
      (org-todo 'none) ; remove TODO
      (org-toggle-heading)) ; remove heading
  (progn
    (org-toggle-heading) ; convert to heading
    (org-todo 'nextset))))) ; add TODO  #+END_SRC
#+END_SRC

I have it bound to M-S-8.

And of course, I want be able to post regions/buffers to the site from within Emacs.


texts:
A while ago, skimming through emacs-orgmode mailing list, I read this message by Stefan Monnier:

  I'm on a crusade to eradicate the `intangible' property, which happens
  to rub me the wrong way because it's implemented at too-low a level (it
  affects every point movement) which incurs a significant performance
  penalty (even when not used) and affects a lot of code which then
  needs to be fixed by binding inhibit-point-motion-hooks (which I'm
  considering defaulting to t).

Got me wondering about this inhibit-point-motion-hooks variable. In what particular cases is it used?

Assuming Stefan's statement about "defaulting it to t" isn't motivated by weariness, does it make a difference to change its value globally? What about performance-wise?


texts: How can I get a custom org drawer to open/close?

texts:
My drawers don't seem to collapse with TAB. I've even tried the canonical example:

* This is a headline
  Still outside the drawer
  :DRAWERNAME:
  This is inside the drawer.
  :END:
  After the drawer.

When I place the cursor on the line :DRAWERNAME: and hit TAB nothing happens:

Also, when I place the cursor on the headline and press TAB repeatedly, I cycle through the following two states:

... and:

In other words the entire headline appears collapsed but the drawer itself is never collapsed.


texts: save emacs desktop regarding tmux session

texts:
I use emacs in different tmux sessions. Each time I run new emacs instance it says:
Warning: desktop file appears to be in use by PID <pid>.                                                                                Using it may cause conflicts.  Use it anyway? (y or n)
Is there standard way to save desktop per each tmux(screen) session?


texts:
Debugger Shows this error when trying to set agenda

Debugger entered--Lisp error: (void-function org-activate-links)
  org-activate-links(192)
  org-agenda-finalize()
  org-agenda-list(nil)
  funcall-interactively(org-agenda-list nil)
  call-interactively(org-agenda-list)
  org-agenda(nil)
  funcall-interactively(org-agenda nil)
  call-interactively(org-agenda nil nil)
  command-execute(org-agenda)


texts: Org timestamp ranges that cross midnight

texts:
Event durations are pretty straight forward to denote:

<2015-08-27 Thu 14:30-21:00>

But what about an event that extends past midnight?

<2015-08-27 Thu 22:30-01:30>

Does not do what I think it does. Additionally, giving the date/time prompt something like 21:00+4 will result in a timestamp such as:

<2015-08-27 Thu 21:00-25:00>

What is the correct way to denote such an event?


texts: leakage of define-key in let-bound keymap

texts:
I am trying to make a keymap to apply to a buffer region where the map is a composed keymap of several modes. Then, in that map, I want to define C-c C-c to run the command org-ctrl-c-ctrl-c.

This is the code that I am using:

(setq scimax-src-block-keymaps
      `(("emacs-lisp" .
         ,(let ((map (make-composed-keymap `(,lispy-mode-map
                                             ,emacs-lisp-mode-map
                                             ,outline-minor-mode-map)
                                           org-mode-map)))
            (define-key map (kbd "C-c C-c") 'org-ctrl-c-ctrl-c)
            map))))

This works fine, but I was surprised to learn that it "leaks". For example, if I open a Latex file, and turn on outline-minor-mode, then C-c C-c is bound to org-ctrl-c-ctrl-c (note that before I run that code it is bound to the right command for latex-mode, but after I run that code it changes).

Am I doing this the wrong way? I would have thought this would make a copy of the maps and that I was modifying that copy, not that I was modifying the original maps here.


texts: I exclusively use frames and I've long wondered if there's a way to get dired-dwim-target to suggest a dired buffer from another frame instead of just another window.


texts:
I've got some org-clock-tables created with the following

#+BEGIN: clocktable :maxlevel 2 :block thisweek :link t :formula % :scope agenda-with-archives :step day :fileskip0

| File           | Headline         | Time   |     % |
|----------------+------------------+--------+-------|
|                | ALL *Total time* | *5:04* | 100.0 |
|----------------+------------------+--------+-------|
| emacs.org      | *File time*      | *0:31* |  10.2 |
|                | Emacs            | 0:31   |  10.2 |
|----------------+------------------+--------+-------|
| project1.org   | *File time*      | *1:40* |  32.9 |
|                | Task1            | 1:40   |  32.9 |
|----------------+------------------+--------+-------|
| project2.org   | *File time*      | *2:40* |  52.6 |
|                | TaskA            | 2:40   |  52.6 |
|----------------+------------------+--------+-------|
| project3.org   | *File time*      | *0:13* |   4.3 |
|                | Task             | 0:13   |   4.3 |

I would like to have this list sorted by the last column to see which tasks I spend most of my time on in a given time period.

I've tried sorting that last column, but as each file is separated emacs doesn't sort it.

Is there a plugin or built-in command which already does this?


texts: Python mode - bypassing dialogue on C-c C-c, and having Python appear in its own frame

texts:
Whenever I'm in Python mode and do C-c C-c, I have to answer two questions - firstly, what command to run (which defaults to /usr/bin/python2 -i for me) and secondly, whether I want a dedicated process. However, I want these things to be the same all the time (namely, use /usr/bin/python2 -i and not create a dedicated process), and don't want to have to tell Emacs this explicitly every time. How do I set it up so that these are defaults for C-c C-c, and won't require me to tell Emacs anything extra to just pressing C-c C-c?

Also, I would like to have Python start in a pop-up frame after the first call to C-c C-c. I tried code like this:

(setq display-buffer-alist
  (quote (("\\*Python\\*" display-buffer-pop-up-frame
     (nil)))))

However, this doesn't seem to affect the *Python* I get from C-c C-c. What am I missing?


texts: Define colors for single use in minibuffer

texts:
I couldn't find anything on this, so I'm asking it here. I can display a message in minibuffer with

(message "foo bar")

I would like to give only the message "foo bar" a red color in the minibuffer. Is that possible with Emacs?


texts:
I would really love to be able to create an ordered list in org-mode that also has descriptions for each item.  I've added an example below. The first option works as expected.  The second fails and prints out the description separator verbatim.  I've also created a third option manually that shows what I think it should look like when it works.  Is there anyway I can create this automatically? Meaning that "Ordered List with Descriptions" would produce the same output as "Fake Ordered List with Descriptions".
* Unordered List with Descriptions
- item1 :: item one
- item2 :: item two
- item3 :: item three

* Ordered List with Descriptions
1. item1 :: item one
2. item2 :: item two
3. item3 :: item three

* Ordered List with Fake Descriptions
1. *item1* item one
2. *item2* item two
3. *item3* item three


texts: python-shell-completion-complete-or-indent no mathes in ipython

texts:
import pandas as pd
pd. # press tab, there are completions
df = pd.DataFrame()
df. # press tab, No Matches

Same configuration worked on my local mac but not on linux server.

If I use python interpreter instead of Ipython, it also works.

Ipython completion worked in terminal. It does not work in Emacs.

I am happy to provide more details but I even don't know where to look for bugs.


texts: Use Roman numbers while typing Devanagari

texts:
I use Emacs devanagari-itrans input method to type in Devanagari. But I prefer using the usual Arabic symbols for numbers (1..9) rather than the Devanagari symbols. It is cumbersome to keep switching languages every time I have to type a number.

Is it possible to have a composite input system so that I get Arabic numbers with Devanagari characters?


texts:
For good or for ill our project has some generated header files that contain binary data

const unsigned char __attribute__ ((aligned(4))) image[238560] = {
  0x00, 0x00, 0x00, 0xff, ...
...
}

Which are included to fill certain resources.

Is there a way to instruct cedet/semantic not to parse such files (ie not to lock up :-/)


texts:
Given a plain list like:

- buy tea
- call Anna
- Reply email to John
- pay bill 1
- phone Derick
- Reply to grad-pa

which you don't want to sort alphabetically, how can you sort it? Things like 'call' or 'phone' should go into the same category.

How could  put the elements into separate categories like:

* contact
  - phone Derick
  - call Anna
* Money
  - pay bill 1
  - buy tea

Otherwise, I'd need to through the whole list several times and copy and paste all elements of each category, instead of going through it only once and marking the list items, and then sort them with a function.


texts: Can't use Magit in Spacemacs - "Symbol's function is void: cl-struct-define"

texts:
When I try to run magit-commit-popup in Spacemacs, I get the error

Symbol's function definition is void: cl-struct-define

The only reference I could find to this issue was on this Github thread, but I wasn't able to follow what he did to resolve the issue.

My Emacs version is 24.4.2 and I am on Linux Mint 17.2


texts:
I just upgraded to magit 2.1.0. (And also to emacs 25.0.50 and git 2.3.1.)

Previously, in the *magit* buffer I could:

Select a hunk in the Unstaged area.
Type v and answer yes to reverse it.

This was handy.

But now in magit 2.1.0 it gives an error: "Cannot reverse unstaged changes".

Why?

Taking a hint from the error message, I discovered I can still do this, albeit in a somewhat "backwards" way with more steps:

stage the hunk. (Feels backwards; moving it closer to committed state.)
Nav down and select it in the Staged area.
Press v, answer yes.
However the hunk is still Staged, so finally I have to unstage the hunk.

Is this a bug, or, is it intentional and/or I'm being dense? If the latter, can you help me understand?

UPDATE: After thoroughly RTFinfo-ing, I see that there are two commands:

v magit-reverse Reverse the change at point in the working tree.
k magit-discard Remove the change at point from the working tree.

It seems that k magit-discard does what I was used to v doing before. It does work on an unstaged hunk.

So practically I just need to retrain my muscle memory to use k.  I could post that as a self-answer.  But I guess I'm still curious about the rationale, because I imagine understanding it will help me understand magit better overall.


texts: Recreate spacemacs' ivy/projectile 'SPC P SPC' binding for helm/projectile

texts:
I recently switched from ivy to helm in spacemacs as my project search/management package.
In ivy, there is a keybinding for SPC p SPC that does a search for files in the project (by file name). There is a very similar method and binding for helm:  helm-projectile-find-file, which is bound to SPC p f. I want to also bind this to SPC p SPC, like in ivy.
My attempt at adding the keybinding, distilled from my .spacemacs is this:
(defun dotspacemacs/user-config ()
  "add user config here"

  ; add ivy-like shortcut
  (spacemacs/set-leader-keys-for-minor-mode 'projectile-mode (kbd "p SPC") "helm-projectile-find-file"))

Unfortunately, when I attempt to invoke the keybinding, it does not exist.
Additional Context / Things I have tried.
I may be binding in the wrong minor mode. I tried it on 'helm-mode at first and that caused errors on startup. 'projectile-mode seems kind of wrong/weird, but I couldn't find a helm + projectile mode to bind on.
The key sequence in my code may be wrong. The spacemacs docs say "use a macro like kbd to determine the key sequence" so that's what I'm trying to do here. (kbd "p SPC") evaluates to ("p "). I have also tried using "p SPC" directly, with no call to kbd, with no luck.


texts:
I want to run code after adding a deadline, for example to move it forward by one day in case the deadline is early in the day, or by a few hours in case it's on a different time zone.
This attempt with a hook and a function is not called upon setting a deadline with C-d:
(defun my-org-deadline(&rest ignore)
  (interactive)
  (message "Called!!!!!")
  (let ((todo (org-get-todo-state))
        (deadline (org-entry-get nil "DEADLINE"))
        )

    ;; move deadline ahead by 1 day, to avoid missing it.
    (when (and todo deadline)
        (org-back-to-heading)
        (search-forward "DEADLINE: ")
        (org-timestamp-change -1 'day)
        )))

(add-hook 'org-deadline #'my-org-deadline)

The function works properly if I call it, but it is not called after setting a deadline.
What is the proper way to make code run after setting a deadline?


texts:
A buffer can be renamed with rename-buffer command.

Is it possible to rename buffers from IBuffer?

A use case is to rename a bunch of Term buffers from Ibuffer.
The default name for Term buffers is *terminal*.


texts: Help me install the development version of org-mode from Github repo

texts:
I want to install org-mode from Github repository and override that from ELPA.

My emacs configuration runs from an org-file, these are the lines relevant to package management and org-mode load path:

#+BEGIN_SRC emacs-lisp
    (require 'package)
    (package-initialize)
    (setq load-path (cons "~/.emacs.d/org-mode/lisp/" load-path))
    (setq load-path (cons "~/.emacs.d/org-mode/contrib/lisp/" load-path))
#+END_SRC

I installed org-mode version 9.0.4 from Github repo with these lines of bash code:

cd ~/.emacs.d/
git clone git://orgmode.org/org-mode.git
make autoloads

I deleted the org mode from ELPA folder inside .emacs.d.
When I fire up emacs I get this error message:

Warning (initialization): An error occurred while loading `~/.emacs.d/init.el':

Symbol's function definition is void: org-define-error

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the `--debug-init' option to view a complete error backtrace.

What am I missing here? Your help would be much appreciated. Any suggestions to improve my Emacs setup file are also welcome.

Update
whey I hit M-x org-version it takes the version info from another location which is /usr/share/emacs/24.5/lisp/org/. What I want to achieve that emacs run org-mode from the new cloned location.

Notes

Emacs-version: GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2016-04-17 on lgw01-04, modified by Debian
Org-version: Org-mode version 8.2.10 (release_8.2.10 @ /usr/share/emacs/24.5/lisp/org/)


texts: orgmode - ipython output image not show in results

texts:
I use below org code to draw a graph, but the graph not show on results block:

#+BEGIN_SRC ipython :results drawer :session py2session
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt

fig=plt.figure(facecolor='white')
plt.hist(np.random.randn(500000), bins=100);
#+END_SRC

#+RESULTS:
:RESULTS:
<matplotlib.figure.Figure at 0x112819f90>
:END:

How can I draw the output graph from ipython to results block?


texts:
I would like to use Yasnippet to insert the template for a latex inline equation: \( \)

The snippet is defined:

    # -*- Mode: snippet -*-
# name: inline equation
# key: ineq
# --
\(  \)

But Yasnippet inserts only the parentheses ( ) without the backslashes. Any suggestions?


texts:
I finished reading the completed chapter of 33.Rmail but have no ideas about how to read an email.

~/RMAIL keeps empty,

Although, I could get some clues from "33.18 movemail program" and "33.19 Retrieving Mail from Remote Mailboxes"

imap://username[:password]@hostname:port’
/var/spool/mail/user == file:///var/spool/mail/

Where should I place the above configuration?

Following JeanPierre' comments, I revised the configuration as:

;; Reading Mail
(setq rmail-preserve-inbox t)
(setq rmail-primary-inbox-list '("imap://abst.proc.do:password@imap.qq.com:993"))
(setq rmail-movemail-program "movemail")
(setq rmail-movemail-search-path "/usr/bin/movemail")

M-x rmail but prompt:

movemail:  invalid server response:  movemail: MU_ERR_BADREPLY:mailbox `imap://abst.proc.do@imap.qq.com:993': cannot open: Invalid reply from the remote host
(No new mail has arrived)
0 new messages read

What's steps I missing?


texts:
What is a recomended way for making emacs as julia code editor? The things which I would like to have are:

autocomplete
julia shell in emacs with abbility to send the code from buffer
debugging


texts:
Is there a function that allows to prepend text to a list of files / buffers?
I tried this:
(defun prepend-to-org-files (text)
  (let* ((path "~/Dropbox/org/database")
         (regex "org$")
         (org-files (directory-files-recursively path regex)))
    (dolist (org-file org-files)
      (prepend-to-buffer org-file text))))

But I am missing a function like prepend-to-buffer. Is there something like this?


texts: How to express a literal |, not column separator, in a table?

texts:
If I press TAB, inside this table:

| foo     | bar |
| |        | @   |

I get this:

| foo | bar |   |
|     |     | @ |

I'm hoping there is a way to 'escape' the | in cell 2-1 to show that is it literal.