texts: Magit diff working file to commit in log?

texts:
How does one ediff a current file--ie working tree--against an arbitrary version in some previous commit?

In this case, I'm interested in pulling in some, but not all, changes from a commit in another feature branch that was rejected.


texts: cannot get magit to visit actual file from diff buffer (have to use a "ffap" based workaround)

texts:
When in a magit diff view, pressing enter in a blob 'visit' the file.
But this file is a special read only version.

The magit manual mentions a way to visit the (actual writable) file:

C-<return>     (magit-diff-visit-file-worktree)
source: https://magit.vc/manual/magit/Visiting-Files-and-Blobs-from-a-Diff.html

This combo doesn't work, and M-x doesn't even mention a magit-diff-visit-file-worktree

What am I doing wrong?

My system:
GNU Emacs 26.2 (build 1, x86_64-apple-darwin18.5.0) of 2019-04-13
-UUU:@%%--F7  magit-diff: web-app   Top L1     (Magit Diff yas Rails Projectile WK) ----
macOS 10.15.3


texts: Obtain the raw prefix arg and its numeric value, and pass them to different commands

texts:
As I'm running out of easy key bindings I'm trying to overload C-SPC to either call set-mark-command or er/expand-region depending on if I have moved since I set the mark. However the two functions take slight different prefix constructs "P" vs "p". How can I declare a function that wraps the two functions and passes the right sort of prefix to them?

Here is the code I have so far:

(defun my-mark-or-expand-dwim (arg)
  "Set the mark or if mark already set call expand-region."
  (interactive "P")
  (if (and mark-active
           (eq (point) (mark)))
      (er/expand-region arg)
    (set-mark-command arg)))

EDIT TO EXPLAIN ANSWER: I accepted my own answer as that solved the question as-posed however using call-interactively is the solution I ended up using in my own init file.


texts: Display all internet connections during startup

texts:
How can I display all Internet connections that are used during startup? Sometimes I work in a low speed Internet environment and I would like to remove all the Internet connection code during startup.

Update: strace shows that Emacs stucks when it tries to connect to dbus, but I have no idea why...


texts: Interactive Function to Create a Buffer in a Default Folder with Autocompletion of the File Name with the Predefined Prefix

texts:
Could you please tell me how I can write a function
which creates and visits a buffer in a particular directory (a default directory name is hard coded, but it would be nice to have an opportunity to change the directory) with some predefined prefix (current date in the format yyyymmdd) and then offers to finish the title (eg 20170106EMACS_QUESTION.tex)?

Thus, when the function is called, it would do the following in order:

1) ask for a directory path of the buffer (if nil, autocomplete with the hard coded default)

2) ask for a file name, with the timestamp yyyymmdd already filled in at the beginning.

3) create and visit a buffer with the above metadata

completing-read, read-string and find-file seem to be useful.

You can also find the following code helpful, which I do not know how to change to comply with the description:

(defun add-note (d)
  (interactive "d")
  (let ((default-directory d))
    (find-file (format-time-string "%Y%m%d-CUSTOM-TITLE"
    (current-time)))))


texts: How to search for files, directories or grep(ag) from a directory inside a project with helm-projectile?

texts:
helm-projectile makes you set a project before trying to find files or directories, or searching through files with ag.  All the searches are then based from the project root.

How does one start, for example, a helm-projectile-ag search from within a subdirectory of the project?


texts: org-mode export to LaTeX: Wrapping a section in an environment

texts:
What's a good way to wrap every section in org-mode inside a LaTeX environment when exporting from org to LaTeX?

For example, say, I want to wrap each section in a minipage so that the width is smaller than a line that has been drawn over it.

For this .org file,

* Section 1
  - S1 item 1
  - S1 item 2
* Section 2
  - S2 item 1
  - S2 item 2

I want the export to produce this LaTeX:

\section{Section 1}
\hfill
\begin{minipage}{0.95\textwidth}
\begin{itemize}
\item S1 item 1
\item S1 item 2
\end{itemize}
\end{minipage}

\section{Section 2}
\hfill
\begin{minipage}{0.95\textwidth}
\begin{itemize}
\item S2 item 1
\item S2 item 2
\end{itemize}
\end{minipage}

Updated to say every section, instead of just one section.


texts: How to disable keybinding (`\C-o`) in ido-find-file?

texts:
I want to disable key-binding \C-o on ido-find-file. If I press it generates ^J and completion does not completed so I want to disable it.
I have tried following but it did not work.
(defun ido-common-completion-map ()
  "Add my keybindings for Ido."
  (define-key ido-common-completion-map (kbd "\C-o") 'nil))

(add-hook 'ido-setup-hook #'ido-common-completion-map)

I have followed for ido-wiki  and https://emacs.stackexchange.com/a/3730/18414

(defun ido-disable-line-truncation ()
  (set (make-local-variable 'truncate-lines) nil))
(add-hook 'ido-minibuffer-setup-hook #'ido-disable-line-truncation)
(defun ido-define-keys () ;; C-n/p is more intuitive in vertical layout
  (define-key ido-completion-map (kbd "C-n") 'ido-next-match)
  (define-key ido-completion-map (kbd "C-p") 'ido-prev-match))
(add-hook 'ido-setup-hook 'ido-define-keys)


texts:
Evil pastes after point; How do I make it paste at point?

123456|789

Current behavior:

1234567sth89

Desired:

123456sth789


texts: Disable removal of trailing whitespace in Emacs

texts:
I'm using Emacs 25.1.50 (9.0) on OS X and am starting to get annoyed with the automatic removal of trailing whitespace. I have tried solutions from here, but to no avail as my write-file-functions and before-save-hook variables are nil to begin with. I've also tried setting delete-trailing-lines to nil, but that still hasn't fixed my issue. I also found this exact issue that I'm having for Sublime Text, but also found a fix for it. I imagine that if the issue was able to be fixed so easily there, it should be simple to do in Emacs.

EDIT:

As per @Drew's request, I've decided to add some more info since I admittedly initially wrote this in a hurry. Upon starting Emacs 25 with the -Q flag, I notice the same issue being demonstrated as in my usual, customized Emacs. Here is a demo of the issue in emacs -Q. As you can see, in certain major modes that do auto-indentation, when I press RET on a line that I haven't written anything on, the line loses its whitespace formatting as my point goes on to the next line. This is irritating when I want to leave that whitespace formatting in between lines.


texts: Rewrite a package config using use-package

texts:
I installed a package called persp-mode using package-install, and the package docs recommend the following configs in the user-init-file (the last two lines are mine, but they work as expected).

(with-eval-after-load "persp-mode-autoloads"
  (setq wg-morph-on nil)
  (setq persp-autokill-buffer-on-remove 'kill-weak)
  (add-hook 'after-init-hook #'(lambda () (persp-mode 1))))

(setq persp-auto-save-opt 0
      persp-keymap-prefix (kbd "C-x p"))

I'm trying to re-write the above using use-package. By following its docs, I've come up with the following

(use-package persp-mode
  :ensure t
  :init
  :config (with-eval-after-load 'persp-mode-autoloads
             (setq wg-morph-on nil)
             (setq persp-autokill-buffer-on-remove 'kill-weak)
             (setq persp-auto-resume-time 0)
             (add-hook 'after-init-hook #'(lambda () (persp-mode 1)))
           setq persp-auto-save-opt 0
           setq persp-keymap-prefix (kbd "C-x p")))

However, it doesn't seem to work. persp-mode is not available after Emacs starts up, and key binding does not work either.

Any suggestion for the fix?

---1st Update---

Thanks to @Basil answer, I've managed to get the package loaded, but the configurations of the package still do not work. Below is the latest version of the configs

(use-package persp-mode
  :ensure t
  :config (with-eval-after-load "persp-mode-autoloads"
           (setq persp-auto-save-opt 0
                 persp-keymap-prefix (kbd "C-x p")
                 persp-autokill-buffer-on-remove 'kill-weak
                 persp-auto-resume-time 0)
           (add-hook 'after-init-hook #'persp-mode)))

---2nd Update---

Thanks again to @Basil further comments, below is the latest version of the relevant configs

(use-package persp-mode
  :ensure t
  :init (add-hook 'after-init-hook #'persp-mode)
  :config (setq persp-keymap-prefix (kbd "C-x p"))
          (setq persp-auto-save-opt 0)
          (setq persp-autokill-buffer-on-remove 'kill-weak)
          (setq persp-auto-resume-time 0))

Result: persp-mode is loaded as I can see it from describe-mode. describe-variable shows persp-keymap-prefix has value "^Xp" while its original value was "^Cp". However, when pressing C-x p returns C-x p is undefined, while pressing C-c p still works.


texts: org-mode regexp variables, literals missing

texts:
I am doing code study of org-mode. And in most places, org-mode uses regexps defined in org.el. Like, org-todo-line-regexp, org-not-done-regexp,org-deadline-regexp,org-scheduled-regexp and org-mode has lot more regexp variables.

What surprises me is that, most of these regexps are defvar-ed with their start time values as nil.

where to find the regex literals for these variables?


texts: can scrolling be smoother than single line in emacs/org-mode?

texts:
Using the trackpad, the scrolling in emacs/spacemacs is notably less smooth than in modern browsers and other editors. I have to confess that this jerkiness irks me more than I would prefer but I have not found a way to improve that situation. It is especially distracting once non-text elements appear on screen (e.g. inline images) but the problem is bad enough with text-only.

Is this an emacs problem that everyone has learned to accept or is there a solution that everyone is using without even thinking of it?

Any help would be much appreciated, especially if it was assuming little background knowledge (I am a neophyte and only using emacs b/c of org-mode). Thanks

I am using spacemacs 0.200.13 based on emacs 25.3.1 on a Macbook w/ macOS 10.13.4


texts: Set latex-preview-pane-mode as default pdf-viewer for acutex

texts:
Basically, i want my emacs to run latex-preview-pane-mode (which is a emacs function, provided by this package) instead of executing the external application evince.

After reading the acutex docs about this, i have now this code:

(custom-set-variables
 '(TeX-view-program-list
   (quote
    (("preview-pane-mode"
      (latex-preview-pane-mode)
      nil))))
 '(TeX-view-program-selection
   (quote
    (((output-dvi has-no-display-manager)
      "dvi2tty")
     ((output-dvi style-pstricks)
      "dvips and gv")
     (output-dvi "xdvi")
     (engine-omega "Atril")
     (output-pdf "Evince")
     (output-html "xdg-open")))))
(custom-set-faces))

The part after '(TeX-view-program-selection works fine, it's the not-changed default. However, i don't know how to proceed, because obviously evince is a actual binary program and latex-preview-pane-mode a function.

After changing (output-pdf "Evince") to (output-pdf 'latex-preview-pane-mode), i receive the error message:

TeX-view-command-raw: Unknown latex-preview-pane-mode viewer. Check the
`TeX-view-program-selection' variable

When i change it to (output-pdf "preview-pane-mode") and execute it, my emacs is hanging.


texts: Look at topvoted questions for a particular tag

texts:
In sx-mode (a major mode for viewing StackExchange in Emacs), it is possible to look at the topvoted questions for a particular StackExchange site with sx-tab-topvoted. It is also possible to search for a particular tag with sx-ask. But as far as I can tell there is no way to combine the two without laboriously setting the user's favorite tags to be the query tag, and then sorting by "topvoted favorites".

For example, I would like to search the topvoted questions on Emacs StackExchange that are tagged with [sx.el].


texts: How can I change external program to open org URLs for one org file only

texts:
In my Emacs config, I have set Firefox to be the browser to open URLs with,

  (setq browse-url-browser-function 'browse-url-firefox)

Now, I have one org-mode file, in which I would like to open URLs with a different program (mpv, to be precise).

What I'm currently trying is a buffer-local variable, indicated by a mode line

# -*- browse-url-browser-function: 'browse-url-chromium -*-

at the top of my org file.  However, whenever I click on an org-mode link pointing to a URL (or, just click on a URL, for that matter), I get an error

Debugger entered--Lisp error: (wrong-type-argument listp quote)
  browse-url("https://www.google.com/")
  (lambda (path) (browse-url (concat "https:" path)))("//www.google.com/")
  org-open-at-point()
  org-open-at-mouse((mouse-2 (#<window 1244 on testfile.org> 192 (163 . 95) 82295534 nil 192 (20 . 4) nil (3 . 9) (8 . 19))))
  funcall-interactively(org-open-at-mouse (mouse-2 (#<window 1244 on yoga.org> 192 (163 . 95) 82295534 nil 192 (20 . 4) nil (3 . 9) (8 . 19))))
  call-interactively(org-open-at-mouse nil nil)
  command-execute(org-open-at-mouse)

I would appreciate any pointer towards how I can resolve this.


texts: What kind of environment variables does Emacs expect to find in .profile, .bash_profile etc?

texts:
When I startup spacemacs I get the following message:

  You appear to be setting environment variables ("PATH") in your
  .bashrc or .zshrc: those files are only read by interactive shells, so
  you should instead set environment variables in startup files like
  .profile, .bash_profile or .zshenv.  Refer to your shell's man page
  for more info.  Customize exec-path-from-shell-arguments' to remove
  "-i" when done, or disableexec-path-from-shell-check-startup-files'
  to disable this message

What are the usual variables spacemacs\emacs expects to find in the profile, especially the emacs related ones?


texts:
I normally use OS X, and have recently decided to start using Emacs, and specifically AUCTeX based on myriad recommendations. I downloaded the current version for OS X and tried to preview a very simple document:

\documentclass{article}
\begin{document}
$e^x=10$
\end{document}

When I tried to use preview-buffer and preview-at point, I initially got the usual PATH-based errors that one seems to get on OS X, but on correcting those I got an error that didn't seem to be caused by the PATH:

  PDF2DSC sentinel: Wrong type argument: arrayp, nil

The process then seems to hang, producing no further output, although DSC files do appear to have been created in _region_.prv/tmpXXXXXX/

I switched over to the Linux side of my laptop (Arch Linux), installed Emacs 24.4.1 and the current version of AUCTeX (11.88.2), only to discover that the issue had followed me across partitions.

Edit: Added debug info

When I enable debugging on error I get this:

Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
  signal(wrong-type-argument (arrayp nil))
  preview-reraise-error(#<process Preview-PDF2DSC>)
  preview-pdf2dsc-sentinel(#<process Preview-PDF2DSC> "Preview-PDF2DSC" t)
  (lambda (process command) (preview-pdf2dsc-sentinel process command t))(#<process Preview-PDF2DSC> "Preview-PDF2DSC")
  TeX-command-sentinel(#<process Preview-PDF2DSC> "finished\n")

I'm not an emacs lisp expert (learning is slow), so I'm not sure what this means, but it looks like the error comes from this section of preview.el:

(defun preview-pdf2dsc-sentinel (process _command &optional gsstart)
  "Sentinel function for indirect rendering PDF process.
The usual PROCESS and COMMAND arguments for
`TeX-sentinel-function' apply.  Starts gs if GSSTART is set."
  (condition-case err
      (let ((status (process-status process)))
    (cond ((eq status 'exit)
           (delete-process process)
           (setq TeX-sentinel-function nil)
           (setq preview-gs-init-string
             (concat preview-gs-init-string
                 (preview-pdf-color-string preview-colors)))
           (preview-prepare-fast-conversion)
           (when gsstart
         (if preview-gs-queue
             (preview-gs-restart)
           (when preview-ps-file
             (condition-case nil
             (preview-delete-file preview-ps-file)
               (file-error nil))))))
          ((eq status 'signal)
           (delete-process process)
           (preview-dvips-abort))))
    (error (preview-log-error err "PDF2DSC sentinel" process)))

I have TeXlive 2014.34872-1 installed, and Emacs seems to have the right PATH set in both OS X and Linux (as determined by getenv PATH. I only found one other mention of this problem online (http://lists.gnu.org/archive/html/auctex/2014-12/msg00020.html), and there's no resolution to the issue.

Am I doing something wrong, or is this a bug?


texts: How to rebind evil key mappings for delete and friends?

texts:
I am looking to rebind some evil mode keys used in navigation and text selection. For example, I am able to successfully map the following evil-mode keys to the following functions:

(define-key evil-normal-state-map (kbd "w") 'evil-forward-little-word-begin)
(define-key evil-normal-state-map (kbd "b") 'evil-backward-little-word-begin)

But I don't know how to bind key combinations, like using dw to delete only to the next little word. For example, I type d C-h k w to describe the w key after I have typed d, and it is mapped to evil-forward-word-begin, and not to evil-forward-little-word-begin. Apparently, my key mapping above does not work for this scenario.

Is there a way to remap this keybinding, or am I being unreasonable in my attempt to remap the evil-little-word library?

Note that this question is a tangent to this question and I am trying to remap the evil-little-word library to the regular evil-mode keybindings.


texts: How do I delete all blank lines in a buffer?

texts:
Emacs 26.1

In buffer

1

2

3

4

I use command "delete-blank-lines". But it NOT delete ALL BLANK LINES. It's delete ONLY ONE BLANK LINE.

Why?

I need to delete ALL BLANK LINES.
The result must be like this:

1
2
3
4


texts: How to evaluate elisp --batch after the init file has loaded?

texts:
I would like to run code on the command line using the environment created by my own (early-init.el & init.el).
emacs --eval '(message "%S" load-path)' --batch

... it doesn't show paths added by my custom configuration for example.
How can I run a batch script that contains my user-configuration before executing the script?


texts: How do I teach Emacs to re-wrap /* */ comments?

texts:
Is there an existing function, and if not how would I write one, that turns this:

/* asdasdasd asdasdasd asdasdasd  */
/* asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd */
/* asdasdasd asdasdasd asdasdasd  asdasdasd asdasdasd asdasdasd */
/* asdasdasd asdasdasd */
/* asdasdasd asdasdasd asdasdasd asdasdasd */

into this?

/* asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd */
/* asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd asdasdasd */
/* asdasdasd asdasdasd asdasdasd asdasdasd */

That function should also work for other languages with multi-line comments, like tuareg-mode with (* … *).  I'd like to achieve the same behavior as M-q for line comments (which properly wraps and adjusts comment markers like //.


texts: Notmuch - configure preferences for address completion

texts:
When hitting TAB in notmuch to complete email addresses, I often get a long(ish) list of possible completions, forcing me to cycle through it looking for the correct one.
Is there a way to order the possible completions, so that I get the most relevant first?  Relevant can here be defined as the most recently used, the most common from-address, or selected from a list of specific domain priorities.


texts: Tramp remote login with a \ qualified username (escape problems)

texts:
I have a remote server I log in to from the command line using either:

ssh 'GROUP\user'@host.edu

or

ssh GROUP\\user@host.edu

and it works fine; I've even set up my SSH keys. But I can't figure out how to get this to work with tramp, as the "\" gets sanitized. I've tried using quotes and/or escape slashes, but those don't make it through either. Any solutions?


texts:
How can I get all elements of a list which don't match multiple
patterns?  The patterns are given as a list.
For instance, I want all files without '("no" "nix") in them.
(setq se-have
      '("~/site/src/good-org.org"
        "~/site/src/bad-no-org.org"
        "~/site/src/yes-to-org.org"
        "~/site/src/nix-this.org"
        "~/site/src/know-this-will-go.org"
        "~/site/src/is-always-next-to.org"))

(setq se-want
      '("~/site/src/good-org.org"
        "~/site/src/yes-to-org.org"
        "~/site/src/is-always-next-to.org"))

I can do it for a single pattern:
(seq-filter
 (lambda (x) (not (string-match-p (regexp-quote "no") x)))
 se-have)

How could I do this for each pattern in a list?


texts: Is it possible to limit magit's log view to just commits from the current branch?

texts: Currently when I bring up the local magit log ("l l") it takes a fair amount of time. It would be nice for the log just to limit itself to the nearest merge base (e.g. vs origin/master) but I haven't been able to work out how to do this.


texts: How to view each commit in magit easily?

texts: When I press ll in Magit's status buffer, then it shows a log buffer listing commits. Then I want to show details about the commit at point in another window, but at the same time I want to stay in the log buffer/window. If I press RET, then it shows another buffer with details about the commit, but it also jumps into the new buffer. How to keep the log buffer selected?


texts: How do I maintain a history of ido-read-filenames?

texts:
I've written a helper function for mu4e to run checkpatch against a message. However I want to be easily able to switch between previous calls to checkpatch and this seems difficult with ido-read-file-name. This is my code so far:

;;
;; Checkpatch in emails
;;
(defvar my-checkpatch-script-history nil
  "History of checkpatch invocations.")

(defun my-mu4e-action-run-check-patch (msg)
  "Run checkpatch against the [patch] `MSG'."
  (let*
      ((ido-work-file-list my-checkpatch-script-history)
       (script (ido-read-file-name
                "Checkpatch Script: " (directory-file-name (or (car
                                                                ido-work-file-list)
                                                               default-directory)))))
    (setf my-checkpatch-script-history
        (cons script (delete script my-checkpatch-script-history)))
    ;; actual check patch handling...

However C-n/C-p cycle through previous directories instead of files. The code I use to specify directories to apply patches which works a lot more naturally:

(defun mu4e-action-git-apply-patch (msg)
  "Apply the git [patch] message."
  (let ((path (ido-read-directory-name "Target directory: "
                                       (car ido-work-directory-list)
                                       "~/" t)))
    (setf ido-work-directory-list
          (cons path (delete path ido-work-directory-list)))
    ;; actual apply-patch handling

Is this just a limitation of dealing with files rather than directories?


texts: Does org have any "inverse-tangle" operations e.g. for collaborating with non-org users?

texts:
I would like to write my own notes/tests/code in org and then use org-bable-tangle to produce source files.  However, all of these files are subject to version control and hence subject to change from outside my org environment.

I would like to be able to have a number of src blocks and then tangle to a bunch of different files, each of which would be commit to version control.  But at the same time, be able to "untangle" each of these files back into my org file after pulling any changes from version control.

Is there any straightforward way of doing this?  I am now considering playing with insert-file-contents


texts:
I've recently switched from spacemacs to radian and have suddenly run into magit prompting for my github password whenever I view the status of a repository (the repository is configured to use SSH). However, I am still able to update the repo's status in magit, as well as stage, commit, and push changes.

When I perform the same actions on the command line, I am not prompted for a password and it seems as if git is picking up the configuration correctly.

Emacs has the correct SSH_AGENT_PID and SSH_AGENT_SOCK present in getenv.

Backtrace after setting M-x toggle-debug-on-quit is available at https://gist.github.com/peschkaj/c0c102f8a5d383f603e1319ba9e7395c

Environment is:

Emacs 26.1
macOS 10.13.6
magit 2.13.0
Using radian as the basis of emacs configuration


texts: Programming syntax highlighting and validation when regex is not sufficient?

texts:
I am proficient in developing basic syntax highlighting modes based on font-lock-defaults and regex (even with font-lock-multiline and font-lock-extend-region-functions).

Today I faced with format of natural language translation dictionary which look like:

__

begin
  [bɪˈgɪn]
  v1
began
  [bɪˈgæn]
  v2
begun
  [bɪˈgʌn]
  v3

v
ru: начать
ua: починати
__

smile
  [smaɪl]

v
ru: улыбаться

n
ru: улыбка
__

e.g.

abbr
en: for example
la: exempli gratia
__

x-rays

topic: sci
en: a kind of radiation that can pass through
  most solid materials, often used in medicine
__

woman
  [ˈwʊmən]
  s
women
  [wɪmɪn]
  pl

n
ru: женщина
ua: жінка
__

colour
  gb
  ['kʌlə]
color
  us
  ['kʌlər]

n
ru: цвет
ua: колір
__

white
  [waɪt]

adj
ant: black
ru: чорный
ua: чорний

As easy to see indenting and new lines with special prefixes define syntax.

Indenting in first part of entry used to separate word variances. Blank lines in second part of article separate different word meaning, lines should begin with defined prefixes and indenting is not allowed.

regex is not context aware and can't be used to properly highlight such file format.

File format have property that is can be validated from any point of file with small lookup around for ^__$ regex.

So I am interested in writing mode that properly highlighted and "localy" validated file (no need to validate far from screen several screens).

Is it possible to develop code or mark text in buffer after parsing so in a few cases when intending necessary function for indenting (by TAB) would be easy to code?

What API should I use to develop such mode myself?

Are there any good reference of existing code to follow?


texts: How to display type of C variable in a curses type menu?

texts:
A friend of mine who uses vim had this useful feature enabled, that allowed him to see type/completion information in a dropdown window even in terminal mode.

Currently in emacs I have to actually jump to a separate point in code (using M-.) which can be quite distracting, is there a way to enable this ?

I looked at other C IDE related questions but none of them seem to have answer to this question.


texts: Org mode - change code block background color

texts:
I wish to change the code block background color in org mode but below example doesn't work.

#+ATTR_HTML: :background-color #eff0f1;
#+BEGIN_EXAMPLE
hello world!
#+END_EXAMPLE

Can I insert inline css code with #+ATT_HTML


texts: two versions of emacs on mac osx - where are they

texts:
This has got to be a silly question...

From a terminal window, to start emacs which comes with mac osx (version 22.1.1), I just type

> emacs

First set of questions: where is this emacs installed?  where is the alias defined?

Now, I just discovered (!) how old this version is, and so I installed the latest version from http://emacsformacosx.com.  When I type

> emacs

I still launch the old version (22.1.1) and not the new one.  On the other hand, if I type in a terminal window

  open -a emacs

then the new version (25.3.1) is launched.

Second set of questions: why is that?  where is the alias for this other emacs? how does the system choose which version to launch?


texts: Controlling the order of output with Org-Babel

texts:
Consider the following Org file:

#+PROPERTY: tangle "init.el"
#+PROPERTY: noweb yes

* A
#+begin_src elisp
; initialization code
; this *must* come first
#+end_src

* B
#+begin_src emacs-lisp
<<support-functions>>
#+end_src

** Cool Stuff
#+begin_src elisp :noweb-ref "support-functions" :tangle no
(message "willkommen")
#+end_src

** Test
#+begin_src elisp :noweb-ref "support-functions" :tangle no
(message "hi")
#+end_src

yields

(message "willkommen")
(message "hi")

; initialization code
; this *must* come first

yet removing the :tangle header argument on one of the blocks in Cool Stuff fixes the issue, but duplicates code:

; initialization code
; this *must* come first

(message "hi")

(message "willkommen")
(message "hi")

What must I do to ensure correct behavior?  I know I could simply turn off tangling for the document and have everything be noweb, but this feels like a workaround rather than a solution.


texts: Spacemacs : insert single character in normal mode

texts:
I am using Spacemacs in Vim mode, and I would like to be able to insert a single character while remaining in normal mode, as described here for Vim.
For example, typing SPC i k in normal mode would insert k where the cursor stands, while SPC a k would insert k on the right of the cursor; exactly the same as pressing i k <ESC> and a k <ESC> l (the l aiming at putting the cursor back where it was) respectively.

P.S.: Making the command repeatable through . and allowing for multiple repetitions as in 5 i k would be much appreciated!


texts:
I think this may be as much a problem with the fonts as with emacs.

I've been using Ubuntu's mono font for emacs, and activating with:

(set-face-attribute 'default nil :font "Ubuntu Mono")

However, I can reliably get emacs to hang:

Set the font with (set-face-attribute 'default nil :font "Ubuntu Mono").
In any buffer (including *scratch* of a freshly-started emacs)
Do a query-replace, it does not matter if anything is found or replaced.
Do another query-replace. This time, emacs should provide the previous search/replace as default, something ala:

Query replace (foo --> bar): _

where the --> is actually a fancy arrow, not dash-dash-greaterthan. Emacs always slows down a little in this part.
Interrupt (C-g) before completing the act. Emacs hangs (for me).

If I do not set the font (fresh emacs) or set it to another font (e.g., "Consolas"), no such slow-down or hang occurs with the same steps.

If the font is somehow incomplete or incompatible, is there a way to make emacs more resilient to the problem? (Besides, of course, not using that font.)

Versions: win10_64, emacs-25.2.1 (vgoulet's 25.2mod3), ubuntu mono 0.80 (dtd 2011; non-mono fonts are 0.83 from 2015)


texts: Projectile switch between opened projects

texts:
I often have to work with multiple related projects and switching between them can become hard. I use counsel-projectile and it really makes everything easier. To be clear, I am not talking about counsel-projectile-switch-to-buffer or counsel-projectile-switch-to-project. I already use those functions and they are really useful.
What I would want is a function or a package that could display all opened projectile projects with ivy or helm and let me choose a candidate. When the candidate would be selected, the last buffer opened in that project would be opened. It would be basically a counsel-switch-buffer but with projects. If possible the last visited project would display first.
An example of this would be this package: persp-projectile, but unfortunately it does not work for me most of the times.
What I currently use is centaur-tabs and it has the function centaur-tabs-counsel-switch-group with centaur-tabs-group-by-projectile-project which is the closest thing of what I want. It only misses to place the last project on top of the candidates. But the real problem is that I don't even use the tab functionality and it makes Emacs have some small bugs sometimes (eg. hiding helm candidates on emacsclient).
So if there was a simple custom function with ivy and projectile I would really appreciate it.
[Edit]
projectile-switch-open-project does almost what I want but it triggers find-file. I would want it to just go to the last opened buffer on the project.


texts: Defining a derived mode breaks a feature that worked in the parent mode

texts:
In org-ref there is a feature whereby when the cursor is on a citation link, the information about the citation appears in the echo area. The feature is implemented using idle timers.

I have defined my mode as follows:

(define-derived-mode my-test-mode org-mode "MyTest"
  "My test mode."
  )

When I put an org buffer containing an org-ref citation link into the new mode, the mentioned feature stops working.

In the org-ref code, the feature is enabled by the following lines (not inside a defun):

(when org-ref-show-citation-on-enter
  (org-ref-show-link-messages))

I tried putting (org-ref-show-link-messages) in my mode definition, but that did not help. In case this is relevant, here is the code of that function:

(defun org-ref-show-link-messages ()
  "Turn on link messages.
You will see a message in the minibuffer when on a cite, ref or
label link."
  (interactive)
  (or org-ref-message-timer
      (setq org-ref-message-timer
            (run-with-idle-timer 0.5 t 'org-ref-link-message))))

So, what am I missing?


texts:
Journal article titles in my BibTeX appear as follows:

Title="{{E}nsure {C}onsistence {C}apitalization in {T}itles}",

This produces consistence output, which I am happy with. However, searching for title text in this file is very difficult.

Is it possible to "ignore" curly braces in a (case-insensitive) search pattern, such that I can simply search for the title of an article, without concerning myself with the curly braces?


texts:
I am working on adding some functionality to phpunit.el such as selecting from a list of functions found in the current buffer (populated in Helm).

The issue is that I can't get Helm to be populated, even though I can find all the matches and when I dump out the list into the mini-buffer it shows ("test1" "test2" "functionA" "functionB") which is expected.

My code can be found here: https://github.com/eric-hansen/phpunit.el/blob/minor-mode/phpunit.el#L169-190

I've also checked out the multi-term question that was asked on here but didn't help me very much.


texts: Emacs as daemon will not use font config

texts:
When using emacs as daemon,
systemctl --user start emacs-27.service
emacsclient -c

and also the following directly:
emacs-27 --fg-daemon
emacsclient -c

the font config in :~/.emacs.d/init.el will not be used:
(set-face-attribute
 'default nil
 :font (font-spec :name "-CTDB-Fira Code-light-normal-normal-*-*-*-*-*-d-0-iso10646-1"
                  :weight 'normal
                  :slant 'normal
                  :size 10.0))
(when (display-graphic-p)
  (dolist (charset '(kana han symbol cjk-misc bopomofo))
  (set-fontset-font
   (frame-parameter nil 'font)
   charset
   (font-spec :name "-SINO-STFangsong-normal-normal-normal-*-*-*-*-*-*-0-iso10646-1"
              :weight 'normal
              :slant 'normal
              :size 12.0))))

but when run emacs directly(no daemon), it can.
emacs

how do I let it use font config when run as daemon?
/usr/lib/systemd/user/emacs-27.service:
[Unit]
Description=Emacs text editor
Documentation=info:emacs man:emacs(1) https://gnu.org/software/emacs/

[Service]
Type=notify
ExecStart=/usr/bin/emacs-27 --fg-daemon
ExecStop=/usr/bin/emacsclient-emacs-27 --eval "(kill-emacs)"
# The location of the SSH auth socket varies by distribution, and some
# set it from PAM, so don't override by default.
# Environment=SSH_AUTH_SOCK=%t/keyring/ssh
Restart=on-failure

[Install]
WantedBy=default.target

I'm using gentoo, and emerge -pqv give this:
[ebuild   R   ] app-editors/emacs-27.1-r3  USE="Xaw3d acl athena gmp gui inotify jpeg libxml2 png ssl systemd threads xft xpm zlib -alsa (-aqua) -cairo -dbus -dynamic-loading -games -gconf -gfile -gif -gpm -gsettings -gtk -gtk2 -gzip-el -harfbuzz -imagemagick -json -kerberos -lcms -livecd -m17n-lib -mailutils -motif (-selinux) -sound -source -svg -tiff -toolkit-scroll-bars -wide-int -xwidgets"

How to let emacs use font config in ~/.emacs.d/init.el to when run as daemon?


texts: How can I automatically use curved quotes in text, but straight quotes in HTML tags?

texts:
I have a project, Tufte CSS, that I hand-write in HTML. I want to use smart quotes (aka fancy quotes or curved quotes) in the text of that document, but dumb quotes (aka straight quotes) in the HTML tags of that document.

How do I achieve this? I currently use web-mode and typopunct.el, but the latter automatically inserts smart quotes everywhere, including around HTML attributes, which it thereby causes not to function.


texts: How change the storage location of recentf file?

texts:
I looked around, but I couldn't find any answer in the documentation of
        recentf and with C-h v recent.

My default directory is set with the following:

(setq user-emacs-directory "~/home/ReneFroger/"
       default-directory "~/home/ReneFroger/")

I noticed Emacs saves the recent files that I have visited in the file
recentf, which will be stored in the home/ReneFroger/ path.
I would like to change the location of recentf but I can't find any variable
that allows me to do this.


texts:
Does anybody know of a way or a package that can recognize < and > when occuring in template contexts and automatically writes a > either right after the < or after the selected region when typing a <? (In other words, that behaves just as normal paren completion.)

I know that < and >are ambiguous if not evaluated in context and that this might therefore not be possible, that's why I am asking if anybody knows of a solution.

If however not all cases can be covered for technical reasons at least some would be possible, for example whenever < is typed right after template or when a block is selected that stands after template. And maybe some other cases.


texts: Automatically add properties based on tag in Org outlines

texts:
I'd like to be able to configure org to add properties based on specific tags which are used to describe the outline item.

For instance, say we have a list item * user  :person:student:. I'd like to have the person tag add the properties age and name, and the student tag to add the properties major.

How would I go about implementing this functionality?


texts: Emacs org mode shortcut to create code block

texts:
When using org mode, how can I map a specific keybinding (ex. C-c s) to create an org code snippet that looks like this:
#+BEGIN_SRC python

#+END_SRC


texts: -static flag leads to “error: C compiler cannot create executables”

texts:
The compiler here is gcc (v. 6.2.0).

If I add -static to either LDFLAGS or CPPFLAGS, the ./configure step of an Emacs build fails, with the error

configure: error: C compiler cannot create executables

How can I troubleshoot this error further?  (I am already running ./configure with the --verbose flag, but it still tells me very little about the reason for the error.)

FWIW, I want to build a static instance of Emacs, because the site where I work does not support Emacs at all ("Emacs?  What's that?  Why don't you use vi?  Or nano?"), and the version of it they offer is prehistoric.


texts: How to save a message in mu4e as outlook compatible file?

texts:
How can I save/export a message in a fileformat e.g. .msg in order to have coworkers open it with microsoft outlook?

At work we must use collaboration applications where we need to attach messages


texts:
I have global-subword-mode enabled and diminish installed. I have

(diminish 'subword-mode)

in my init.el. Despite this, subword-mode keeps appearing in the mode-line when I start emacs.


texts:
I have a huge screen, looking down at the minibuffer and then back and forth between my code and the minibuffer (e.g. if I'm isearching) is somewhat annoying. As such I'm wondering if there is a way to mirror minibuffer contents at point.

I realize this might be complicated since the minibuffer becomes the active buffer, and so point becomes the point in the minibuffer.

One idea of path to solution: is there a way to detect when entering minibuffer? To then detect what buffer we come from?


texts: Deleting duplicates in an org-table column


texts: How to place the comment string at the left most logical point when commenting multiple lines by pressing the comment keybinding repeatedly?

texts:
I have the comment-line bound to the C-/ like a normal person and one feature that I enjoy for uncommenting but can't quite use for commenting is the repeated pressing of C-/ to toggle comments on multiple lines.
Say you selected a region and invoked comment-line, you get something like this:
;; (setq x 1
;;      y 2
;;      z 3)

But when you manually start at the first line and press C-/ three times, you get something like this:
;; (setq x 1
   ;; y 2
   ;; z 3)

This is somewhat irritating and looks ugly imho. Is there any way to make the latter case of repeated invocations produce a commented region as done by the former method?
Note that when there is something like this:
(foo
    (daa x 1
         y 2))

And we comment the last two lines, I'd like it to look like this:
(foo
   ;; (daa x 1
   ;;      y 2))

And not this:
(foo
;;    (daa x 1
;;         y 2))


texts:
When I open files that default to csharp-mode, they always start modified. This is only occurring for csharp-mode.

save-buffers-kill-emacs with the d option (view changes in this buffer) shows

  Diff finished (no differences).

How can I stop .cs files from being modified when I open them? Why are they being modified?

EDIT:

files are not modified if reloaded using revert-buffer.
files are modified after running emacs -Q, package-initialize, and then opening the file (which defaults to csharp-mode)
files are modified after running emacs -Q, package-initialize, opening a C# file with a fake extension (file is not modified at this point), csharp-mode (file is now modified)

Filed a bug report with csharp-mode.


texts: Magit - How can I checkout a remote branch locally without typing the entire branch name?

texts:
I have a remote branch remote-branch-long-name. When I magit checkout with helm completion I can type remote-branch and origin/remote-branch-long-name will show up as an option. The issue is that to checkout this branch locally, I actually cannot switch to that branch, I need to switch to remote-branch-long-name (without the origin/ prefix), since helm doesn't provide that as a completion option, I have to manually type the entire branch name out.

Is there another function I should be using for this use case or do I have to hack a function together?


texts: Why this "keybinding conflicts" message keeps appearing? How can I fix it?

texts:
After pressing M-x sly, I keep receiving this message:

[sly] SLIME detected in 'lisp-mode-hook', causes keybinding conflicts.
Remove it for this Emacs session?

The odd thing is that SLIME is not installed in MELPA directories like the other packages:
~/.emacs.d/elpa$ ls -l
total 28
-rw-rw-r-- 1 pedro pedro  806 mai 26 16:42 0blayout-readme.txt
drwxrwxr-x 4 pedro pedro 4096 mai 14 17:17 archives
drwx------ 3 pedro pedro 4096 mai 26 16:45 gnupg
drwxrwxr-x 2 pedro pedro 4096 mai 21 20:59 paredit-20191121.2328
drwxrwxr-x 2 pedro pedro 4096 mai 14 17:27 rainbow-blocks-20210412.1937
drwxr-xr-x 6 pedro pedro 4096 mai 22 21:02 sly-20210303.1148
drwxrwxr-x 2 pedro pedro 4096 mai 22 21:18 transpose-frame-20200307.2119

Apparently, it was installed with QuickLisp. After pressing M-x locate-library in Emacs I get:
Library is file ~/.quicklisp/dists/quicklisp/software/slime-v2.26.1/slime.el

This is annoying me because Slime keybindings stopped working recently.
I am new to Common Lisp, Emacs, Sly/Slime, and Quicklisp. Maybe I messed up with stuff.


texts:
I try to comments 1.4K+ lines in a C++ function by using M-; or rectangle insert string //.

Wait for several minutes, Emacs still no respond. I have to kill Emacs.

In this case, how could I locate what cause the Emacs use 100% CPU and looks like do nothing?

Emacs: 25.0

OS: Ubuntu 14.04


texts: How to add a specific extension on filename for new files?

texts:
Say i create a new file using find-file (by typing a non-existing filename, since it create a newfile with said filename) How could i add the .org extensions at the end automatically?

I heard of hooks on emacs but i wasn't sure if this was the solution, so here i am.

To Clarify: I don't mind if every new files created have a .org extensions, as i center my workflow around org-mode like a lots of others do. Here find-file is just to be specific, but in general, i wouldn't mind if it happen even outside of using find-file.


texts: How do I temporarily mock a function for testing?

texts:
I'd like to patch some elisp functions inside my unit tests. I've tried cl-labels and cl-flet, but neither achieve the result I want:

(defun return-number ()
  1)

(defun calls-return-number ()
  (return-number))

(defun patch-cl-labels ()
  (cl-labels ((return-number () 2))
    (calls-return-number)))

(message "After patching: %s" (patch-cl-labels))

I've looked at monkey-patching a function (but this permanently changes behaviour) and patching a third-party function (this uses advice and holds on to the old function).


texts: Automatically `expand-abbrev` with `org-meta-return` and `org-insert-heading-respect-content`

texts:
I take notes with org-mode and abbrev-mode. Normally pressing SPC or RET leads to any abbreviations at point expanding before the edit is made.

This doesn't happen when I use C-RET (org-insert-heading-respect-content) or M-RET (org-meta-return). Is there a way to make this happen simpler than advising those functions?


texts: org-export-dispatch export html body only

texts:
How do I set org-export-dispatch to default to exporting the body html instead of the entire html file? As in the setting which you hit C-b in order to set?

I'm sure there must be a variable but I can't find it anywhere. Thanks!

Edit: To clarify, this is a question about how to default to export the body html, not how to export the body html itself which I appreciate I can do with C-c C-e C-b h.


texts: How to send quoted argument to call-process

texts:
I want to use the imagemagick convert command to draw on a image file. I have the image data as raw-text in a buffer and now I would like to run convert - -draw 'rectangle 0,0,100,100' - on it (the dashes tell convert to use stdin for input and print the data to stdout). If I leave out the -draw 'rectangle 0,0,100,100' then I can just use (call-process-region (point-min) (point-max) "convert" t t nil "-" "-") to pass the buffer contents as stdin to the convert program and insert the from convert returned image data in the buffer (this does not do anything but it works, e.g. I could replace the last - with a filename to write the resulting image data to a file). However now I want to add the -draw 'rectangle 0,0,100,100' as an extra argument to call-process-region but I really can not find (out) how to do this properly. For example I tried (call-process-region (point-min) (point-max) "convert" t t nil "-" "-draw" "'rectangle 0,0,50,50'" "-") but then I get message convert: non-conforming drawing primitive definition rectangle 0,0,50,50' @ error/draw.c/RenderMVGContent/4473.`
I tried to run it as a shell-command (i.e. using /bin/bash -c)? But then I don't know how to pass the buffer contents as input.
So I would like to know how to properly pass the single-quotes string 'rectangle 0,0,100,100' to the command.
(FYI I would like to extend djvu.el to show annotations)


texts: Gathering scattered text to a single location

texts:
I am looking for an easy way to gather blocks of text that are scattered throughout an emacs or org-mode document and move (or copy, but move would be preferred) them to a single location.

(For example, reorganizing thoughts in an org-mode outline, where items that had been sub-entries of various different sub-outlines are to be gathered under a new heading as a new point.)

I had thought I could use the kill ring to cut the kill the various items, knowing they would be stored successively in the kill ring, move point to the new location and then yank them back.  That would copy, rather than move, but I thought I could start with that.

I don't see, however, how to get yank to continue appending entries from the kill ring at point.  (I see I could accumulate in another buffer, but isn't there a default key binding just to yank successively at point?)

Any thoughts either on accomplishing the specific kill ring objective, or my ultimate goal of moving scattered text will be appreciated.


texts: How to display `tab-line` close button with `awesome-tab`?

texts:
If I understand correctly, awesome-tab is just a more or less thin layer over the Emacs 27 built-in tab-line.  Unfortunately, it doesn't show the close buttons (the little xs) on tabs anymore, though.  I tried manually setting tab-line-close-button-show to t in different places, to no avail.
How do I get closing buttons back?
(Cross-ref: I also made an issue about this question in the awesome-tab repo.)


texts: Annoying indentation bug with ES6 multiline string using js-mode or js2-mode

texts:
I am using js2-mode right now.
I am working on a .js file that contain a ES6 multi like string like this:

Vue.component("comment", {
    props: {
        comment: {
            type: Object,
            required: true
        }
    },
    template: `this is a multiline string,
it should be aline to the top!
`
});

How to fix the indent problem in the template at the end?
(tab is not working inside the string, and the two ` should be aligned)


texts: How do cask, package.el and projectile work together?

texts:
I have trouble to understand how to get projectile to work in emacs.

When I first started I am under the impression that I should use package manager like cask to download packages from ELPA.

I did that and I have the CASK file and ~/.cask directory created.

However when I check the projectile website about how to activate it, I do not get much of information.

It simply says:

  Installation

  The recommended way to install Projectile is via package.el.

I think I am confused at this point. Do I need both cask and package.el to manage the packages? In my situation what is the best way to enable projectile?


texts: Emacs not displaying some Devanagari characters correctly

texts:
I am using Emacs for OSX 24.4 on El Capitan. I am writing a text in Devanagari in LaTeX mode, which I compile using the XeTeX engine. I have changed the font set for Devanagari to Sanskrit 2003 in Emacs. While most characters (including complex ones) are displayed correctly, some simple ones are only displayed "half". For example, only the left half  (about the middle vertical line) of the character के is displayed in Emacs! (Sorry! Couldn't figure out how to load an image). This is also true for कं, फे, फं, कु, फु etc. का, फा etc. display correctly. When I place my cursor immediately to the right of these characters which display incorrectly, I see the negative of the un-displayed half in the background. Can anyone please tell me what is going on and how to correct it?

PS: This is not a font problem as Sanskrit 2003 is a very extensive font for Devanagari and works fine elsewhere. I have also tried other Devanagari fonts by changing the font set in my .emacs file and the problem persists.


texts:
I use org-mode for my shopping lists and I would like to be able to remove all checked items in one action.
i.e.

[X] cotton buds
[ ] cordial
[X] milk
[X] sugar

In the list above remove all the lines except + [ ] cordial
Is this currently available or has anyone written a function to perform this?


texts:
here is my question, does org-mode has a assembly highlight?

I prefer AT&T syntax, but Intel syntax is also fine.

For exmaple:

I know org-mode has a code highlighting like this:

#+BEGIN_SRC emacs-lisp
(+ 1 2 3 4)
#+END_SRC

So what I am asking is that how can I highlighting assembly code ?

Like this?

#+BEGIN_SRC Assembly
mov 1, %eax
#+END_SRC

But it cannot work...

Thanks


texts: Packages only working "once" after install

texts:
I'm trying to get git-gutter-fringe+ working under emacs 24.5.5 on OS X, but I'm having some trouble. In general, it works fine upon install, but on subsequent restarts the package is not loaded.

I'm using req-package to manage package installation and init, and my config for git-gutter-fringe+ is (currently) as follows:

(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.milkbox.net/packages/") t)
(add-to-list 'package-archives '("marmalade" . "https://marmalade-repo.org/packages/") t)
(add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/") t)
(package-initialize)

(unless (package-installed-p 'el-get)
  (package-install 'el-get))
(unless (package-installed-p 'req-package)
  (package-install 'req-package))
(package-initialize)
(require 'req-package)

;; ...other packages and config...

(req-package git-gutter-fringe+
             :requires (fringe-helper)
             :init
             (progn
               (global-git-gutter-mode)
               (git-gutter-fr+-minimal)
               (setq-default left-fringe-width  16)
               (setq-default right-fringe-width 16)
               ))

I've tried variations on this, including simply:

(req-package git-gutter-fringe+
             :init (git-gutter-fr+-minimal))

...but after the initial install and load, it fails to work.

I've had a look at the package's files under ~/.emacs.d/elpa/ and I can see that the git-gutter-fringe+-autoloads.el file looks mostly commented out:

;;; git-gutter-fringe+-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (or (file-name-directory #$) (car load-path)))

;;;### (autoloads nil nil ("git-gutter-fringe+.el") (22118 3236 355828
;;;;;;  0))

Is this to be expected? How can I diagnose the issue?

As an aside, I've had the same issue previously with the alchemist package, though since uninstalling/reinstalling a few times, it's since been pretty stable.


texts: How to change the title from emacs@host to file name

texts: I am using Emacs 24.5.1 on OpenSUSE Tumbleweed, with Gnome 3.16, and the title of the GTK window with Emacs in it is always emacs@hostname. How can I change it to the name of the current file I'm editing?


texts: Org-refile locks up file when used from org capture

texts:
I like to use org-refile to refile notes during the capture process. But,  since org-refile does not saves the file after the refiling is done, the file ends up being locked up and I need to visit the file and manually save the buffer in order to access it from another emacs process or another application. Emacs also ask me if I want to save the file upon exit.

Is there anyway to make org-refile save the file automatically after the capture process is done?

I also note that after refiling there is no buffer opened associated with the file, still, if I visit the file the buffer appears as modified and the changes are not saved.


texts: how to expand org-mode macros in HTML blocks in export to HTML?

texts:
I'd like to use org-mode macro replacement to expand macros inside HTML blocks in org-mode export to HTML.

I'd like this...

#+MACRO: event-url bar
#+HTML_HEAD: <meta property="og:url" content="http://foo.com/{{{event-url}}}"/>

...to export HTML that looks like this:

<HEAD>
<meta property="og:url" content="http://foo.com/bar'/>
</HEAD>

Based on this I tried this:

#+begin_src emacs-lisp :results silent
(add-hook 'org-babel-tangle-body-hook
        (lambda () (org-export-preprocess-apply-macros)))
#+end_src

#+BEGIN_EXPORT html :tangle yes
<HEAD>
<meta property="og:url" content="http://foo.com/{{{event-url}}}"/>
</HEAD>
#+END_EXPORT

...but that didn't work either.

How can I expand org-mode macros in HTML blocks in export to HTML?


texts: How to make process in compilation-mode think it's not running in interactive terminal?

texts:
I use minitest-mode which starts Ruby tests in compilation-mode:

(compilation-start
 actual-command
 'minitest-compilation-mode
 (lambda (arg) (minitest-buffer-name (or file-name ""))))

Tests invoke psql program, and it thinks like it's running in interactive terminal, so it outputs some of its output through pager (less). Because compilation-mode buffer is not a real interactive terminal, I can't press keys to close less and continue, so test process freezes and requires killing.

Is it possible to make compilation-mode run program in non-interactive terminal (as I understand, it should not allocate pty)? When looking at ps output, it looks like it has its own tty:

18046 ttys004    0:02.51 ruby -Ilib:test:spec test/functional/ads_controller_test.rb
18063 ttys004    0:02.41 ruby bin/rails db:test:prepare


texts: Dired: can't create a regexp to hide all the necessary files

texts:
I read the following article: http://qerub.se/hiding-hidden-files-in-emacs-dired about hiding certain files in dired mode. I decided to hide more files and added a shortcut Alt-q, that will toggle the visibility of:

All the hidden files, starting with dot.
All Emacs backup files, ending with '~'.

I wrote the following code:

(setq dired-omit-files "^\\.$|~$")
(add-hook 'dired-mode-hook
          (lambda ()
                (define-key dired-mode-map (kbd "M-q") 'dired-omit-mode)
      ))

But only ~ files are hidded, not those, starting with dot. What is wrong?


texts: Unable to run applescript from emacs-lisp

texts:
I have the following code block, which I am trying to execute from org-babel:

#+BEGIN_SRC emacs-lisp

  (let ((h (nth 5 (org-heading-components))))
    (do-applescript (format "tell application \"Calendar\"
       activate
       set s to current date
       set f to s + 30 * minutes
       tell calendar \"activities\"
         make new event with properties {summary:%s, start date:s, end date:f}
       end tell
   end tell" h)))

#+End_SRC

The applescript bit works fine, on its own. But when I run this from org-babel, I get the following error:

Expected expression but found ":".

What am I missing?


texts: How to wait for command execution to complete in eshell

texts:
I guess I don't quite understand how to write commands for eshell. I am using the form:

(defun eshell/command ()" " (interactive)
  (insert "command")
  (eshell-send-input))

When I do this it prints the command and then the prompt, even though the command has not finished executing. I can force the printing of the prompt after I send the commands, but this happens immediately as well, not after the command has completed.

I would like to see some visual indication that the command has finished. I kind of assume there is an eshell elisp function that will wait for the command to finish (like wait in bash) so I can force the prompt, but I can't find it. Generally is seems you may want to wait for the command to finish before returning from the function. It seems like this would be a common problem. Can someone point me to the obvious which I am not seeing? Thanks.


texts: How to prevent font-lock from being lazy?

texts:
Related to this question.

Here's my current font lock setup for python-mode:

(require 'org)
(defconst lpy-font-lock-keywords
  '(("^#\\(\\* .*\\)$" 1 'org-level-1 prepend)
    ("^#\\(\\*\\* .*\\)$" 1 'org-level-2 prepend)
    ("^#\\(\\*\\*\\* .*\\)$" 1 'org-level-3 prepend)
    ("^#\\(\\*\\*\\*\\* .*\\)$" 1 'org-level-4 prepend)
    ("^#\\(\\*\\*\\*\\*\\* .*\\)$" 1 'org-level-5 prepend)
    (lpy-outline-comment-highlight 1 'default prepend)
    ("`\\([^\n']+\\)'" 1 font-lock-constant-face prepend)))

(font-lock-add-keywords 'python-mode lpy-font-lock-keywords)
(defun lpy-outline-comment-highlight (limit)
  (when (re-search-forward "^#\\(?:[^*]\\|$\\)" limit t)
    (let* ((pt (point))
           (success (save-excursion
                      (and (re-search-backward "^#\\*" nil t)
                           (null (re-search-forward "^[^#]" pt t))))))
      (when success
        (set-match-data (list (line-beginning-position) (line-end-position)
                              (point) (line-end-position)))
        (end-of-line)
        t))))

The code appears to do what I want (have comment bodies, but not
starters, in default face for comments that belong to outlines), but
only for small buffers, or places that I modify.

For larger buffers (larger than one screen), font-lock will be lazy
and not apply the required faces.  However, if I modify the text
around that region, it will be highlighted correctly.

In the image above, font-lock is being lazy in the "Multi-dimensional indexing outline".
So I moved a point there and entered a space - the highlight became correct.

How do I force font-lock to highlight every line on the screen?


texts: How to change color of searched text in the minibuffer when M-x activated?

texts:
When I type M-x along with some text, the found text's background and font color is hard to read (gray and bold white on top of dark blue). Is it possible to change it?
Example screenshot:

As theme I am using dracula along with ivy.
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
(load-theme 'dracula t)

(ivy-mode)
(setq ivy-use-virtual-buffers t)
(setq ivy-initial-inputs-alist nil)
(setq enable-recursive-minibuffers t)

(global-set-key (kbd "M-x") 'counsel-M-x)
(define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history)

ivy faces (I believe all are default setup):

I was not able to do proper test using emacs -Q but it makes the found substring as bold without changing its background.
example:


texts: Can org-clock-display be made show estimates also?

texts:
Currently, when you work with entries and clock things in/out, you can press:
C-c C-x C-d to display totals of entries next to them.

This uses the function org-clock-display: source code here

It would be nice to be able to see estimates as well, like:

* my task  ... 2:00 / 3:00

Does anyone have any ideas on whether it's possible to add something like an advice function or another function that does this already?


texts: which-function-mode is broken after first ggtags-find-tag-dwim call

texts:
after first ggtags-find-tag-dwim call I see the current tag where I saw the current function...
How I can avoid this?
I do not want to see in header current tag (where cursor is)

Normally which-function-mode show in header name of the function where cursor is located.

f.e.  [main()] if my cursor is in main function. It worked for a long time until I tried to use ggtags-mode and helm-gtags modes. It seems those modes override this header and show current tag. f.e. assert() if cursor in line assert(x>20);
I do not need such a new behavior...


texts: How to match a quoted symbol in a string in elisp?

texts:
I'm struggling to find a correct regexp to match quoted symbol inside a string:

" 'foo " or " 'foo.bar "

Any help will be appreciated


texts: How to set magit recent commit always expand when i open magit status?

texts: When I open a Magit status buffer, then the recent commit section is closed, I need to use TAB to expand it. How can I configure it to always be expanded.


texts:
I'd like to change use-package's indentation style to look more distinguishable, (more or less) similar like the following indentation style:

(use-package foo
  :commands (gah)
  :init (setq f 1)
        (blubb g 2)

  :config
    (blah h 3)
    (moo i 4))

This means, keywords should be indented normal but all following options to such a keyword, should be indented a bit more and should align vertically.

I already know, that it is possible to define a function to calculate the current indentation column. Per default it is set to standard defun indentation:

(get 'use-package 'lisp-indent-function)
; → defun

The following function definition and set up of property, changes that, but I struggle with the implementation details of function my-use-package-indent-function.

(defun my-use-package-indent-function (indent-point state)
  (let* ((normal-indent (current-column))
        (indent-offset (progn (back-to-indentation)
                              (current-column))))
    (goto-char indent-point)
    (back-to-indentation)
    (if (eq ?: (char-after))
        (+ indent-offset 2)
      (+ indent-offset 5))))
(put 'use-package 'lisp-indent-function #'my-use-package-indent-function)

Above is a naive, incomplete version, but how to calculate the indentation value properly?


texts: How can i resolve tramp-error: Not a Tramp file name: using a /docker address?

texts:
Trying to set up .dir-locals to use a custom python interpreter inside a container so i can use run-python and get the REPL inside the container.

I have this setup which seems to partially work in that its trying to use the interpreter i have specified.

((nil . (
        (python-shell-interpreter . "/docker:hackdev_django_1:/usr/local/bin/python")
                )))

However I just get the below error.  I assume its something to do with the added slashes.

tramp-error: Not a Tramp file name: "/docker\:hackdev_django_1\:/usr/local/bin/python"

If I use find-file and navigate to the bin folder that works, and using the which command tells me that the path is correct inside the container. So I am at a bit of a loss.

GNU Emacs 25.2.2
Tramp version 2.2.13.25.2 built in

I tried upgrading but I could not convince Emacs to use my downloaded version over the built-in version.

Looking for next thing to try.  Is this perhaps a known bug ?

Update 01

The python shell calculate command runs the docker command through shell-quote-argument which is adding the slashes and breaking things.

I then have to add (setq tramp-histfile-override "/dev/null") to get around another issue where it looks for a history file which does not exist.

Currently running the code below to progress.

  (setq tramp-verbose 6)
  (defun python-shell-calculate-command ()
    "Calculate the string used to execute the inferior Python process."
    (format "%s %s"
            python-shell-interpreter
            python-shell-interpreter-args))
  (setq python-shell-interpreter "/docker:hackdev_django_1:/usr/local/bin/python")
  (setq tramp-histfile-override "/dev/null")

using C-x C-f I can type /docker:hackdev_django_1:/usrlocal/bin/py tab and have it list python.


texts: Emacs on Windows randomly stops recognizing the Caps Lock state

texts:
I'm running GNU Emacs 26.1 on Windows 10, with minimal customizations (custom shortcuts and command names, theme, (ido-mode 'buffers).).  At the start of the session, the Caps Lock state is recognized correctly - i.e. with Caps Lock on, the input is in uppercase; however, at a random time it stops working: with Caps Lock on, the input is in lowercase (in other apps it is working as expected).  C-h k a (with Caps Lock on) displays

a runs the command self-insert-command (found in global-map)

The problem goes away if I restart Emacs, but I'd rather not do that several times per day.

How do I debug this issue?

I thought about somehow setting a timer in Emacs and alert on the change in the condition, but it doesn't seem possible to detect the condition from within Elisp, because at the point of Elisp running it already sees the lowercase letters (per the C-h k test above).

Systematically stopping the work every two minutes to manually check the condition and investigate what changed isn't an option either.

A possible work-around is to switch my workflow for entering uppercase letters from "Caps Lock, text, Caps Lock" to "text, M-b M-u", but as it is a finger habit, it's very hard to change.


texts: Make major mode be used by default for new files in directory

texts:
I forget to enter sh-mode when I create new shell scripts in ~/.local/bin, so I want emacs to do this automatically. Because I have an advice set up to make them executable, this will have the effect of also marking them executable automatically.

I tried creating this .dir-locals.el file in the directory:

((nil . ((magic-fallback-mode-alist . (("^$" . sh-mode))))))

but although it asked me whether to apply the "risky" file-local variable magic-fallback-mode-alist, it did not work - the new buffer was still using fundamental-mode.


texts: Displaying the type of variable in C++ code with cursor

texts:
It has been difficult to see immediately the types of variables in C++ codes because they are defined using 'auto', 'template' and 'decltype'.
If you use IDE, you can detect the type after the compilation by being a cursor on the variable.
My question is, does an emacs package exist to achieve such a function?


texts: echo $(echo $HOM) in eshell of win10 platform get void function reported

texts:
I am working on emacs-27.1 of windows 10.
PS C:\Users\gaowei> emacs.exe --version
GNU Emacs 27.1

Within the eshell, I tried:
~/.doom.d [master] λ which echo
eshell/echo is a compiled Lisp function in ‘em-basic.el’.

~/.doom.d [master] λ echo $HOME
C:\Users\gaowei

It works properly until I run to nest the commands as:
~/.doom.d [master] λ echo $(echo $HOM)
Symbol’s function definition is void: echo

What's the problem? echo does exist in eshell but report void function.


texts: When to use artist-mode, and when to use picture-mode

texts:
Why does emacs offer two drawing modes?

artist mode
picture mode

Are they competing packages or have different use cases.
What I tried: googled "emacs artist-mode versus picture-mode"
My setup: emacsclient -nw in Terminal.app
UPDATE: Found the answer to my own question. Artist mode is more "user friendly" specially if you don't mind using the mouse. If you're running in -nw console mode, artist-mode might not work, printing ansi escape codes (thats what happened to me). It might have something to do with my M-! echo $SHELL having the value "dumb"


texts: Is there a package for moving screen instead of cursor?

texts:
I am using emacs for a few months now and it is going ok.

I want to know if there is a package out there which can help me move the screen instead of my cursor.

For example, if I move one line down(Ctrl n) then instead of the cursor going one line down I want the screen to scroll up on line. This way my cursor is always in the middle and the text moves instead of cursor.

I want this behavior because I think it will be easier on my eyes.

Is this possible? Any leads appreciated.


texts: Flycheck installation to aquamacs from melpa failing

texts:
Using Aquamacs

  Aquamacs 3.2 GNU Emacs 24.4.51.2
  (x86_64-apple-darwin14.0.0, NS apple-appkit-1343.14)
   of 2014-11-07 (Aquamacs-3.2) on watson.local

trying to install Flycheck from stable.melpa.org; I get this message

  https://stable.melpa.org/packages/flycheck-20160519.303.tar: Not found

I've tried using package-mode, and also the temporary install method (eval-buffer including (package-install 'flycheck), and I keep getting this message.

Thanks


texts: Schedule multiple events under 1 timestamp

texts:
Is it possible to schedule multiple events or TODOs under one timestamp? If it is not possible what would be a reasonable alternative to what I am trying to do?

Basically I like to schedule my days at once listing everything that needs to be done or was done.

It might look something like this:

* Agenda
** Week 30
*** School Day <2017-07-24>
**** TODO math
**** TODO science

I also want every entry to show up in my agenda.


texts: Can you activate/(bring to front) emacs using native elisp? (e.g when working in another program)

texts:
I want to force emacs to be activated, be bought to frond and 'steal' focus in certain circumstances. E.g when I finish a org-Pomodoro or during an important appointment reminder.

Now, I'm looking for a 'native' way to do so, just to reduce external dependencies.
(just Linux is ok for me, cross-platform would be better).

Is this technically possible from inside emacs?

[edit] Solution:

If using the GUI, this works well:

(x-focus-frame nil)

[For historical reasons...] I have tried:

Frame visibility (doesn't work)

(make-frame-visible)

And also:

(make-frame-invisible)
(make-frame-visible)

But these seem to only work if Emacs is already activated.

Frame raising (doesn't work)

Lowering frame seems to actually hide emacs.

(lower-frame)

But raising the frame from a timer doesn't. I.e, nothing happens.

(raise-frame)

It seems there is a missing 'activate-emacs' before raising it.

[NOTE on external solution]

Currently, as a (workaround/solution?) I use a bit of elisp:

(call-process "activateEmacs")

And the respective bash script: (you may need to install xdotool on your system first)

#!/bin/sh
sleep 0.5
xdotool search --onlyvisible --class emacs windowactivate


texts: What is the difference between `C-i` and ``?

texts:
I've just set

(define-key input-decode-map "\C-i" [\C-i])
(define-key input-decode-map "\C-m" [\C-m])
(define-key input-decode-map "\C-[" [\C-\[])

in my config, but I noticed that C-i is now remapped to <C-i>.

Where is the difference? It's possible to obtain only C-i?

I'm interested in getting a C-i not a \t or a <C-i>


texts: How to get sauron-org to work for org-mode events?

texts:
For some reason I can't get Sauron to see my org-mode events.  I can see that the sauron-org module has started though.  Is there something else I need to enable/turn on to get Sauron to see org-mode events?

I have (require 'sauron) in my init, and when I start sauron, it reports that the relevant sauron-org module is loaded, but I never get any sauron notifications of events from org.

The expected behaviour is that it would notify me 15 minutes, 10 minutes, 5 minutes, 2 minutes before events scheduled in org-mode.


texts:
I expect my reception to compile my daily agenda using .org capture. But they find using C-c C; C-c C-s; C-c C-c to capture, schedule and completion respectively difficult.
Can a single function keys like a f6 f7and f8 be used instead of default keys.
Kindly help


texts: How to set rel=nofollow as default for links in Org export to html?

texts: I need to add rel=nofollow for every link in my document but be able to change it using something like: #+ATTR_HTML: :rel index,follow. Any ideas?


texts: disable syntax highlight on inactive windows

texts:
I got the following code for highlighting inactive and active windows with different background color.  How do I make so that inactive windows have no syntax highlighting, only the active window has?

;; For inactive windows
(defun highlight-selected-window ()
  "Highlight selected window with a different background color."
  (walk-windows (lambda (w)
                  (unless (eq w (selected-window))
                    (with-current-buffer (window-buffer w)
                      (buffer-face-set '(:background "#262626")))))
                (font-lock-mode 0)
                )
  (buffer-face-set '(:background "#111"))
  (font-lock-mode 1)
  )
(add-hook 'buffer-list-update-hook 'highlight-selected-window)

As you can see, I tried to add the (font-lock-mode 0) to turn syntax off in the inactive windows. This turns off the syntax highlighting, however; the active window also has its syntax turned off.

Please let me know how to fix this and thank you


texts:
I just upgraded to the latest version of IPython and now something is wrong when using it in emacs.

When using it in a regular terminal it works fine (colors, tab-completion, etc.), however either in M-x eshell or M-x shell, instead of outputing In [1]:, it actually outputs [?12l[?25h and Out[1] outputs to [J[?7h[?12l[?25h[?2004l[?7hOut[1]:.

Maybe it's some feature of the terminal not available on emacs used by IPython, but I'd like to know which one it is.

Terminal.app:

In [1]: 2+2
Out[1]: 4

Emacs

[?12l[?25h2+2
[J[?7h[?12l[?25h[?2004l[?7hOut[1]: 4


texts:
Magit displays the progression of multi-step commands with popup windows. For example, pressing c brings up the commit menu, whence pressing a will invoke magit-commit-amend.

I would like to include my own command magit-commit-snapshot, and invoke it with cn.  n: Snapshot should be displayed in the commit menu, after s: Squash.

How can I do this? I can see that the bindings exist in magit-key-mode.el, but I don't see an easy way to add to them from my .emacs.


texts: Same or more powerfull as highlight-symbol?

texts:
Windows 10, Emacs 25.

I use package highlight-symbol for highlighting text. It's very useful.

But after 3 years of using it was not enough for me.

Is Emacs has another package with same or more powerfull capabilities?


texts: How to set Chinese fonts in modern Emacs

texts:
For a long long time, my Emacs font definition in X Resources has always been:

! -------------------------------------------------------------- &ss ---
! ............................................................ fonts ...
!Emacs.font:                            6x13
Emacs.Font:                             fixed

Emacs.Font: fontset-gbsimsun
Emacs.Fontset-0: -*-*-medium-r-normal--12-*-*-*-*-*-fontset-gbsimsun,\
ascii:-misc-fixed-medium-r-semicondensed--13-120-75-75-*-60-iso8859-1, \
chinese-gb2312:-*-simsun-medium-r-normal--12-*-*-*-*-*-gb2312.1980-*

That was set more than 15 years ago, and had never changed.

Now, Emacs has modernized dramatically since, and X is using fontconfig to define fonts, and Chinese encoding has changed from gb2312 to UTF8 as default as well. So, I'm wondering what's the modern fontsets setting for Emacs is to work with Chinese properly?

More details,

when give the example, please try not generalize but as specific as possible, assuming that I'm having all the MS default fonts in the system. I.e., please don't give example as <your_font_here>, but real thing like Microsoft YaHei etc.
the Fontsets from ergoemacs is still giving gb2312 as the example.
yet I can't get much from GNU fontset docs either

PS. I'm currently configuring my new Ubuntu 16.04 LTS Xenial environment, and for the first time, I've come to the point to be satisfied with my Ubuntu 中文设置. My Emacs is the last problem to conquer.


texts: Question on ox-odt : How to export special block as a two column section?

texts:
What I want to do is implement a special block, say, "Sect2", in an org file

#+attr_odt: :style Sect_2
#+begin_sect2
* heading 1
** subheading 1
* heading 2
#+end_sect2

"Sect_2" is a style defined in the template.

<style:style style:name="Sect2" style:family="section">
  <style:section-properties text:dont-balance-text-columns="false" style:editable="false">
    <style:columns fo:column-count="2" fo:column-gap="0in">
      <style:column style:rel-width="4986*" fo:start-indent="0in" fo:end-indent="0in"/>
      <style:column style:rel-width="4986*" fo:start-indent="0in" fo:end-indent="0in"/>
    </style:columns>
  </style:section-properties>
</style:style>

and the special block is translated according to the following template in the
final odt file. The name of the traslated block should increase automatically,
like "Sect_2_1", "Sect_2_2".

<text:section text:style-name="Sect_2" text:name="Sect_2_1">
[content]
<text:section>

Can anyone give me some tips on how to do this?


texts:
Emacs fails to load my init.el file after it fails to load .emacs.d/history file from (savehist-mode 1)

Here's the minimum history file

(setq minibuffer-history '("/home/eugenekim/.emacs.d/init.el" "Enabled" #("stash" 0 5 (face magit-hash magit-section [cl-struct-magit-section stash "stash@{9}" #<marker (moves after insertion) at 918 in *magit: zibann> nil #<marker at 962 in *magit: zibann> nil nil nil n\
il nil nil [cl-struct-magit-section stashes "refs/stash" #<marker (moves after insertion) at 602 in *magit: zibann> #<marker at 615 in *magit: zibann> #<marker at 1129 in *magit: zibann> nil nil nil nil nil nil [cl-struct-magit-section status nil #<marker (moves after in\
sertion) at 1 in *magit: zibann> nil #<marker at 1129 in *magit: zibann> nil nil nil nil nil nil nil ([cl-struct-magit-section branch "feature/review-tag" #<marker (moves after insertion) at 1 in *magit: zibann> #<marker at 47 in *magit: zibann> #<marker at 125 in *magit\
: zibann> nil nil nil nil nil nil #7 ([cl-struct-magit-section branch #("origin/feature/review-tag" 0 25 (face magit-branch-remote)) #<marker (moves after insertion) at 47 in *magit: zibann> nil #<marker at 100 in *magit: zibann> nil nil nil nil nil nil #9 nil] [cl-struc\
t-magit-section tag "saleor" #<marker (moves after insertion) at 100 in *magit: zibann> nil #<marker at 124 in *magit: zibann> nil nil nil nil nil nil #9 nil])] [cl-struct-magit-section unstaged nil #<marker (moves after insertion) at 125 in *magit: zibann> #<marker at 1\
46 in *magit: zibann> #<marker at 602 in *magit: zibann> nil nil nil nil nil nil #7 ([cl-struct-magit-section file "ios/littlehome/Externals/CTAssetsPickerController" #<marker (moves after insertion) at 146 in *magit: zibann> #<marker at 207 in *magit: zibann> #<marker a\
t 339 in *magit: zibann> t nil nil nil "diff --git ios/littlehome/Externals/CTAssetsPickerController ios/littlehome/Externals/CTAssetsPickerController
)

and here's the error log

  Debugger entered--Lisp error: (invalid-read-syntax "#")
  signal(invalid-read-syntax ("#"))   (condition-case errvar (progn
  (load savehist-file nil (not (interactive-p))) (setq savehist-loaded
  t)) (error (setq savehist-mode nil) (savehist-uninstall) (signal (car
  errvar) (cdr errvar))))   (progn (condition-case errvar (progn (load
  savehist-file nil (not (interactive-p))) (setq savehist-loaded t))
  (error (setq savehist-mode nil) (savehist-uninstall) (signal (car
  errvar) (cdr errvar)))))   (if (and (not savehist-loaded)
  (file-exists-p savehist-file)) (progn (condition-case errvar (progn
  (load savehist-file nil (not (interactive-p))) (setq savehist-loaded
  t)) (error (setq savehist-mode nil) (savehist-uninstall) (signal (car
  errvar) (cdr errvar))))))   (if (not savehist-mode)
  (savehist-uninstall) (if (and (not savehist-loaded) (file-exists-p
  savehist-file)) (progn (condition-case errvar (progn (load
  savehist-file nil (not (interactive-p))) (setq savehist-loaded t))
  (error (setq savehist-mode nil) (savehist-uninstall)$
  savehist-mode(1)   eval-buffer(# nil
  "/home/eugenekim/.emacs.d/init.el" nil t)  ; Reading at buffer
  position 19074
  load-with-code-conversion("/home/eugenekim/.emacs.d/init.el"
  "/home/eugenekim/.emacs.d/init.el" t t)
  load("/home/eugenekim/.emacs.d/init" t t)   #[0 "^H\205\266^@
  \306=\203^Q^@\307^H\310Q\202?^@
  \311=\204^^^@\307^H\312Q\202?^@\313\307\314\315#\203*^@\316\202?^@\313\307\314\317#\203>^@\320\321\322!D\nB^R\323\202?^@\316\324^S\325^A\324\211#\210^K\324=\203e^@\326\327\330\307^H\331Q!\"\325^A\324\211#\210^K\324=\203$
  command-line()   normal-top-level()

This happens when I open multiple emacs -nw at the same time. Sometimes but not always.


texts:
In my .emacs I have the following:

(progn ;
  (defvar my-keys-minor-mode-map
    (let ((map (make-sparse-keymap)))
      ; other bindings ..
      (define-key map (kbd "C-c c"    ) 'column-marker-3)
      map)
    "my-keys-minor-mode keymap.")

  (define-minor-mode my-keys-minor-mode
    "A minor mode so that my key settings override annoying major modes."
    :init-value t
    :lighter " my-keys")

  (my-keys-minor-mode 1)
  )

Reading the ColumnMarker documentation I see that I have to use C-u C-u M-x column-marker-1 to erase all column highlighting. My question is, how do I define that as a binding in the format similar to the above. E.g. how can I make something like the following work?

(define-key map (kbd "C-c d"    ) '(C-u C-u M-x column-marker-1)) ; this obviously doesn't work


texts: Extracting all annotations from a PDF using org-noter or pdftools in Emacs

texts:
Two questions:
(1) I'd like to unify my note-taking flow: I am using both org-noter and org-pdftools.
If I make an annotation using org-noter, it is created in the orgmode document to that end as a heading with a pointer. But when I click on the created annotation in the PDF, the pdftools annotation utility opens, instead of pointing to the org-noter heading referring to that annotation. How to make it point to the heading and avoid opening the inbuilt pdftools annotation utility?
(2) Is it possible to extract all annotations from a PDF into the org-noter orgmode document? (annotations not made with org-noter)?


texts: Why is my C-; being captured as C-_? How to fix it?

texts:
I'm trying to figure out why emacs is capturing C-; as C-_. I checked it using log-commands but also in a completely clean configuration I can open a file and it says "No further undo information" when I press it.

I'm using an abnt2 layout keyboard. Maybe that's it? How do I fix it?


texts: how to enter into visual block mode in evil on windows?

texts: in VIM on MS Windows, I could use C-q to enter into visual block mode. How about in evil? I tried the same but it doesn't work.


texts: TODO item for paying credit card bill 3 weeks after statement date

texts:
My credit card bill is due 3 weeks after the statement date. The statement date is always the 20th of the month. Due to the variable lengths of months, the due date is not always on the same day.
I'd like to have a TODO item with a time stamp on the credit card bill's due date. How can I do this in org? I know that I could enter 12 different entries for a year. I'm after a single TODO entry with a +1m indicating to roll the rule over to the next month, every month.


texts:
I think I've setup company mode correctly, yet I can't get company-dabbrv to work as default. I can launch it manually with company-dabbrv, but it won't auto-suggest completions in a buffer.

This is the output of company-diag:

Emacs 25.1.1 (x86_64-unknown-linux-gnu) of 2016-12-17 on foutrelis
Company 0.9.2

company-backends: (company-abbrev company-ispell company-bbdb company-nxml company-css company-eclim company-semantic company-clang company-xcode company-cmake company-capf company-files
        (company-dabbrev-code company-gtags company-etags company-keywords)
        company-oddmuse company-dabbrev)

Used backend: company-abbrev
Prefix: ""
Completions:
  "wokr"
  "willbe"
  "vulnerible"
  "tkaes"
  "tjhe"
  "specifc"
  "similiar"
  "sepcific"
  "relize"
  "propertiers"
  "proffesors
   ... (this goes on...)

So it seems to me dabbrv mode is loaded.

This is my config:

  (use-package company
   :ensure t
   :config
  (add-hook 'after-init-hook 'global-company-mode)

  (setq company-idle-delay 0)
  (setq company-minimum-prefix-length 2)

 (defun my-org-mode-hook ()
  (set (make-local-variable 'company-backends)
       '((company-capf company-files company-dabbrv))))

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

Any ideas on how to debug this?


texts: Include an element in a backquoted list only if it is non-nil

texts:
This is the "am I missing something obvious?" kind of question.
I would like to use backquotes in some way to make a value appear in a list only if it's not nil.  So, for instance, given x, get '(1 2 3) if x is 2 and '(1 3) if x is nil.  The following form will do the trick, but it looks convoluted:
`(1 ,@(if x (list x)) 3)

How can I do this another way, e.g., one that looks simpler? Obviously, I'm not interested in a solution using list functions.


texts:
I have

(add-hook 'json-mode 'flymake-json-load)

in my .emacs file, but it has no effect. I have to do M-x flymake-json-load whenever I visit a .json file. Why doesn't it work?


texts:
I am unable to set the C-, and C-. key bindings!
I tried adding the following,
(global-set-key (kbd "C-,") 'forward-char)
(global-set-key (kbd "C-.") 'forward-char)

In various installations of Emacs and instead of moving the cursor forward Emacs would print either the , or . characters.
C-h k C-, reports,
, runs the command self-insert-command (found in global-map), which is
an interactive built-in function in ‘C source code’.

similar output for C-..
Is it possible to set bindings for C-, or C-. in Emacs?


texts: Prevent fill-paragraph from breaking LaTeX displayed equations in Org Mode

texts:
In Org Mode fill-paragraph brakes the following paragraph (containing LaTeX displayed equation)

* Some headline
   Text text text
   \[
   e=mc^2
   \]
   text text text.

into

* Some headline
  Text text text \[ e=mc^2 \] text text text.

so the Org Mode form (with LaTeX preview) no longer reflects the LaTeX layout.

How can I prevent fill-paragraph from breaking LaTeX displayed equations?

UPDATE (edited on 11.04.2017)

By hacking org-element.el file I've modified org-element-paragraph-separate variable (in place of its definition). Now it includes also the "\\\\\\[" regexp, so \[ is recognized as a place when new paragraph begins. The attempt to modify the org-element-paragraph-separate in my init file has failed.

Unfortunately this is only a halfway solution: running fill-paragraph with cursor point before \[ does not break the equation, as expected, but when I run fill-paragraph having the cursor after \[ the paragraph changes to

* Some headline
  Text text text
  \[ e=mc^2 \] text text text.


texts: How to cycle over a pre-defined list of fonts?

texts:
I would like to be able to switch fonts quickly between a predefined list of mono-spaced fonts I know work well in Emacs.
Instead of selecting the font from all system fonts which shows too many, most not working well for writing code.
What's a good way to do this in Emacs?


texts: Is there a Magit hook for post checkout?

texts:
Unfortunately, the vc-mode in my mode-line is not being updated when checking out a branch, it still points to the older branch. revert all open buffers fixes than but I can't find a hook to attach the reverting to.

Is there a way to execute a function whenever I do a checkout through Magit?


texts:
Writeroom mode and linum mode are incompatible (leave numbers at
far left, making them useless for (evil) jumping).  Is there anything
else I can do to get centered text with (relative) line numbering close to the text?


texts:
I have a function that gets called when idle, but I would like it to run only when a frame has input focus.

My current work around is to use focus-in-hook and focus-out-hook to change the behavior when idle, but I'd like to simplify it by just having one function that would check whether or not it had focus. Here's the code I am working with:

(use-package zone
  :ensure shut-up
  :commands (zone-when-idle)
  :bind ("C-c z" . zone)
  :init
  (setq zone-timeout 30)
  (defun zone-when-idle-and-focused ()
    "Use with `focus-in-hook' to only zone when our focus is back in Emacs."
    (zone-when-idle (or zone-timeout 30)))
  (defun zone-nodoze ()
    "Use with `focus-out-hook' so we don't zone when our focus is elsewhere."
    (let ((inhibit-message t)) (zone-leave-me-alone)))
  (add-hook 'focus-in-hook #'zone-when-idle-and-focused)
  (add-hook 'focus-out-hook #'zone-nodoze)
  (zone-when-idle zone-timeout))


texts: Fixing wrong-type-argument to looking-at in Emacs 25 js-mode on large files

texts:
When using js-mode (or js2-mode) on Emacs 25.1 (in Debian 9) to edit some large files, any attempt to insert text after some "random" point in the file fails with an elisp stack trace:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  looking-at(nil)
  c-state-semi-safe-place(269817)
  c-literal-limits(nil nil t)
  c-context-line-break()
  funcall-interactively(c-context-line-break)
  call-interactively(c-context-line-break nil nil)
  command-execute(c-context-line-break)

Why and how can it be fixed?


texts:
I keep getting the following error

    1 c:/Program Files (x86)/Git/bin/git.exe … "commit" "--amend"

    *ERROR*: Wrong type argument: stringp, nilerror: There was a problem with the editor '"c:/Users/George/Desktop/Emacs25/bin/emacsclient.exe"'.
    Please supply the message using either -m or -F option.

I found a few people had similar problems several years back, but none give me a way to fix it. I'm on a Windows 10 machine and not really a pro at emacs - so I'm not sure how to resolve this problem.

I've confirmed git is working fine through gitbash.

I also tried deleting all my packages (to make sure there are no weird conflicts) and reinstalled magit from MELPA.

I'm running Emacs 25.1.


texts: How to fix indent of multiline dotpaths in javascript

texts:
I would like my code to look like this:
this.imgs.push( $('<img>').attr('src', data.src)
                          .css('position', 'absolute') );

this.imgs[i].css('left', data.x)
            .css('top', data.y);

(Actual code is longer and more complex, but you get the idea)
That is, when a line starts with a dot, it should line up under the last dot of the same parenthesization level on the previous line.  Is there a way to make emacs auto-indent like this?
I've tried both javascript-mode and js2-mode and both seem to ignore leading dots.


texts: Variable not parsed inside other variable definition

texts:
I want to store the credentials for posting to my blog secret. Therefore I load them using EasyPG and put them in the variables blog-username and blog-password.

When I show the content of those vars using C-h v blog-username (describe-variable) the values are correct.

However when I set the wp-blog-alist value those values seem to not be parsed. This is the error message:

  xml-rpc-value-to-xml-list: Wrong type argument: stringp,
  blog-username

Here is how I use the function.

(setq
 org2blog/wp-confirm-post t
 org2blog/wp-blog-alist
 '(
   ("0xcb0"
    :url "http://www.my_blog_address.com/xmlrpc.php"
    :username blog-username
    :password blog-password
    :default-title "Hello, World!"
    :default-categories ("Uncategorized")
    :tags-as-categories nil)
    ))

What syntax do I need to use inside the second setqfor org2blog/wp-blog-alist ?


texts: How show % near rows and columns in mode line?

texts:
Emacs 26.1
I use smart mode line: https://github.com/Malabarba/smart-mode-line

Here result:

Nice. It's work fine.

But I need to show % near rows and columns.
Something like this:

712:93 (17%)

Is it possible?


texts: Text is shown as bounding boxes when I switch to Arabic input method and use a certain font

texts:
I use this function in init.el file so that I can switch to Arabic language when writing code in Arabic and select an Arabic font for that:

(defun arabic-input-font ()
  "changes the set-input-method to Arabic and selects another font"
  (interactive)
  (set-input-method "arabic")
  (face-remap-add-relative 'default :family "Droid Arabic Naskh" :height 110))

When I use any other Arabic font there is no problem. Problem arises only when I choose this font Droid Arabic Naskh, source of this font. I like this font for its clarity in writing.

Scratch buffer before switching to this font:

Scratch buffer after:

I want to use the following fonts for the three languages as fallback fonts for their respective languges:
English - consolas
Arabic - Droid Arabic Naskh
Hebrew - SBL Hebrew

I will be very grateful for fixing this issue and let English script appears along with the Arabic one using this font.

Notes

Emacs version: GNU Emacs 24.4.1 (i686-pc-mingw32)
Windows platform


texts: a lisp function to toggle a mode (org mode in this case) on and off with a single shortcut

texts:
I'm trying to create a shortcut (C-c c)
regardless of what kind of file is currently opened
(it could be a .pl file or a .txt file or an extension less file)
pressing C-c c should turn on org mode if its not turned on already.
pressing it again and again toggles it off and on....

Here's what I have

(global-set-key (kbd "C-c c") (lambda () (interactive)
  (org-mode))))

Any help?
It's important that when turning off org mode, whatever the "native" mode the file was originally on comes back on.


texts: Executing code within Org mode `begin_src` ... `end_src` blocks

texts:
How to configure Emacs to run code in different languages as shown in this post?
Specifically, how to run these type of code blocks #+begin_src shell :results list ?

After 9 years of vim, that post inspired me to try Emacs. What attracts me is the ability to run a wide range of code within Emacs. I successfully configured Emacs to run in Evil mode with the keybinding I prefer, but I still have difficulties to find how to make it work as demonstrated in the post.


texts: ido-mode breaks docker-tramp completion in minibuffer, and opens wrong files

texts:
Somehow the following minimal emacs config breaks docker-tramp. Completion in the mini-buffer does not work for /docker:, nor the container ids/names like /docker:43893ad331df, and once you type out the full tramp string like: /docker:43893ad331df/ completion then suggests files from the host fs where emacs is running, not from the docker container fs, and if you type out the path to a file that exists in both fs' then it will be opened on the host fs not the container fs, and a file that only exists on the container fs will not be found at all.
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")("melpa" . "http://melpa.milkbox.net/packages/")))
(package-initialize)
(add-to-list 'load-path (concat "~/.emacs.d/" (file-name-as-directory "elpa")))

(require 'tramp)
(setq tramp-verbose 9)
(require 'docker-tramp)

(defvar ido-dont-ignore-buffer-names '("*scratch*" "*Occur*"))

(defun ido-ignore-most-star-buffers (name)
  (and
   (string-match-p "^*" name)
   (not (member name ido-dont-ignore-buffer-names))))

(defun bind-ido-keys ()
  "Keybindings for ido mode."
  (define-key ido-completion-map "\C-n" 'ido-toggle-ignore))
(add-hook 'ido-setup-hook #'bind-ido-keys)

(ido-mode 1)
(setq ido-use-virtual-buffers t)
(add-to-list 'ido-ignore-buffers 'ido-ignore-most-star-buffers)

Any idea what is going on, and how to fix it?
Edit: The issue went away with emacs 27.1. No idea why.