texts: Move selected sentence, word left/right by equivalent unit?

texts:
More broadly, should work by the selected semantic unit (incl. paragraphs in text mode, and the relevant units in other modes). I.e., if a sentence is selected, then the notional "move-left" would move the selected sentence to before the preceding sentence; if a word is selected, then analogously, move the selected word to before the preceding word.

The solution is intended to be used in combination with expand-region https://github.com/magnars/expand-region.el

smart-shift is somewhat similar, but moves the selection by a character at a time.

transpose-words and transpose-sentences are also similar but require a negative argument to move "to the left"; and they are distinct functions, while I would like to have a single function that understands its context, i.e. whether a word, a sentence, etc. is selected.


texts:
I have a couple of functions for inserting blank lines above and below the current line:

(defun insert-line-below ()
  (interactive)
  (move-end-of-line nil)
  (open-line 1))

(defun insert-line-above ()
  (interactive)
  (move-beginning-of-line nil)
  (newline-and-indent)
  (indent-according-to-mode))

Theyre working, but theres a minor annoyance. The point moves to either the beginning or end of line after calling the function.

How could I change these functions so that a new blank line is inserted, but my point returns where it was before the function call?


texts: interactively crop screenshot region and insert link to local image in org buffer

texts:
I am trying to pull together information that is scattered across a multipage PDF in an org buffer. The related items typically occupy a small region on a page only and may be many pages apart, hence the attempt to arrange them side by side in an org buffer where these images shall be included as a visual cue as org inline images along with a commentary.

Ideally, the region of interest would be drawn interactively as a rectangle and pasted in the org buffer in a way that saved the image locally in a subfolder next to the org file and inserted a link to the local file.

1) imagemagick
I am aware of "Automatic screenshot insertion” over at http://orgmode.org/worg/org-hacks.html which involves imagemagick and seems to do what I want except I see no obvious way to crop the screenshot before inserting the link.
Saving the file first and cropping it manually is a stronger disruption of the workflow than I'd like since I expect lots of these.

2) accessing the system clipboard
Depositing a suitably cropped screenshot to the system's clipboard in OS X is easily done using grab.app. If this could be used, that'd be fine.

Any ideas?


texts: How do I reload config in other instances of emacs?

texts:
Say, I changed ~/.emacs, but I have another instances of emacs running. I believe unless I do something, they might change the config (because they have a stale notion of its contents), which in turn will result in losing the changes above. I can think of the following cases where emacs changes settings on its own:

installing packages
"easy" customization (M-x customize)
adding/removing agenda files (C-c [, C-c ])

How do I make it so that no changes is lost?
I don't want to use emacs server, since that supposedly means I have one frame (okay, not necessarily), one buffer list, and probably more. Or is this generally the best way to go about it after all?


texts: Does `mapc` place a symbol on the active element of the sequence?

texts:
I understand that (eq '(3 . d) '(3 . d)) returns nil, and (eq 3 3) returns t.  But I do not understand why delq is deleting one (3 . d) in the second example each loop when y is (3 . d).  Is mapc placing some type of invisible symbol on one of the (3 . d) but not the others such that only one (1) of them in the sequence is eq?

(let* ((original '(0 1 2 3 3 3 3 4 5 6))
       (copy (copy-list original)))
  (mapc (lambda (x)
          (mapc (lambda (y)
                  (message "y: %s | copy: %s" y copy)
                  (setq copy (delq y copy)))
                copy))
        original))

In the second example, one (3 . d) is deleted each loop when y is (3 . d).

(let* ((original '((0 . a) (1 . b) (2 . c) (3 . d) (3 . d)
                   (3 . d) (3 . d) (4 . e) (5 . f) (6 . g)))
       (copy (copy-list original)))
  (mapc (lambda (x)
          (mapc (lambda (y)
                  (message "y: %s | copy: %s" y copy)
                  (setq copy (delq y copy)))
                copy))
        original))

Note: copy-sequence is an alternative to copy-list a.k.a. cl-copy-list (defined in cl.el).


texts: org agenda: how to show only todo's with deadline?

texts:
Is it possible to make the agenda views to only show tasks with a deadline, hence skipping all tasks containing only scheduled time?

The reason for this question is that I am NOT using scheduled time for when to start on a task, like having an appointment with my self, but instedad I am using scheduled time only for determining when a task will be visible in my task list. Hence I typically work on tasks that have their scheduled time days or weeks back in time. Of this reason, it is only the deadline-tasks I want to see in my agenda views. Is that possible?

Thanks for any suggestions, hints or help.


texts: Quickly insert source blocks in org mode

texts:
org-mode has the ability to render source code, with blocks of the following syntax:

#+NAME: <name>
#+BEGIN_SRC <language> <switches> <header arguments>
    <body>
#+END_SRC

Is there an existing command to quickly insert these blocks in org-mode, or do I need to use an external tool like yasnippet?


texts: Replacing selected text in Emacs with one character

texts:
In Vim, I can do this trick on a line with the words "People":

yy p Shift-v r +

It will produce a set of lines that like this:

People

++++++

I would like to be able to reproduce this in Emacs if possible.


texts: org-publish-project fails because of defective org-links - repair links automatically or ignore them?

texts:
I'm trying to "quickly" export my notes ans tasks from org-mode to a html-page with org-publish-projects.

I had a working setup some years ago and I'm trying to reactivate it, but doing the export constantly throws errors like "Unable to resolve link "name of heading" (also some links to entries with custom IDs gave errors).

If I repair each link manually, I loose to much time.

Can I make org-publish ignore skip those defective links and just list them in the log messages?
is there a way to repair those links automatically?


texts:
Today I got scared after noticing how many Microsoft ATP Safelinks had made their way into my org-mode calendar file. Therefore, is it possible to create a URL decoder to bypass Microsoft Safelinks for mu4e(gnus)? There are implementations for other mail-clients in Python? and Javascript but elisp (if possible) would be preferable. I am using mu4e 1.4.1 and emacs 26.3. Thanks in advance.

Update:

Thanks wasamasa. To wire it up to mu4e I've developed a url reader (below), based on this answer.


texts:
From my understanding, Emacs creates a region my setting a mark and then anything between 'mark' and 'point' is the current region. I'm wondering if there is a way to create a region with only marks, freeing up point so I can put my cursor wherever I want and still have a particular region highlighted.

If I am misunderstanding how Emacs works, please let me know.


texts: Passing in arguments for evil-ex-command

texts:
I understand that evil-ex-define-cmd allow me create my own ex commands.

Although in Vim, you were able to narrow down the search by doing something like

:h <term>

I'm not sure how to accomplish the same in evil, or if this is even possible.


texts: What variables are needed in init file in order to run eww in emacs 24.5.1 for windows?

texts:
I'm using emacs on windows, output of "emacs-version" outputs

GNU Emacs 24.5.1 (i686-pc-mingw32) of 2015-04-11 on LEG570

I added the missing libxml2.dll, (downloaded from ezwinports) in the emacs path to quiet emacs whining about the missing dlls. Trying to open websites results in three outcomes

1.

Opening TLS connection with `openssl s_client -connect www.wikipedia.org:443 -no_ssl2 -ign_eof'...failed
Opening TLS connection to `www.wikipedia.org'...failed
error in process filter: url-http: Could not create connection to www.wikipedia.org:443
error in process filter: Could not create connection to www.wikipedia.org:443

and the website refuses to open

2.

error in process sentinel: Invalid date: Mon, 06 Mar 2130 20:55:03 GMT

website doesn't open, after some googling I dug up a bug report with apparently the same bug which seem to have been patched in emacs 24.4 version

3.

I am able to connect to the websites, hyperlinks are alive, but the buttons (i.e. google search and etc) not working

tl;dr

Added missing dll's to run eww in emacs
Can't access most websites with the exception of google news
Buttons in websites like google (search) is not working

What other variables need to be tweaked to get eww running correctly? or is this normal?


texts: org-mode + evil: insert heading, set cursor to line ending, and change to insert mode?

texts:
I am using spacemacs which contains org-mode and evil. Whenever I insert a heading (either org-insert-heading, org-insert-heading-after-current or org-insert-subheading), I have to do two extra actions: move cursor to the end of line, change to insert mode to start typing. How do I get these two actions done automatically for all the insert heading functions?

What I am thinking now is to write wraper functions for these functions, and then redefine the shortcut keys. But wouldn't there be a better way?


texts:
I'm trying to setup activating virtual environments conditional on hostname.
Until recently I've been using...
(pyvenv activate "~/.virtualenv/default")

...across all hosts, but because work laptop is locked down and stuck on an old (3.6.9) version that isn't going to get updated any time soon and I've have started using features of Python 3.8.3  I've switched to using the Conda Virtual Environment which is installed in ~/.miniconda3.
I've read a few threads and based on this and this I could write an if statement.  However, I prefer the solution here, so I've started with...
(setq virtualenv-byhost
      '(("kimura" . "~/.virtualenvs/python3_9")
       ("work" . "~/.miniconda3/")))

Next step though has me a little stumped since I'm still getting started with Lisp and haven't sat down and started learning it formally.
(pyvenv-activate
 (cdr
  (assoc system-name virtualenv-byhost)))

If I understand it (assoc system-name virtualenv-byhost) associates whatever system-name returns with the virtualenv-byhost, but how does it know which to pick and pass onto the parent pyvenv-activate?  Is that what cdr is doing and if so what is it doing and how?


texts: Can't enable a file in Version Control RCS in Emacs 26

texts:
Trying here to set a file with VC RCS, but I'm having some trouble finding the .el file and enable it.

Already managed to download rcs.el from this link, but it isn't being recognized in Emacs.

Already copied it into ~/.emacs.d/lisp/ and added following info in .emacs file:

(add-to-list 'load-path "~/.emacs.d/lisp/")
(load "rcs")

It just returns me the error message Searching for program: No such file or directory, rcs, despite having tried to enable it via Ctrl + x v v command.


texts:
I'm on day 2 of my switch from 15 years of Vim to Evil Emacs -- so I'm just starting learning how to customize emacs and how to read elisp.

Question 1

I'm trying to use helm-projectile-find-file with elscreen-find-file  That is, I want search for a file in my project and open up in a new window/tab.

I tried creating my own version of elscreen-find-file like this

(defun elscreen-find-file (filename)
  "Edit file FILENAME.
Switch to a screen visiting file FILENAME,
creating one if none already exists."
  (interactive "FFind file in new screen: ")
  (elscreen-find-and-goto-by-buffer (helm-projectile-find-file filename) 'create))

But it's not activating the helm-projectile-find-file functionality. I'm curious to learn the best way to accomplish this task. Thanks

Question 2:

I think by answering just #2 I can extrapolate a solution for #1.  I'd like to helm-projectile-find-file and split the result in a new vertical window

Follow-up

I think it might have been a simpler solution to just open up a blank tab, switch to it, and then run helm-projectile

I did something similar trying to replicate Vim's vsplit:

  (defun vsplit ()
    (interactive)
    (progn
      (split-window-right)
      (other-window 1)
      (helm-projectile)))


texts: Table refuses to forget cell formula which once overrode a column formula

texts:
The following is very simple org-mode spreadsheet in which the cells in the second column show the triple of the corresponding cell in the first column due to the "column formula" in its TBLFM row $2=3*$1;N.  However the third row (actually row @4) is an exception because of the "cell formula" @4$2=string("Exception") which expectedly overrides the above column formula.

|--------+-----------|
| Number |    Triple |
|--------+-----------|
|      1 |         3 |
|      2 |         6 |
|      3 | Exception |
|      4 |        12 |
|--------+-----------|
#+TBLFM: $2=3*$1::@4$2=string("Exception")

So all is well.  Below you will find a copy of the above table, except that, after copying, I have deleted the exceptional formula affecting cell @4$2.

|--------+-----------|
| Number |    Triple |
|--------+-----------|
|      1 |         3 |
|      2 |         6 |
|      3 | Exception |
|      4 |        12 |
|--------+-----------|
#+TBLFM: $2=3*$1

One would expect that, after updating this table with C-u C-c *, or C-c C-c in the TBLFM line, the exceptional value in cell @4$2 would revert to the triple of '3', but instead the string "Exception" stays put.  Is this a bug or am I doing something wrong?

I noticed that if I save the file, close it (kill-buffer) and then reopen it, the strange behaviour disapears, namely, updating the table with C-u C-c * causes cell @4$2 to turn to '9', as expected.

I am using GNU Emacs 24.3.1 and the latest version of org-mode.


texts:
I use flyspell hunspell for checking my spelling mistakes in Emacs. Recently, when I run M-x flyspell-mode in .org or .tex files I got the following error:

Error enabling Flyspell mode:
 (hunspell exited with signal  Abort trap: 6)

I didn't get this error in the past, and I think I have changed nothing from my config.

My .emacs file for latex, ispell and hunspell are:

;; LATEX
;;
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)

(setq ispell-program-name "hunspell") ;; Dictionaries
(add-hook 'LaTeX-mode-hook 'visual-line-mode)
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
(add-hook 'LaTeX-mode-hook 'TeX-source-correlate-mode)

(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
(setq TeX-PDF-mode t)

(setq TeX-output-view-style
    (quote
     (("^pdf$" "." "evince -f %o")
      ("^html?$" "." "iceweasel %o"))))

;;
;;ispell config
;;
(setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin"))
(setq exec-path (append exec-path '("/usr/local/bin")))

How can I debug this?

UPDATE

I solved the problem by:

upgrade brew
removing:

(setq ispell-program-name "hunspell") ;; Dictionaries

;;
;;ispell config
;;
(setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin"))
(setq exec-path (append exec-path '("/usr/local/bin")))

and adding:

(setq ispell-program-name "hunspell")
(setq ispell-local-dictionary "en_GB")
(setq ispell-local-dictionary-alist
      '(("en_GB" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil nil nil utf-8)))


texts: Is there a way to add git alias of customized log to magit?

texts:
In ~./gitconfig, I have

[alias]
lg1 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all

In magit, when type ll, it will log differently.

Is there a way to add another keystroke combination (such as lL) in magit to do customization log as lg1 above?


texts: Make `thing-at-point` treat dot as a symbol-constituent character?

texts: Is there a way to tweak thing-at-point symbol regexp, so that it ignore dots as separators? Right now foo.bar in my Emacs is recognized as two different symbols, where I wish it was one.


texts: org mode - inline image float to right overrided by codeblock

texts:
When export to html,the inline image has been overrided by inline image:

#+OPTIONS: toc:nil
#+TITLE:
#+STARTUP: showeverything
#+STARTUP: indent
#+OPTIONS: html-postamble:nil
#+HTML_HEAD: <style>pre.src {background-color: #eff0f1;width 50%;}</style>
#+ATTR_HTML: :style border:12px solid black;float:right;

* Unit circle
#+ATTR_HTML: <style>pre {width 50%;}</style>
#+BEGIN_SRC gnuplot :exports both :file unitcircle.png
reset
set border lw 1.5
set style line 1 lc rgb '#0060ad' lt 1 lw 2     # --- blue
set style line 2 lc rgb '#dd181f' lt 1 lw 2     # --- red

unset key; unset tics; unset border
set size ratio -1
set xrange [-1.2:1.2]
set yrange [-1.2:1.2]
set trange [0:2*pi]

set parametric

r = 1.0
h = r / sqrt(2.)
set arrow from 0,0 to h,h nohead ls 2
set label 'r' at 0.28,0.45 textcolor ls 2

fx(t) = r*cos(t)
fy(t) = r*sin(t)

plot fx(t),fy(t) ls 1
#+END_SRC
#+CAPTION: Fig. 1 Unitcircle
#+ATTR_HTML: :style border:2px solid red;float:right; :width:50%
#+RESULTS:
[[file:unitcircle.png]]

* Cosine
#+BEGIN_SRC gnuplot :exports both :file cosine.png
reset
set xrange [-1*pi:1*pi]
set yrange [-1.5:1.5]
f(x) = cos(x)
g(x) = 0
plot f(x) title 'cos(x)' with lines linestyle 1, \
     g(x) notitle with lines linestyle 2
#+END_SRC
#+CAPTION: Fig. 2 cosine
#+ATTR_HTML: :style border:2px solid red;float:right; :width:50%
#+RESULTS:
[[file:cosine.png]]

Output:

But I wish:

The codeblock should not override the inline image.
The Caption lines should float with the image (above the image exactly).


texts:
Does the : have a special meaning in Elisp?
     (define-minor-mode dap-mode
          "Global minor mode for DAP mode."
          :init-value nil
          :group 'dap-mode
          :global t
          :require 'dap-mode
          :lighter (:eval (dap-mode-line))
          (dap--after-initialize)
          (add-hook 'lsp-after-open-hook 'dap--after-open))


texts: Jumping to the first error -- not warning -- when compiling

texts: The compilation-auto-jump-to-first-error option should make Emacs jump to the first error during compilation. However, it seems that Emacs treats warnings and errors in the same way, and jumps to the first one of either.  How would you make Emacs jump to the first error if any, or to the first warning otherwise?  I would rather fix errors first, and then warnings (especially because warnings could be caused by third-party libraries).


texts: Forbid inserting text before and after overlay

texts: Is there any way to forbid insertion of text before and after specific overlay? (I mean on the same line that displays overlay.) Forbid means that either changes cancelled somehow or immediately reverted, or something like this. I'm ready to consider other options as well.


texts: Batch-export org-mode subtree by headline?

texts:
Pretext

I am using the emacs batch mode to script the export of .org files to LaTeX via a Makefile, and I am aware of some of the customization options that exist in that regard.

For example, I can (under Emacs 25.2.2 with org-mode 9.1.11) successfully use the command

emacs my.org --batch --eval "(org-latex-export-to-latex nil nil nil t)" --kill

to export only the body (via the fourth argument set to t) of my.org file to my.tex. The arguments of org-latex-export-to-latex are described at https://github.com/emacsmirror/org/blob/master/lisp/ox-latex.el#L3588.

Problem description

I am now looking for a possibility to batch-export a specific subtree from an .org file. In other words, while I have already managed to script the 'body-only' C-e C-b option of a manual org-mode export, I am now trying to also automate its C-e C-s option.

This raises the question of how to identify the desired subtree to-be-exported.

Not quite what I want: Export by ID via .el script

The exact same problem that I am describing is also formulated at

https://lists.gnu.org/archive/html/emacs-orgmode/2015-02/msg00133.html

The responses suggest to export a section by its ID property and include pointers to

https://code.orgmode.org/bzg/org-mode/src/master/testing/lisp/test-ob.el
https://code.orgmode.org/bzg/org-mode/src/master/testing/examples/babel.org

for according emacs-lisp code, as well as a more specific emacs-lisp code example, which I can successfully get to export a specific section by its CUSTOM_ID property.

However, this solution has the following flaws:

It includes the heading of the section identified by CUSTOM_ID, whereas a subtree exported manually via C-e C-s contains only the content of the exported section (which is what I want).
It requires me to specify CUSTOM_IDs, whereas I am hoping to identify the subtree to-be-exported by the text of its headline.
It requires emacs-lisp code. :)

Perhaps a better solution: 2nd argument of org-latex-export-to-latex?

The code for org-latex-export-to-latex at https://github.com/emacsmirror/org/blob/master/lisp/ox-latex.el#L3575 shows that its second argument relates to the export of subtrees, and I am wondering whether it can be used to achieve my goals outlined above.

The comment at https://github.com/emacsmirror/org/blob/master/lisp/ox-latex.el#L3588 says:

  When optional argument SUBTREEP is non-nil, export the sub-tree at
  point, extracting information from the headline properties first.

However, the code comment above to me raises the following questions:

What does "at point" mean?
How exactly would it "extract information from the headline properties"
What meaningful non-nil values can I set this option to?

I would appreciate examples of how the second argument of org-latex-export-to-latex can be used in practice.


texts: How can I get :LOGBOOK: into Column View?

texts:
The items in my org-mode file will have a number of properties relating to data points that I need to capture. In conjunction with this, I'd like to continue using C-c C-z to log notes tracking progress against each item.

The end goal is to get everything into column view, which will let me get the information into CSV format.

Column View seems to be primarily centred on the :PROPERTIES: drawer, plus a couple of other key attributes of an org headline (such as TODO keyword and Priority) but it doesn't seem like task notes/:LOGBOOK: is one of these.


texts:
I want to set keybinding for C-c C-n rather than C-c n. Is it possible?
(global-set-key (kbd "C-x C-s") 'func) ;; Works
(global-set-key (kbd "C-c n")   'func) ;; Works
(global-set-key (kbd "C-c C-n") 'func) ;; Does not do anything :-(


texts: How to know when or when not to use the single quote before variable names?

texts:
I have the below:

(setq some-variable "less")

I am confused why I have to use the single quote with boundp but not with bound-and-true-p.

Example 1:

(when (boundp 'some-variable)
   (message "some-variable is %s" some-variable))

Result:

  "some-variable is less"

Example 2a:

(when (bound-and-true-p some-variable) ;; Note that using single-quote causes error
   (message "some-variable is %s" some-variable))

Result:

  "some-variable is less"

Example 2b:

(when (bound-and-true-p 'some-variable) ;; Note that using single-quote causes error
   (message "some-variable is %s" some-variable))

Result:

  and: Wrong type argument: symbolp, (quote some-variable)


texts: Copy/Paste (yank) problems with emacs in WSL2 with VcXsrv (from clipboard)

texts:
I have two problems with emacs when I'm using it with WSL2 and VcXsrv.
When I copy something out of emacs and paste/yank it in a buffer, it usually works smoothly except for two cases:

If I select some text in the buffer because I want to yank on top of it it yanks the selected text and deletes the text I have in my clipboard

Some unicode characters are not yanked at all even though I can put them with M-x counsel-unicode-char for example. Example: "•". If I paste it I get: "" but if I M-x counsel-unicode-char RET 2022 RET the character is displayed. I can copy it and paste it here but I can't yank it back to emacs.

Precision: I have the exact same config for emacs on Ubuntu and don't have these two problems so it looks like it comes from using it in Windows.


texts: How can I return back to point position after jumping by ``?

texts:
How can I return back to point position after jumping by <down-mouse-1>?

Example: moving in the buffer for a while with C-pbfn, then use mouse for navigation, and press C-u C-<space> trying to return back, but last point not in mark-ring.


texts:
I'd like to browse source code in emacs by searching for 'word' or 'tag' hits in a way somewhat similar to etags but:

clicking on words to search for matches across a code base (say a directory or project)
each click leads to a search hits listing view that itself has words that can be clicked to search again

To be more specific: Here's a program that works similarly to what I would like to use in emacs -- it's a small web application in Python:

https://github.com/mseaborn/sbrowse

There are basically two views, which might perhaps map onto emacs something like this:

web view -> emacs 'view'
------------------------
source code -> a regular editing buffer with appropriate mode (say python-mode)
hits listing -> something like compilation-mode

In the source code view, one can click on a 'word' to jump to the hits listing.

The hits listing looks like the inline block below (here I've shown what you'd see on searching for 'spam'

path/to/file.py:
104:    ham = spam()
123:    # Some more spam

path/to/other/file.py
98:     ham *= spam ** 2

From here one might:

Click on 'ham' or 'Some' and get a similar listing for that word
Click on a line number ('98:') to jump to a source code view that shows the hit in context
Click on a file path is a link to jump to the top of the corresponding source code view

Usually the search is done by simple grepping for words based on regexp word boundaries or similar.  One other feature of sbrowse that is nice, though, is that it has pluggable search implementations.  For example, I would like to be able to implement an elisp function or unix command to search using https://github.com/google/codesearch, so that clicks in both views perform the search using that program.

Is there anything available like this in the emacs universe?


texts: gpg password entry in minibuffer, not popup

texts:
On a new install

Debian Stretch
GNU Emacs 24.5.1
gpg (GnuPG) 2.1.18
libgcrypt 1.7.6-beta
pinentry-gnome3 (pinentry) 1.0.0

ls - /usr/bin/pinent*
/usr/bin/pinentry -> /etc/alternatives/pinentry
/usr/bin/pinentry-curses
/usr/bin/pinentry-gnome3
/usr/bin/pinentry-gtk-2
/usr/bin/pinentry-qt
/usr/bin/pinentry-qt4 -> pinentry-qt
/usr/bin/pinentry-tty
/usr/bin/pinentry-x11 -> /etc/alternatives/pinentry-x11

ls -1 /etc/alternatives/pinentry*
/etc/alternatives/pinentry -> /usr/bin/pinentry-gnome3
/etc/alternatives/pinentry-x11 -> /usr/bin/pinentry-gnome3

with ~/.gnupg/gpg-agent.conf containing:

allow-emacs-pinentry

I'm still getting a popup dialog titled pinentry-gnome3 asking for the passphrase.  When I changed pinentry symlink to point to the other varieties, analogous behaviour ensued.

What do I need to do to have the passphrase handled in the minibuffer?

========================================================================
EDIT 2017-05-02: After more research, it seems the current Debian distro is opposed to having Emacs handle the passphrase and the distro has gone to some effort to thwart it. So, my conclusion is that it is not possible without going outside the distro.  In personal correspondence today, the distro remains opposed.

This wasn't always the case. I may boot back to a Wheezy installation (a point at which I know it was possible) to see if C-h l retrieves the passphrase.

Here are a few links.  The most recent Debian discussion is about 3 months old:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=854797

Here are some alternatives to EasyPG:

https://www.emacswiki.org/emacs/AutoEncryption

here are some other links with related info:

https://dev.gnupg.org/rP676b1ac38d0c1db754492b6817bbc6195dcef300
https://dev.gnupg.org/search/query/FIKmVT3HTNd./#R
how to use minibuffer instead of pop-up window for GPG files?
https://unix.stackexchange.com/questions/55638/can-emacs-use-gpg-agent-in-a-terminal-at-all/278875
How to type the password of a .gpg file only when opening it


texts: What is the difference between setq-mode-local and setq-local

texts:
I don't understand how setq-mode-local works (mode-local is a package from cedet).
The macro's documentation says:

  setq-mode-local is a Lisp macro in `mode-local.el'.

  (setq-mode-local MODE &rest ARGS)

  Assign new values to variables local in MODE.
  MODE must be a major mode symbol.
  ARGS is a list (SYM VAL SYM VAL ...).
  The symbols SYM are variables; they are literal (not evaluated).
  The values VAL are expressions; they are evaluated.
  Set each SYM to the value of its VAL, locally in buffers already in
  MODE, or in buffers switched to that mode.
  Return the value of the last VAL.

Does the mode need to be loaded?
How does this differ from just adding a setq-local call to a mode-hook?


texts: When should one use the deactivate-mark function vs just setting that var to t?

texts:
I am trying to understand the implication of using

(setq deactivate-mark t)

vs

(deactivate-mark)

In order to try to notice any difference, I made this dummy function:

(defun my/dummy-fn (arg start end)
  (interactive "P\nr")
  (if arg
      (setq deactivate-mark t)
    (deactivate-mark))
  (message "Arg: %0s Region: %s" arg (buffer-substring start end)))
(global-set-key (kbd "C-c n") #'my/dummy-fn)

Eval the above, including the global-set-key; it will be easier to try out the snippet. You can later eval (global-set-key (kbd "C-c n") nil) to free up the C-c n binding.

When you select a region and hit C-c n, (deactivate-mark) will be used and it will print

  Arg: nil Region:«YOUR-SELECTED-REGION»

When you select a region and hit C-u C-c n, (setq deactivate-mark t) will be used and it will print

  Arg: (4) Region:«YOUR-SELECTED-REGION»

I did not notice any difference between the two executions (and most likely this dummy function was not ideal to tell the difference).

So my question is:

When would one use the function and not the setq, and vice-versa?

A rough survey in emacs elisp source code tells that both are used, but the use of (deactivate-mark) as a function is more prominent.

Below, the number following the file name and colon tells the number of times the searched pattern occurred in that file.

Use as a function

km²~/downloads/:git/emacs> ag '\(deactivate-mark[\st]*\)' -G '\.el' -c
emacs-lisp/ert-x.el:1
emulation/cua-base.el:1
emulation/edt.el:1
emulation/viper-util.el:1
erc/erc-goodies.el:2
emacs-lisp/tcover-ses.el:1
gnus/nnnil.el:1
isearch.el:1
info.el:2
international/mule.el:2
leim/quail/hangul.el:1
mail/rmail.el:1
mwheel.el:1
replace.el:2
mouse.el:5
obsolete/mouse-sel.el:1
obsolete/tpu-edt.el:1
org/org-w3m.el:1
ses.el:1
ps-print.el:1
org/org.el:4
progmodes/f90.el:2
skeleton.el:1
tempo.el:1
term/ns-win.el:2
startup.el:1
term.el:1
textmodes/picture.el:2
simple.el:10
textmodes/reftex-index.el:1
textmodes/bibtex.el:1
type-break.el:1
vc/ediff-util.el:1
winner.el:1

Setting the var

km²~/downloads/:git/emacs> ag '\(setq deactivate-mark t\)' -G '\.el' -c
delsel.el:1
emulation/cua-rect.el:1
emulation/cua-base.el:1
indent.el:1
ses.el:2
rect.el:2
register.el:4
simple.el:2


texts:
When I press M-<up> in org-mode to move my headers I get this message in the minibuffer:

There is no other window

Why does my keybinding not work?


texts: packages that improve the magit history graph when running in graphical modes

texts:
Are there any modes that improve how the history graph is drawn?
it would be nice to find something that:

coloured the lines to visually distinguish them
used unicode or other graphical fancyness to connect the lines more cleanly
other fancy looking things i haven't thought of!


texts: Make flycheck mode respect flake8 config and warn for long lines

texts:
I use flycheck-mode as my syntax checker/linter for Python. It works great for the most part, however I can't get it to warn me when I have gone over a specified line length.

I am using flake8 as my checker for Python, and have confirmed this with flycheck-verify-setup. The output from this command in a python-mode buffer is:

Syntax checkers for buffer config.py in python-mode:

python-flake8
- predicate:  t
- executable: Found at /usr/bin/flake8

python-pylint
- predicate:  nil
- executable: Not found

python-pycompile
- predicate:  t
- executable: Found at /usr/bin/python

The following checker is explicitly selected for this buffer:

python-flake8
- major mode: `python-mode' supported
- predicate:  t
- executable: Found at /usr/bin/flake8

Flycheck Mode is enabled.  Use C-u C-c ! x to enable disabled
checkers.

The checking works in general, so if I have the following Python code:

import re
long_string = "foooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo"
class Foo():
    pass

I get two warnings from flycheck:

're' imported but unused [F401]
expected 2 blank lines, found 0 [E302]

I do not, however, get a warning that long_string is too long. I have tried setting:

(setq-default flycheck-flake8-maximum-line-length 79)

in my init file as suggested here. I have tried configuring flake8 with a flake8 file in my ~/.config/ directory, as described here, which I assume flycheck is supposed to respect, based on this answer. I have also tried setting the value of flycheck-flake8rc to point to that flake8 file. I have tried using a local configuration file within a project as described here. None of these have worked for me. Instead, flycheck seems to ignore any flake8 config I try to give it, and will not warn about line length. This is the case even when I use emacs -Q, initialize packages, and enable global-flycheck-mode - although, in this case the output of flycheck-verify-setup is the same. Any suggestions how I might be able to:

Get flycheck-mode to respect my flake8 configuration file?
Get flycheck-mode to warn me about going over a specified line length?

Question 2 would be solved, in theory, by any solution to question 1, because I could set, e.g.:

[flake8]
max-line-length = 79

in my configuration file, but I would be satisfied with a solution to question 2 alone. Thank you!


texts: Regexp to font-lock numbers but not strings?

texts:
I would like to have my dollar sign yellow coloured.

So after searching around, I learnt that the Emacs regex's are different from default regexs. After a while, I got this worked:

(defface font-lock-sigil-face
  '((t (:foreground "#BD9800")))
  "Face to display sigils in.")
(font-lock-add-keywords 'php-mode
  '(("\\(\\$\\)[_a-zA-Z]" 1 'font-lock-sigil-face)))

So the dollar sign for $variable, gets a yellow color.

But I would like to make the numbers red.

So for example

var $variable = 0123; (this gets red).

But not the strings would be red.

var $variable = "0123"; (So the regex will not makes this red).

I tried many ways, but I don't understand the backslashes in '(("\(\$\)[_a-zA-Z] clearly enough.
I would really appreciate it if anyone could explain this?

Thanks in advance.


texts:
I'm looking for a simple version control system.  I'm the only programmer in my team and I would be the only one who is making changes to files.
It gets complicated when the inputs change and I have to branch from the main source code into two (most times) versions - this will provide two different functionality.
I have searched a lot and found the following:

Emacs has VC which can do version control and it supports - RCS,CVS,SVN Git etc. I read the VC portion of the manual - but could not help me create a simple directory with files in it.
When I created the VC backend as RCS - it is looking for a file "RCS" the same is true with SVN too

Magit is a package for Emacs which can do version control management.
I started running into problems during installation, it was looking for a git directory - which for some reason was not there and I ended up with errors during Magit installation.

(Note: I had installed Magit through MELPA and I had installed all the requires packages for the Magit before the actual Magit installation)
I adjust need an example on how to set this up


texts: Is it possible to have word-wrap as standard but truncate some lines in a buffer at the same time?

texts:
I'm working with large LaTeX tables in AucTEX and it would be helpful to display them in truncated lines, like here:

The red marks are the "&" characters which separate the columns of the table. In case of tables with many columns the latex source code for one table row is longer than the emacs frame width and therefore will be by default wrapped into more than one line.
Even with align-current, this will make the table source code very hard to read and edit, so

for tables I'd prefer the source code lines to be truncated (forcing me to scroll horizontally)
while for all other latex source, I'd prefer word wrap to make it fit to the frame width

However for the real text in my LaTeX document I'd prefer to have the normal word-wrap settings.

Question:

Is it possible to use word-wrap as standard in Emacs and still have some latex environments in the same buffer like table, longtable and sidewaystable shown truncated at the same time?

Also for some other environments like equation, pycode or tikzpicture truncation seems to be more appropriate. So it might be a good idea to be able to define a list of environments which don't get wraped but truncated.

The wrapping should be soft wrapping (That is, the text is wrapped to fill-column in the buffer, but that does not reflect in the file) and wrapping an indented line should follow the line’s indentation.

The solutions should also work for emacs but also for Aquamacs 2.5.

There is a blog post which suggests to have a (partial) solution, but I didn't find the implementation: http://endlessparentheses.com/longlines-mode-in-latex.html


texts: Is there something I should do about "package assoc is obsolete" message?

texts:
Just noticed this message after emacs startup "Package assoc is obsolete!", but everything seems to work nice. The requirement seems to be called by yasnippet only.

I just want to know if I should do something to fix this warning.


texts: How can I modify the prompt of another command?

texts:
How can I modify the prompt of another interactive command without copy-pasting too much?
Can I override only the interactive form?


texts: Why is check-ert output cut at 70 characters column?

texts:
Sometimes when packaging emacs packages for Debian, I need to debug test failures. Then the debugging output is cut at 70 characters like in this bug report:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=916807#21

excerpt:

Test haskell-cabal-compute-checksum-1 backtrace:
  file-name-directory(nil)
  (let ((scriptDir (file-name-directory (or (symbol-file 'haskell-caba
  (closure (t) nil (let ((scriptDir (file-name-directory (or (symbol-f
  ert--run-test-internal(#s(ert--test-execution-info :test #s(ert-test
  ert-run-test(#s(ert-test :name haskell-cabal-compute-checksum-1 :doc
  ert-run-or-rerun-test(#s(ert--stats :selector t :tests [#s(ert-test
  ert-run-tests(t #f(compiled-function (event-type &rest event-args) #
  ert-run-tests-batch(nil)
  ert-run-tests-batch-and-exit()
  command-line-1(("--eval" "(add-to-list 'load-path (expand-file-name
  command-line()
  normal-top-level()

Why is that and how can I get the full output?


texts: How to save modified buffers when changing desktop?

texts:
I am using desktop-save-mode and desktop-change-dir to handle multiple desktops. This works fine, except for the case when I have modified some buffers, and then run desktop-change-dir before having saved the changes.

I thought that desktop-change-dir would save any buffers before switching desktops, instead I get a question Buffer <name> modified; kill anyway ? (yes/no). (Note that this question is somewhat different from the question you get when killing emacs, in that it does not ask if you would like to save the buffer or not.)

If I type yes to the question, the modification to the buffer is lost, if I type no the buffer is carried on to the next desktop.
(Neither of these options is desired, so I have to press C-g to abort and save the file manually)

Instead I would like to have the modified buffers saved automatically. Is this possible?

Here is a minimal example:

$ emacs -Q -l init.el &

where init.el is:

(defvar my-desktop-dir1
  (file-name-as-directory (expand-file-name "desktop1")))

(defvar my-desktop-dir2
  (file-name-as-directory (expand-file-name "desktop2")))

(defun my-switch-desktop ()
  (interactive)
  ;; this line is commented out since `desktop-save' should be
  ;; called by `desktop-change-dir'
  ;;(desktop-save my-desktop-dir1 t t)
  (desktop-change-dir my-desktop-dir2))

(require 'desktop)
(setq desktop-path (list my-desktop-dir1))
(setq desktop-save t)
(desktop-save-mode 1)
(desktop-read)


texts: Why is calc-precision function definition void?

texts:
For a school assignment, we were to find some way to overcome Elisp's limited floating point precision. I found this, which I thought was pretty useful, but it gives no description of how to actually use it.  I then found this, which says that in order to use calc's arbitrary precision math I need to first set the precision using this:

(calc-eval '(calc-precision 20) 'eval)

Unfortunately, Emacs then tells me that calc-precision's function definition is void. Can anyone help me fix this problem?


texts: It is possible to display numbers at the beginning of headerlines instead of asterisks when editing/viewing org-mode?

texts:
For example, a simple org-mode file like this:

* Header one
** Sub-header one
** Sub-header two
* Header two
** Sub-header one

After exporting this org-mode file into html file, the html in browser will be like:

1. Header one
1.1 Sub-header one
1.2 Sub-header two
2. Header two
2.1 Sub-header one

But I do rarely convert org files into html files, I do a lot of note-takings from a webpage or book, so it is very friendly if the org-mode buffer can show the numbers like the html file in browser directly instead of just asterisks. Of course, when inserting header/subheader or deleting header/subheader, org-mode should change the numbers according the context just like the list in org-mode.

Is it possible to do that?


texts: How can I tell counsel's `counsel-git` to ignore certain file endings and folders

texts:
I am using counsel-git to find and open files.
Is there any way to ignore folders and files that are ending with specific pattern.
For example: ignore folders named: .idea ; and files ended with *.save and *.xml or specific as -i or .gitignore. All the folders starting with . always show up on top; I just want to ignore some of them which I do not use.

config file:
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq enable-recursive-minibuffers t)

(global-set-key (kbd "C-c g") 'counsel-git)


texts: What could cause a draft of the current email to be saved in mu4e?

texts:
I have a strange issue I can not quite nail down to a cause. Only sometimes when I am writing an email or responding to one, a draft of it gets saved. I thought this maybe due to the fact that my Emacs temporary file backup directory was not set properly hence the backups were being stored somewhere in my mail directory; getting synced. This issue is mentioned here.
I checked by creating a new file and confirming that while it has unsaved changes, its backups are indeed stored in the directory I set up. Then to narrow down why the drafts of my emails were getting saved I typed up a new email and tried to do the same by opening the compose buffer by replying to one, typing changes and leaving but this time no drafts were saved.
Drafts do every now and then get saved and I can't seem to figure out when that happens and how can I keep that from happening or delete them once that particular email is sent (which currently does not happen).
Also, say when I am typing an email and I save it manually which saves a draft, and then finish the email and send it, that draft also does not get deleted.

I want to figure out when and why the automatic drafts are saved, and possibly not save them.
Once an email is sent, I want the draft saved for it to be deleted and that email to only exist in the sent folder.

My mu4e-sent-messages-behavior is set to delete.


texts:
I installed helm and projectile and added the following to my .emacs:

(require 'helm)
(projectile-global-mode)
(setq projectile-completion-system 'helm)
(helm-projectile-on)

But I get this error when I startup emacs

Symbol's function definition is void: helm-projectile-on

Any ideas?


texts: Mysterious command to send code to Mozilla?

texts:
I accidentally smashed my hand on the bottom right of my keyboard and got the following prompt in the echo area: (I was in the analyzeDiscussion() function in js-mode when this happened)

 Send analyzeDiscussion to Mozilla? (y or n)

What command could have caused this? I tried C-h l to get the last keys pressed, but I had already pressed too many keys and it had gone off the top of the buffer.


texts:
In org-mode:

#+BEGIN_SRC calc :var x=5 :var y=2
2+a*x**y
#+END_SRC

returns

No org-babel-execute function for calc!

How do I enable calc for org-babel-execute?


texts: Show effort and clock time in agenda view

texts:
I use Org mode for my to-do list, clocking, and setting effort estimates. I can show the effort estimates for tasks scheduled for today with the columns view and this setting (thanks to this thread):

(setq org-columns-default-format "%60ITEM(Task) %TODO %6Effort(Estim){:}  %6CLOCKSUM(Clock) %TAGS")

Then I call the day's agenda with C-c a a and column view with C-c C-x C-c. I see a list of tasks with a scheduled or deadline date of today, as well as a sum of the effort estimate:

Task                                            | TODO | Estim | Clock | TAGS |
-------------------------------------------------------------------------------
Tuesday    22 October 2019                      |      | 20:25 |       |      |
  gtd:         7:00...... Scheduled:  Some task | TODO |       | 1:00  |      |
               8:00...... ----------------
...

How can I skip the second step and show the effort estimate and its sum in the agenda view?


texts: Replacing directory-files-recursively with a list of files newer than 7 days old

texts:
I currently use the following to get a list of agenda files for org-mode:
(setq org-agenda-files (directory-files-recursively "~/Org" "\\.org$"))
I'd like to instead get a list of files that are newer than 7 days old so that Emacs doesn't spend a long time reading and parsing all the org files I have.
I know I have to write a defun that takes in a directory and file regex as its 2 parameters, but I'm at a loss with how to then find files newer than 7 days.


texts: Removing seconds from :human-date in mu4e

texts: In mu4e, :human-date shows seconds which I would like to avoid? How can I only show hour and minute in the HH:MM format?


texts: Is there a way to reopen the last helm buffer including minibuffer content and cursor position ? This would be especially convenient, when using helm-find-files to navigate remote filesystems.


texts: getting the "right" indentation via my c++-mode-hook

texts:
Using GNU Emacs 24.5.1

My c++-mode hook has (c-set-style "cc-mode").  This works fairly well for me, with the following exceptions:

First of all: try-blocks are indented

int main()
   try
      {
        //...
      }
   catch (...)
      {
        // ...
      }

I would prefer

int main()
try
{
        //...
}
catch (...)
{
        // ...
}

In addition, when using enum class, I get

enum class Month {
  jan=1, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec
    };

It would be more natural for the closing brace to be flush left:

enum class Month {
  jan=1, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec
};

I have also tried all the other built-in styles.  The two that work best are cc-mode and stroustrup, but neither give me the behavior I would like.

Suggestions? Many thanks!


texts: How can I see total time today on _all projects_ in the modeline?

texts: The variable org-clock-modeline-total gives me several options for what time to show in the modeline, but they limited to time clocked into the current task. I would like to show the total time clock into all tasks in a particular subtree. Is that possible?


texts: Narrow the width of some characters without changing the font

texts: Is it possible to narrow the look of only particular characters such as a, b, and c (Unicode code points #x61 through #x63) to 1/3 or something in width, without changing the font? If so, how? I know that you can change font for some particular Unicode code point ranges, and there's a type of font called condensed font, but I'd like to keep the font as is. The reason I don't like to change font is that I'm thinking of applying this to some fonts that there's not really an exact narrow-width equivalent for, like the color emoji font by Apple.


texts:
When I try to paste a text from a web page inside Emacs I get this "-" between words. Here is one example:

Is there a way to get rid of this (don't know the term..) ?

Aus Sicht vieler Deutscher ist Russland ein rätselhaftes Land. Ich habe elf Jahre lang von dort für den SPIEGEL berichtet, bis Ende 2009. Bis heute verfolge ich die Entwicklung in dem Land, das ich jedes Jahr besuche.


texts: Keycode for `Shift + Return` on OS X iterm2

texts:
I'm currently trying to learn org-mode in OS X. And I found there's a keymap M-S-RET. But S-RET is not recognized in the iTerm2.

It seems like terminal interpret S-RET and RET as same.
iTerm2 can bind a S-RET in the GUI preference tab. (PREFERENCE->PROFILE->KEY)
I can bind S-RET and send hex value instead of 13. (13 is keycode for RET)

But I can't find what's the keycode for the S-RET. Actually, I think Shift + Enter does not exist as keycode. However, there must be some key combination that Emacs uses.
How can I figure it out? Are there any files containing that information?
Thank you for reading.


texts: `find-file-hook` problem for large buffer that is just one long line

texts:
I got a file(for instance, ~/.mozilla/firefox/xxx.default/sessionstore-backups/recovery.bak) that its content is one whole line and size of over 1MB, if I open it in Emacs, Emacs will become very laggy, so I put some configuration in Emacs: if a buffer you are going to open is over 1MB, use fundamental-mode and disables some other minor modes such as font-lock-mode and linum-mode and other configs for high performance, but this configuration is only working for buffers that size is over 1MB AND contents is not very long lines(for example, /var/log/messages), IF the content of the file is long lines, the configuration is totally not working.

My configuration:

(defun check-large-file-hook ()
  "If a file is over a given size, turn off minor modes"
  (when (> (buffer-size) (* 1024 1024)) ;; 1 MB
    (fundamental-mode)
    (font-lock-mode -1)
    (linum-mode -1)
    (setq buffer-read-only t)
    (buffer-disable-undo)
    ))
(add-hook 'find-file-hooks 'check-large-file-hook)

Is there any solution for this kind of problem?

NOTE:

Viewing long lines buffer is laggy is not my problem, so the VLF package would not be the solution to my post, my problem is configuration for lone lines buffer is not working.


texts: Disk interaction occasionally extremely slow

texts:
I'm using GNU Emacs 24.5.1 (i686-pc-mingw32) of 2015-04-11 on LEG570 on Windows 7. Somedays (yes, weirdly, it seems to be only some days), Emacs takes a very long time (a few seconds) when reading or writing to disk. This happens most notably when using ido-find-file or save-buffer. It happens in fundamental mode, and when i run emacs -q, so I don't think it is related to my setup.

It doesn't seem to happen in other text-editors, but it might just be that other text-editors does save asynchronously, while emacs is famously single-threaded, and so would block everytime. I suspect that the issue might come from some of the spyware that my employer installs on our computers, but I'm at a loss on how to debug. What could the source of this error be?

I've tried the profiler to find the source of the slowness. Here is the output for one slow save:

- ...                                                               5  83%
   Automatic GC                                                     5  83%
- command-execute                                                   1  16%
 - call-interactively                                               1  16%
  - profiled-save-buffer                                            1  16%
   - let                                                            1  16%
    - save-buffer                                                   1  16%
     - basic-save-buffer                                            1  16%
      - basic-save-buffer-1                                         1  16%
         basic-save-buffer-2                                        1  16%

Of course, this is very weird. The actual save took 13.863000 seconds, the sampling interval is 1000000. If I understand the profiler correctly I should have more than 1000 samples, but here I only got one. Here is the code I use for profiling:

(defun profiled-save-buffer ()
    ""
  (interactive)
  (profiler-start 'cpu)
  (measure-time
   (save-buffer)
  (profiler-report)
  (profiler-stop))
  (select-window (previous-window)))


texts: Is it possible to use increments of two and use padding zeros on mc/insert-numbers?

texts:
I'm using mc/insert-numbers quite often for numbering classes on html. I know that I can use C-u 6 M-x mc/insert-numbers to start counting from 6, but how could I use it to create a list like:

06
08
10
12
14
16
18

is it possible?


texts: How to get property values from org file headers

texts:
Is it possible to get property values from org file headers? For example, I have a file named something.org with following content:

#+TITLE: Awesome File
#+AUTHOR: My Name
#+XYZ: xyz

/content/

How could one get title or XYZ? I want to get those values for some buffer-local variables.


texts: Prefer vertical splits over horizontal ones

texts:
There are several questions similar to this one. I have read them all and they don't provide an answer for my scenario. I want emacs to prefer vertical splits (splitting windows into left and right parts) over horizontal ones, even if both horizontal and vertical splitting is possible. This is what the manual says:

  The split can be either vertical or horizontal, depending on the variables split-height-threshold and split-width-threshold. These variables should have integer values. If split-height-threshold is smaller than the chosen window's height, the split puts the new window below. Otherwise, if split-width-threshold is smaller than the window's width, the split puts the new window on the right.

So if both split-height-threshold and split-width-threshold are smaller than the window's width and height, emacs will perform a horizontal split. I want the opposite. If both thresholds are smaller, perform a vertical split.

One way to achieve that is to set split-height-threshold to nil, but I don't like that because it disables horizontal splitting completely.

I have looked at the split-window-sensibly function, but I'm not good enough at elisp to write my own my-split-window-sensibly function that works like I want.


texts: How to reveal tabs in the indentation in a cpp file?

texts:
My friend and I collaborate on a C++ project and we agree to use 4 whiltespaces for indentation. I am using Emacs and this is my indentation setting

(setq-default c-basic-offset 4)

By doing this, I believe that I can use tab safely without pressing the space bar for 4 or 8 or 12 times. However, my friends (Eclipse user) and I see awkwardly indented (misaligned) code in our own code editor. Then we accuse each other for using tabs instead of 4 whitespaces.

How can I find the ground truth in our cpp file? We want to know who introduces \t to our code.

We use svn for source control and do not have a nice UI for code review. So I prefer to check this \t character locally.


texts:
this is a bit complicated, please bear with me

I want to use org-babel to query postgresql, and I can do it for DBs that I can access directly from my localhost:

#+begin_src sql :engine postgresql :cmdline "-h localhost -U postgres -p 5434 -d my_db"

I can even probably do that if DB is on a remote ssh machine, by setting ssh tunnel first.

The problem is: in my company (for security reasons) it's made that you have to:

first ssh to a machine (let's call it first-lvl-host)
and only then access the DB, which is still on a remote host (let's call it db-lvl-host)

Another problem is, that first-lvl-host does not even have psql (command line utility). In order to access it - you have to ssh hop to another machine (let's call it second-lvl-host)

Basically I'm expected to do:

ssh first-lvl-host ssh second-lvl-host

# and then:
PGPASSWORD=mypass psql -h db-lvl-host -U ag

So, my question is, can I anyhow still do it directly from my org file?

I know I can reduce ssh hops by adding:

Host second-lvl-host
  ProxyJump first-lvl-host

to my ssh/config, but that still doesn't allow me to access db-machine directly, using local psql, and if I can't poke on it with psql, I don't think I can do it with org-babel, or can I?

I tried setting a tunnel like this:

ssh -L 9999:localhost:9999 first-lvl-host ssh -L 9999:localhost:1234 -N db-lvl-host

but that didn't work. I can't ssh to db-lvl-host, even if I do ssh first-lvl-host ssh second-lvl-host ssh db-lvl-host. It doesn't work like that. I can't connect to db-lv-host via ssh, it reports: "Connection timed out", if I can't ssh to it - means I can't establish a tunnel, right?


texts: Zooming / font sizes / text scaling has a very limited range?

texts:
I would like to increase my font size, so I used the C-x C-= keybinding, followed by = to further increase the size. However, it stops zooming far too soon, and I realized that I can only cycle through 8 levels of zoom. I can zoom in twice past default and zoom out 5 times past default. Is there a way to increase the zoom range?

Additionally, when I continue trying to zoom (by pressing =) after reaching the max zoom level, I am unable to zoom out (by pressing -) until I press - the same number of times that I pressed =. For example, if at my max zoom level, I push = three times, I must push - three times with no results before I can push - again to zoom out. It seems as if the zoom levels are being recorded, but not rendered.

Here is the command that I am using via C-h k C-x C-=

C-x C-= runs the command text-scale-adjust, which is an interactive
autoloaded compiled Lisp function in `face-remap.el'.

It is bound to C-x C-0, C-x C-=, C-x C--, C-x C-+.

(text-scale-adjust INC)

Adjust the height of the default face by INC.

INC may be passed as a numeric prefix argument.

The actual adjustment made depends on the final component of the
key-binding used to invoke the command, with all modifiers removed:

   +, =   Increase the default face height by one step
   -      Decrease the default face height by one step
   0      Reset the default face height to the global default
...


texts: org-mode table-formula and code-blocks: function parameter is cut off on whitespace

texts:
In Org-mode working with 'src' code blocks and table formulas together, org-mode cuts of the cell strings at the first whitespace character.

I.e.: having a cell with Hello World the 'src' code block only receives Hello.

Following example:

This shows the weird result.

#+NAME: bugornot-src
#+BEGIN_SRC emacs-lisp :var x='()
(mapconcat 'prin1-to-string x "")
#+END_SRC

#+TBLNAME: bugornot-tbl
| Test | Hello World | Foo | TestHelloFoo |
|      |             |     | TestHelloFoo |
#+TBLFM: @1$4='(org-sbe bugornot-src (x @1$1..@1$3))
#+TBLFM: @2$4='(org-sbe bugornot-src (x @1$1 @1$2 @1$3))

But the resulting table I expected after evaluating the formulas should look like this:

| Test | Hello World | Foo | TestHello WorldFoo |
|      |             |     | TestHello WorldFoo |

Is there a way to get the full string from cell @1$2 to cells @1$4 and @2$4 (with this whitespace character inside)?


texts: Why adding the display property does not work on some part of a file, while it works on other parts?

texts:
Let's say I have an org file with this content (this is the Org Manual):

    *** System-wide header arguments
    #+vindex: org-babel-default-header-args

The file is opened normally, highlighted and everything.

Now, as a test I try to add a display property to the S character of System:

    (put-text-property (point) (1+ (point)) 'display "aaa")

It works. The S is replaced with aaa.

But if I try the same on a character on the vindex line then nothing happens.

Why is that?


texts: Upper/lower regexp char classes and current-case-table

texts:
I seem to have a problem with [:upper:] [:lower:] and Unicode characters.

This test fails:

(ert-deftest haskell-upper ()
  (set-buffer (get-buffer-create "*haskell-mode-buffer*"))
  (insert "Ż")
  (goto-char (point-min))
  (should (looking-at "[[:upper:]]")))

This one (surprisingly) succeeds:

(ert-deftest haskell-upper ()
  (set-buffer (get-buffer-create "*haskell-mode-buffer*"))
  (insert "Ż")
  (goto-char (point-min))
  (should (looking-at "[[:lower:]]")))

Note that

(message "%c" (char-table-range (current-case-table) ?Ż))

correctly returns

ż

So case table seems to be setup correctly but regexp machinery does not pick this up. Note that this is a problem only when running in batch mode, in interactive mode it works as expected.

Is there some initialization code that needs to be called before using looking-at, char classes and Unicode?

My version of Emacs:
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

It also fails in the same way on Emacs 23.3.1 and Emacs 25.0.50.1.


texts: add note to CLOCK entry after clocking out

texts:
After clocking out, I would like Emacs to prompt me for a note, as when I switch the state of an entry to a state that requires an annotation.

Use case: During the day I work in several things related to one main task, which I set an entry for it in my org-mode document and clock on, and I cannot specify what is going to be work on beforehand, otherwise I would create a sub-entry and log the time there.


texts: Is there a way to comment within a line in elisp?

texts:
Is it possible to comment the string "emacs" below  while  keeping this code one line? If so, how?

 (message "hi") "emacs" (message "hi!")


texts:
This is a question a friend of mine had; figured posting here might give quick responses.

  Old version in new language, après Name

  How do I define the mapping ^ |--> ^ while ^^ |--> ^{}. Similarly, for _.

  Old Version

  Is there a way to modify the electric braces for superscript and subscript to behave as follows:

  Insert no empty pair of braces when a carat ^ or underscore _ is entered.
  Insert a empty pair of braces when a carat ^ (resp. underscore _) is entered following a ^ carat (resp. _ underscore) sign.

Any answer would be helpful.

/p/s/ The motivation is to minimise having to jump out of braces when the subscript or superscript is just really a character long.


texts: How to set up Emacs with Clozure CL but without SLIME

texts:
I want to manually set up my own Emacs CL environment on Mac OS X 7 without the SLIME package i.e. it will only use Clozure CL.

To put it other way, I want to use the Emacs CL just like I use the "Inferior Emacs Lisp Mode" (M-x ielm) but instead of the plain old Emacs Lisp, it'll use the Clozure CL.

So I've downloaded Emacs-24.4 installed it under the /Applications and Clozure CL 1.6 under the /Users/macmini/ccl-1.6 and edited the ~/.emacs to have:

(setq inferior-lisp-program "/Users/macmini/ccl-1.6/dx86cl64")

I then restarted Emacs to start to use the Clozure CL but I couldn't use it. Can someone show how to use Clozure CL? Thanks.


texts: Error with org-fstree: Symbol's function definition is void: reduce

texts:
I want to use the package org-fstree (MELPA Link).

But in a file when I press C-c C-c at

#+BEGIN_FSTREE: ~/

I get the following error:

Symbol's function definition is void: reduce

I am not sure if I installed the package correctly (this is the first time I am using MELPA). So here is all the information that I feel may be relevant:

I added the MELPA repository by adding the following to my ~/.emacs:

(when (>= emacs-major-version 24)
  (require 'package)
  (add-to-list
   'package-archives
   ;; '("melpa" . "http://stable.melpa.org/packages/") ; many packages won't show if using stable
   '("melpa" . "http://melpa.milkbox.net/packages/")
   t))

Then I restarted Emacs. I pressed M-x list-packages and pressed i at org-fstree to mark it for installation and pressed x to complete the installation.

I got the following warnings:

In org-fstree-extract-path-from-headline:
org-fstree.el:271:21:Warning: reference to free variable
    `org-fstree-heading-regexp'

In end of data:
org-fstree.el:311:1:Warning: the following functions are not known to be defined: reduce,
    org-columns-quit

Then I added the following lines to my ~/.emacs:

;; org-fstree
(add-to-list 'load-path "~/.emacs.d/elpa/org-fstree-20090723.819/")
(require 'org-fstree)

I got the above mentioned error after these steps.

Please advice me on what to do?


texts: How to toggle fullscreen in Emacs GUI mode (`Full Screen` option is greyed out in Kubuntu)?

texts:
This is such a basic question but I am really at a loss (a google search only revealed solutions for OS X).
Until recently, I primarily used terminal mode (which I can make full-screen using my desktop environment's full-screen shortcut for the shell window) but switched to GUI because I'd like to be able to pick a font.
Any suggestions?  Maximizing using the buttons in the window title bar doesn't go to true full screen - I can still see the task bar and the window title bar.
Edit: I should add that the Full-screen option (i.e., after right-clicking the window title bar) is greyed out (see exhibit 1 below).  Also, changing the Full Screen setting under Special Applications Settings automatically reverts to being disabled.
The No border option does offer a partial solution in that it makes the window title bar disappear (though task bar is still visible) - it would be nice if there was a way to easily toggle full-screen using a keyboard shortcut and given KDE's and emacs' customizability, I think it's probaby due to my being a KDE and emacs n00b.

Exhibit 1:

Update:
In order to safeguard against any settings I may have inadvertently customized, I ended up resetting my kde desktop (by deleting the relevant plasma file).  Upon reboot, I was able to use the Special Window Settings dialog box to Force the application into full-screen mode (the dialog box is accessed by invoking the menu via Alt+F3 -> More actions -> Special window settings).  (Screenshot below.)
In a general sense, I still prefer paprika's answer which involves creating a global keyboard shortcut as it's the better solution.   Just wanted to include my roundabout fix in case other folks also find that their emacs is refusing to accept the full screen global keyboard shortcut.
Forcing full-screen mode from the Special Window Settings dialog box:


texts: Is there a mode for viewing keystroke lossage in realtime?

texts:
C-h l shows the lossage help buffer, which shows recent keystrokes. Pressing g appears to revert it, causing it to update. Unfortunately, enabling auto-revert-mode does not change it to update continuously.

It would be nice if I could open up another window or frame and just display lossage in real time to show viewers what I am typing. This could also be used for pairing in a tmux/tmate session. Some of the videos online have something like this, but they appear to be external applications and OS specific.

Is there a nice way to show keystrokes in real time as they occur from within Emacs?


texts: org-export to ignore strings within drawers

texts:
I have the following set up for an annotated bibliography document.
** Kim, M. (2008): An inquiry into the development of the ethical theory of emotions in the "Analects" and the "Mencius"
:PROPERTIES:
:UNNUMBERED: t
:END:
:CITED:
[[Nivison, D. S. (1996). The ways of confucianism: investigations in Chinese philosophy. Chicago: Open Court.]]
:END:

The CITED drawer is used to keep track of important works that are cited or referenced within the book or article.
Exporting via LaTeX to pdf unexpectedly prints out items within the CITED drawer.

How do I suppress this unwanted behavior?


texts:
* Heading
** Sub-heading
*** Sub-sub-heading
- plain text
- more plain text
- even more plain text

I want to select - more plain text and archive it with C-c, C-x, C-a.

I only want - more plain text to be archived. I want the headings and the rest of the plain text to stay in place.

When I try this, it archives everything.


texts: Can counsel functions use ido-flex style matching?

texts:
I've gotten so used to (setq ido-enable-flex-matching t) that I really notice its absence in various counsel-FOO functions.

Is there a way to turn on flex matching for counsel?  I haven’t been able to find a suitable user option in the code or the manual.


texts: How do I debug a flask application from within emacs?

texts: I want to use something like pdbpp or ipdb to debug a flask application. I've tried but not understood how to set a breakpoint in a python file that's part of a wider application and see it hit. There appear to be dozens of examples of how to run a single file in a debugger in emacs, but that's not what I want to do.


texts: How to replace strings including `.` (dot) as first character using dired-do-find-regexp-and-replace

texts:
(defun my-find-orgfiles ()
  (interactive)
  (find-name-dired "." "*py"))

(global-set-key (kbd "M-n") 'my-find-orgfiles)

Than, t to toggle marked/unmarked files (thus marking them all, since none were marked). Then I use Q to use query-replace on the marked files. And enter .value to replace with value.

=> What am I trying to do?
Replace a string that is starting or ending with . (dot) such as: .value or value..

=> What happens instead?
During replacement Emacs also finds text such as (value, [space]value, [value and so on. In other words, .value is matching any character followed by value.

=> How can I force dired-do-find-regexp-and-replace (bound to Q in Dired buffers) to look for a literal . during string replacement?


texts:
Unfortunately, I am not very proficient in writing my own lisp functions.  I want to create a capture template that prompts for a sub-heading of a particular heading as the capture location. E.g. for

* heading 1
** subheading 1.1
** subheading 1.2
* heading 2
** subheading 2.1
** subheading 2.2

I want the template

(setq org-capture-templates
 '(("t" "todo" entry (file+function "~/org/org.org" function-i-need)
            "**** TODO %^{Brief Description} %^g\n%?\n")
   )

)

To offer targets under subheading 2 only.

Would be great if someone could help me out with that.


texts:
I'm running python tests with the python test runner and elpy, per here https://elpy.readthedocs.io/en/latest/ide.html#testing
Using the C-c C-t binding.  When my tests complete, they say:
======================================================================================== 13 passed, 1 skipped, 1 xfailed, 2 xpassed in 24.20s ========================================================================================

Compilation finished at Mon Jun 22 16:06:26

I'd like to be able to rerun this giving the -v verbosity prefix arguments to py.test.  Is there a way to do that from here within the compilation buffer?


texts: Font-locking for text inside org-mode COMMENT blocks

texts: While other sorts of #+BEGIN ... #+END blocks seem to get font-locking applied to them (potentially changing foreground and background colours etc.), #+BEGIN_COMMENT ... #+END_COMMENT blocks do not.  Is there any way to have font-locking apply to these?


texts:
I am new to emacs. I have a visual impairment which necessitates the use of very large font: (set-face-attribute 'default nil :height 700). When I open calendar, the third month flows to the next set of lines and meshes with the first month, making it useless.

Is it possible to display only two months (current and next), or even just show a single month?


texts: replace-regexp-in-string stops replacement with "^."?

texts:
I've encountered a wierd situation when trying to match the first character of a string using a regex with alternatives.  It seems that replacement stops when matching a single character using a period at the start of the string, but not for slightly different patterns.

Desired behavior:

"foo bar" -> "Foo Bar"

(replace-regexp-in-string
   "^.\\| ."
   #'upcase
   "foo bar")
> "Foo bar"

Notice that replacement stops and doesn't capitalize the 'b' in 'bar'.  However:

(replace-regexp-in-string
   "^f\\| ."
   #'upcase
   "foo bar")
> "Foo Bar"

(replace-regexp-in-string
   "^.o\\| ."
   #'upcase
   "foo bar")
> "FOo Bar"

(replace-regexp-in-string
   "^..\\| ."
   #'upcase
   "foo bar")
> "FOo Bar"

I have tried parenthesizing all combinations of the alternatives to no effect.

I'm not concerned about beginning of string vs beginning of line ('\`' vs '^'), but FWIW this odd behavior is consistent with both patterns.

I'm observing this behavior with both emacs 24.5.1 and 25.0.95.1.


texts: Toggling maximize-window in a buffer running ansi-term

texts:
I have been using the following function to maximize and unmaximize a window for two years now.

(defun toggle-maximize-buffer () "Toggle maximize buffer"
  (interactive)
  (if (= 1 (length (window-list)))
    (set-window-configuration my-saved-window-configuration)
    (progn
      (setq my-saved-window-configuration (current-window-configuration))
      (delete-other-windows))))

I have it bound to:

(define-key my-keys-minor-mode-map (kbd "C-M-u") 'toggle-maximize-buffer)

It always worked great, but today, after upgrading to the latest version of Emacs in OS X:

brew install emacs --HEAD --use-git-head --cocoa --with-gnutls --with-rsvg --with-imagemagick

this function stopped working properly when invoking it from a buffer running M-x ansi-term.  More specifically, it works, but it moves cursor in my buffer whenever I do C-M-u RET. It happens regardless weather I am in character or line-mode in the ansi-term buffer.

The problem does not happen in any other type of buffer. Why am I having this problem, and what I can do about it?

In case it matters, here is the specific version I am using

GNU Emacs 25.0.50.1 (x86_64-apple-darwin14.1.0, NS appkit-1344.72 Version 10.10.2 (Build 14C1514))

Could this be a bug? Or is it perhaps a problem with my configuration?


texts: Retrieve current theme's file path instead of its name as a symbol

texts:
To know which theme is active ATM one could look in custom-enabled-themes, which is a list containing the theme name as a symbol.

But consider the following example case. You've installed the latest version of leuven-theme from MELPA and now it is your current loaded theme. Since Emacs ships an older version of leuven-theme, which one is active, the version from MELPA or the default in Emacs?

How can you get the current theme's file path instead of just the name?


texts:
My recent Git merge has resulted in a large number of conflicts. My current approach is to search for the next occurence of '<<<' and then perform the merge by standard text editing.

Question: is there a way Emacs can support merging using the information availabe in Git about my version, their version and the base version of the file?

Edit: This question has a different scope than this related question, since it is not limited to invoking ediff.


texts: Set org-table tab-key behavior to insert row when above a footer/hline

texts:
I've been experimenting with/learning org-mode's table features and spreadsheet-like formulae.

If I include a totals-type footer row in a table and precede it with a border (hline), then I can simply press enter when the cursor is in the last row of the main section to insert a new row, but it keeps the cursor in the same column. If I press the tab key from the last cell, it changes focus to the next non-hline cell. Neither actions are quite conducive to rapid data entry.

Is there a setting to enable the tab key to insert a new row in this case (like it does at the end of the table)?


texts: Org-mode: How to display current time record in another color?

texts:
I'm still very new to emacs and currently use it on the terminal to track my work time in org-mode.

** Save the world
:LOGBOOK:
CLOCK: [2019-02-14 Do 10:24]
CLOCK: [2019-02-14 Do 08:51]--[2019-02-14 Do 09:28] =>  0:37

How could I make it display the currently running time record in a different color or bold to make it more visible?
I'm aware that I can also see the current task in the status line.


texts: How can I have C functions coloured based on whether they are defined?

texts: Colleague of mine showed me a cool feature of gnome-builder which does colour symbols based on whether they are defined or not and I was wondering whether it is possible in Emacs as well.  And by that I mean whether there is already an existing solution so that I don't have to write the whole colouring backend or something like that.  I'm color-theme noob, I just have one that suits me and use it.  So, if there's an easy way how to add that feature by hooks, that's still fine.  I'm currently using gtags backend for helm if that helps.


texts:
Org manual states in its beginning

  Org is implemented on top of Outline mode, which makes it possible to
  keep the content of large files well structured.

I referenced 'outline-mode' by C-h f outline-mode, and curious about :

Is outline-mode is part of org, which was written by org team?
or it a emacs-builtin before Org?

How could I check it?


texts: How to prevent org-mode from exporting external links

texts:
In my org document, I have some urls that I would like to see exported plain-text, not as links. For example, if I have this in my org document,

http://www.pharo.org

exporting to HTML will result in this

http://www.pharo.org/

but I would like

http://www.pharo.org

Org automatically recognizes external links even without using the link syntax:

  Org also finds external links in the normal text and activates them as links.


texts:
What would be the best way to implement an Emacs Lisp command that pops up the minibuffer, lets the user edit a search string there, and runs code to update the search results after each keystroke (or other command) that changes the minibuffer contents? To be specific, I'm asking about how to run a Lisp function in response to text changes; running a Lisp function in response to each keystroke may be close enough.

I'm talking about something that resembles the well-known incremental search (I-search) commands built into Emacs. isearch.el shows that I-search itself sets up isearch-mode-map such that each ASCII/multibyte character is manually mapped onto the isearch-printing-char command. (It loops over all the numerical character codepoints and assigns the same command to each codepoint).

If possible, it would probably be easier to have normal minibuffer editing, and simply have a hook function that gets called after every keystroke (or other command) that changes the minibuffer contents.


texts: How to stop helm deleting vertical split when opening helm buffer?

texts:
I have (setq helm-always-two-windows t). When invoking a helm buffer i.e helm-find-files or helm-mini with 2 vertical splits helm deletes the other window in preperation to perform a possible persistent action in the currently selected window.

Is there any way to stop helm deleting the other window and preserve the 2 vertical splits when the helm buffer is opened?

ido-mode along with ido-vertical-mode seems to have the exact behaviour I'm after with vertical splits as it has no need to accommodate a persistent action.


texts: Highlighting the currently active org-Babel block

texts:
I want to do something similar to hl-line-mode but not sure if it has been implemented already and how it can be implemented.

The goal would be to set two color schemes for the #+begin and #+end lines or the entire block depending on whether the code block is active.


texts: How to highlight search tool matches in minibuffer?

texts:
These search tools list results in the minibuffer, but the matches are not highlighting:

SPC s a f (ag)
SPC s g f (grep)
SPC s k f (ack)
SPC s t f (pt)

Help describe does highlight matches.  Would be nice if ag/grep/ack/pt did the same.

Is there a way to highlight matches for ag/grep/ack/pt?
Does your Ivy search-tool highlight matches?

Other than that, I am really enjoying how tightly the search tool is integrated into the editor.

I am using Emacs 25.2.1 with Evil Spacemacs and Ivy on Linux.

Update_1

I restarted Spacemacs with the default .spacemacs file and there is no highlighting in the search results.
I guess it's a Spacemacs bug.

The following is a listing of what I did:

Renamed .spacemacs to .spacemaces_backup
Restarted emacs, and answer the questions:
    What is your preferred editing style? vim
    What distribution of spacemacs would you like to start with? spacemacs
    What type of completion framework do you want? ivy
(this generates a new .spacemacs file)

Restarted emacs,
    SPC s k f
    ack from ... : test
"test" is in the search results, but not highlighted.


texts:
windows 10, emacs 26.1

M-x occur
Some text to find
Result show in Occur buffer.

Nice.
How I can save content of this buffer in the file?


texts: How to retrieve the date under the cursor in emacs calendar as the format day.month.year like 15.07.2018

texts: Is there a way to retrieve the date under the cursor in emacs calendar as the format day.month.year like 05.07.2018 as a clipboard content?


texts: emacs navigation keys doesn't work when input is not english

texts:
I'm korean, and I use english / korean while editing in emacs
I mainly used terminal based emacs (emacs -nw) and in there, I can do basic navigation (such as C-e for move to end) in any language I'm at.
But strangely same C-e doesn't work in regular emacs (with windows not terminals) when I'm on Korean.
I'm on mac and I switch languages via switching input sources provided by Mac preference setting.


texts: Stop javascript-mode from lining up function parameters after newline

texts:
Using javascript-mode, functions are indented like this:

console.log('Example',
            var1,
            var2);

test('Example2',
     var1,
     var2);

I'd like to change this so that subsequent lines are intended by one tab instead, which is represented here with two spaces:

console.log('Example',
  var1,
  var2);

test('Example2',
  var1,
  var2);

How can this be done?  I can't find any options for javascript-mode that control this part of the indent process.


texts: Dollar symbol inside lstlisting block turns on font-latex-math-face

texts:
I am using lstlisting to add shell code into my tex document. The shell code contains special character, $. Emacs assumes it as a Math mode mark & all characters that come after dollar symbol are shown in math-mode and latex keywords are n't highlighted in their normal bright green color. It looks like this,

I use AUCTeX.


texts: Help with `call-process-region`: Searching for program: no such file or directory

texts:
I have the following snippet:

(call-process-region (point-min) (point-max)
   "python /Users/myname/code/move_imports/moveimports.py")

Incredibly, it tells me that it cannot find the file, even though it exists in the very same location given. Same happens with

(call-process-region (point-min) (point-max)
   "/Users/myname/code/move_imports/moveimports.py"))) ; Using shebang in python file

How can I fix this problem and run the executable by using the full path?

edit: The error I am getting is Searching for program: no such file or directory.


texts: how to achieve the behavior of :silent !a.out in vim

texts:
I am on terminal.

I'd like to invoke a ncurses based program a.out. In vim, I do :silent !a.out, which will directly show a.out.

In emacs, the closest thing I can do is (suspend-emacs "a.out"). However, the parent terminal will first be shown, and then a.out will be launched. It is as if we literally first suspend emacs, and type a.out, hence showing the original content on the terminal, losing the silent benefit as in vim.


texts: Org-mode cross references disrupted by ATTR_LATEX?

texts:
I have a couple of tables in the following runnable, complete, self-contained example, and I can successfully "forward-reference" them by name in the text:

Table [[tab:line-word-byte-count]] tells us that the output
has $1.5~M$ lines, $5.6~M$ words, and $69$ megabytes.

#+NAME: tab:line-word-byte-count
#+CAPTION: Line, word, and byte counts
| 1485702 | 5626026 | 69141951 |

Table [[TestFiles]] contains some filenames we can analyze.

#+NAME: TestFiles
#+CAPTION: List of files names.
| test_file.fbx            |
| armatures_and_things.fbx |

After running org-latex-export-to-pdf, I see the following

Ok, the uderscores in the filenames are causing LaTeX to typeset the names with subscripts, not what I want. So I add ONE line:

Table [[tab:line-word-byte-count]] tells us that the output
has $1.5~M$ lines, $5.6~M$ words, and $69$ megabytes.

#+NAME: tab:line-word-byte-count
#+CAPTION: Line, word, and byte counts
| 1485702 | 5626026 | 69141951 |

Table [[TestFiles]] contains some filenames we can analyze.

#+ATTR_LATEX: :mode verbatim
#+NAME: TestFiles
#+CAPTION: List of files names.
| test_file.fbx            |
| armatures_and_things.fbx |

and the caption AND the reference disappear, but the contents get typeset correctly. It doesn't matter where I put the ATTR_LATEX, before or after the NAME or CAPTION. Any of the six permutations of those three lines gives me the same bad results.

It seems that I can have EITHER captions and references OR verbatim contents, but not both.  I'd be grateful for any advice.

EDIT:

I should say that I'd rather not change the contents of the table because I want to feed them to a block of C code, where they are interpreted as strings. Using the proposed answer below, I could chop off the leading and trailing = signs, but then my C code will know about the special formatting I did to get the captions and references. I'd rather not make the C code too aware of the fact that it's being called in the code-block. For example:

#+name:   just-open-and-close
#+header: :exports  both
#+header: :flags    -std=c++14 -lfbxsdk
#+header: :includes '(<iostream> <stdio.h>)
#+header: :var      filenames   = TestFiles
#+BEGIN_SRC C++
  int main (int argc, char ** argv) {
      printf ("filePath: %s\n", filenames[0][0]);
      // ... some more code to open the file ...
  }
#+END_SRC

#+RESULTS: just-open-and-close
: filePath: =test_filefbx=
: An error occurred while loading the file


texts: Multiple insert point org source code insert

texts:
I know that we can customize the source code expansion <s TAB using something like this

(add-to-list 'org-structure-template-alist
             '("s" "#+BEGIN_SRC ? :results raw replace drawer hline: yes\n\n#+END_SRC"))

This would expand into something like this:

#+BEGIN_SRC <my cursor here>  :results raw replace drawer hline: yes

#+END_SRC

My cursor would be at the <my cursor here> so I can write name of the source code, e.g C, Python, bash...etc.

I would like to add another "jump point" so I can have something like this:

#+BEGIN_SRC <my cursor here>  :results raw replace drawer hline: yes
<next cursor here>
#+END_SRC

So, I can TAB after typing the type of the code and start writing right away. Is it possible to do this? I tried to add a second ? but it doesnt work.

(add-to-list 'org-structure-template-alist
             '("s" "#+BEGIN_SRC ? :results raw replace drawer hline: yes\n?\n#+END_SRC"))

This is what I got after adding a second ?.

#+BEGIN_SRC ?  :results raw replace drawer hline: yes
<cursor is here>
#+END_SRC

So, the first ? is skipped entirely.


texts: Window's PID of the current emacs' process

texts:
I use to edit LaTeX documents with okular as pdf viewer in Ubuntu Linux. I have this code:

(defun okular-forward-search ()
  (interactive)
  (start-process
   "okular"
   "okular-output"
   "okular" ;;; src-args
    ;;; args for -sourceposition:
   "--unique"
   (concat
    "file:"
    (concat (file-name-sans-extension (buffer-file-name)) ".pdf")
    "#src:"
    (number-to-string (line-number-at-pos (point)))
    (buffer-file-name))))

that performs forward-search from LaTeX code in emacs to the corresponding page in the generated .pdf file. My problem is that this shift the "focus" from emacs to okular and this is, for me, very annoying.

Is there a hack to keep the focus on emacs?

EDIT
I modified the function:

(defun okular-forward-search-mod ()
  (interactive)
  (call-process-shell-command
   (concat "okular --unique file:" (concat (file-name-sans-extension (buffer-file-name)) ".pdf")
       "#src:"
       (number-to-string (line-number-at-pos (point)))
       (buffer-file-name))
   )
  (call-process-shell-command "wmctrl -a emacs"))

But I still have an issue. If more instances of emacs are open the focus is on the first opened.
How can I get the window PID of the current emacs' process?


texts:
Let's say I have a custom TODO tag called 'NEXT' and a file gtd.org which contains the following:

* Some category
** TODO Big project in category
*** NEXT Big step to completing project
**** NEXT Small step to completing big step

In my custom agenda view, I have a block listing everything with a NEXT tag. The problem is that this block lists the big step and the small step, whereas I only want to see the small step. That is, I'm looking for one of the following solutions, from most desirable to least desirable:

Do not show a 'NEXT' headline if it has a child with 'NEXT' (probably resource        heavy)
Sort the agenda block so that greater headline depth is on top
Have different blocks for different headline depths

I know that org can detect headline depth, because when setting org-agenda-prefix-format its possible to add a number of spaces spaces to the prefix equaling the headline depth (using %l).

Any ideas?


texts: Cherry-pick columns to display in Dired or Dired+

texts:
I would like to customize the amount of detail displayed in Dired.  Basically I would like to cherry-pick the "columns" to display.  More precisely, I would like to hide the "owner group" information.  So instead of this:

drwxrwxrwx  1 fgeorges Utilisa. du domaine  40960 01-28 20:16 bar
-rw-rw-rw-  1 fgeorges Utilisa. du domaine  10574 01-29 08:31 file.txt
-rw-rw-rw-  1 fgeorges Utilisa. du domaine 198331 01-29 08:31 file.xml
drwxrwxrwx  1 fgeorges Utilisa. du domaine  40960 01-29 08:31 foo
-rw-rw-rw-  1 fgeorges Utilisa. du domaine  10499 01-28 20:17 file.json

I would rather see this:

drwxrwxrwx  1 fgeorges  40960 01-28 20:16 bar
-rw-rw-rw-  1 fgeorges  10574 01-29 08:31 file.txt
-rw-rw-rw-  1 fgeorges 198331 01-29 08:31 file.xml
drwxrwxrwx  1 fgeorges  40960 01-29 08:31 foo
-rw-rw-rw-  1 fgeorges  10499 01-28 20:17 file.json

It would be OK to never generate it in the first place, or to be able to hide it, by configuration or using a command.

I am aware of dired-hide-details-mode, but this is different.  It presents everything or nothing.  I would still like to have details, but just not some of them.

I searched quite a lot, and found nothing, but I cannot believe it is not possible to configure which columns to display in Dired.

BTW - I take solutions using Dired+ as well (I can consider any other extension, but would like to keep it to Dired or Dired+)


texts: How can I make tags-search able to find created timestamps containing both date and time?

texts:
I have made a tags search to filter out todo's created today:

(setq org-agenda-custom-commands'(
    ("d" "todo's made today" tags "TODO=\"TODO\"+Created=\"<today>\"" (
    (org-agenda-sorting-strategy '(scheduled-up))
    (org-agenda-overriding-header "TODO's created today")
    ))
))

My todo's contains a created timestamp as a property:

:PROPERTY:
:Created: [2015-07-30 on 21:33]
:END:

hence, the timestamp contains both date and time.

However, my tags search do not find tasks created today unless I change the todo's timestamp format to contain date only, like in [2015-07-30 on].

How can I change the tags search format to find today's timestamps when these contain both data end time?

Thanks in advance for any helpful suggestions : )


texts: How to move an org-mode file together with all attachments?

texts:
I have a couple files, e.g. file-1.org, file-2.org in the same directory sharing the data/ directory for attachments.

I'd like to move file-1.org to a different location, create a new data/ directory in that location and move all attachments that belong to file-1.org to the new directory. Is there an automatic way to do this?


texts: Move to other cloned buffer to same point? (sync position of indirect buffers) (org-mode)

texts:
I like to clone-indirect-buffer . But then once in a while, I want to move to the other buffer and go to the same position as in the previous marker.

This is usually the case when I use the indirect buffer as an 'outline' and want to s-mouse-1 to move the other buffer to the same spot.

I tried to hack together the following:

(defun my/goto-same-spot-in-other-buffer ()
  "Go to the same location in the other buffer. Useful for when you have cloned indirect buffers"
  (interactive)
  (let ((my/goto-current-point (point)))
       (other-window 1)
       (goto-char my/goto-current-point)
       (org-reveal))
)

But it doesn't work properly if the other buffer's content isn't fully expanded. I.e it doesn't jump into content that is collapsed.

[edit]
org-reveal did the job. (added to the code above).
Can the above be modified so that it expands sections properly if they are not expanded?

[edit2]
This may be of interest to future readers. In this post it dissucsses a dynamic TOC where I use the function above as well as another function that first finds the other buffer. You might want to check it out.


texts: How to make RET insert a blank line and indent and put point on this line when point between `{}`?

texts:
In most JavaScript IDEs, there is a feature that pressing RET when point is between {}, results in an indented blank line with point on the end of this blank line, as shown in the following two pictures:

when pressing RET:

But I found the electric-indent-mode only do this:

How to make things happen just like the second picture?


texts: configure shell-mode to understand implicit cd

texts:
For the most part, I'm really liking shell-mode. I've configured it to read my .history file and if I spawn a dired or open a file it uses the current directory.

I'm using tcsh with the set implicitcd flag set. This allows me to type a directory and cd to it automatically, e.g.

% cd
<home directory>
% /tmp
% pwd
/tmp

There are two problems with the default shell-mode configuration from my perspective (although they're fine for the default sh or csh settings).

1) I can't tab-complete directories in the first position, only executables. I'd like to be able to tab-complete directories here.

2) If I change directory without using cd emacs does not know to change the buffer's directory. I'd like to stat the first argument if there's only one argument and see if it's a directory and cd to it.

As for (2), the documentation mentions something about comint-input-filter-functions.

(defun comint-send-input (&optional no-newline artificial)
  "Send input to process.
After the process output mark, sends all text from the process mark to
point as input to the process.  Before the process output mark, calls
value of variable `comint-get-old-input' to retrieve old input, copies
it to the process mark, and sends it.

This command also sends and inserts a final newline, unless
NO-NEWLINE is non-nil.

Any history reference may be expanded depending on the value of the variable
`comint-input-autoexpand'.  The list of function names contained in the value
of `comint-input-filter-functions' is called on the input before sending it.
The input is entered into the input history ring, if the value of variable
`comint-input-filter' returns non-nil when called on the input.

But I'm a little concerned that comint-input-filter-functions may not be the appropriate place to parse input and determine if it constitutes changing directory because it's nil by default and emacs does parse the command if it starts with cd (but not chdir oddly enough).

(defvar comint-input-filter-functions '()
  "Abnormal hook run before input is sent to the process.
These functions get one argument, a string containing the text to send.")


texts: use-package and straight.el: can't load a package that exists locally?

texts:
I'm using the awesome use-package and the awesome straight.el to manage packages.

I'd like to use xahk-mode.  I've checked in the 'repos' directory of straight and I can see a folder named xahk-mode so I think it's locally available to straight.el.

However, when I try to execute

(use-package xahk-mode)

I get the error message:

Error (use-package): Cannot load xahk-mode

I'm using use-package and straight.el to load packages elsewhere (successfully), and I've got these in my config file:

(straight-use-package 'use-package)
(setq straight-use-package-by-default t)

The error message that I'm seeing doesn't make a whole lot of sense - is there any way to get more detailed information about what went wrong?  (And/or - does anyone have any advice on what to look for / try in order to fix this?)


texts: I am writing Fortran code in emacs but the tab key behaviour changes in F90 mode. Can I change it back?

texts:
On loading a f90 file, emacs changes to F90 mode, which changes some emacs behaviours.
When I press <tab> emacs inserts two spaces at the left margin. Now when I use the backspace key it deletes those two spaces one at a time.
Is there a modification I can make which will allow me to delete tabs with a single keystroke in F90 mode?