texts: Using inferior python and tramp together

texts:
For the last few weeks, I decide to work directly in a remote server using tramp-mode, with great success and joy.

However, recently I decide to add python-mode and an inferior ipython3 sheel to emacs, still working with remote files via tramp. The setup mostly works, and I can run the ipython kernel from the remote servet with little problem.

However, everytime I try to send the current buffer (or region, or file) to be executed, I get the following kind of error (the filename may change to a real filename, according to the function):

FileNotFoundError: [Errno 2] No such file or directory: '/ssh:mss:/tmp/df1fefb99e7a8013d07dcc5ef8b002be-psss-temp.py

(mss being my server alias).

This seems to be due to python-mode sending the file path with the TRAMP ssh prefix in it. If I just erase the '/ssh:mss:', the remote iPython functions as expected.

How can I correct this? I suppose I could change python-mode code to correct for the TRAMP prefix, but I don't know where to look for changing. My emacs file, if anyone is interested is in https://github.com/aylons/emacsd/tree/master/


texts: Why doesn't changing buffer in filter function have any effect in ERT?

texts:
I have a test for fsharp-mode to exercise the jump to definition
functionality. Communicating with the background process involves
sending a command and then letting the filter function handle the
response, which may involve switching to a different buffer. This
works fine "for real", but no in the test. Strangely, the buffer
switch seems to have worked in the filter function, but has no effect
on what the main test function considers to be the current buffer.

I have created a minimal repro, which is included below. It simply
runs ls, and has a filter function that uses find-file to switch
buffer. The output from message indicates that the buffer switch has
succeeded, but the test function which polls the current buffer at 1s
intervals always outputs the same result for the current buffer.

The test can be run with emacs -Q --batch -l repro.el -l ert -f
ert-run-tests-batch-and-exit if the below text is saved to repro.el.

(require 'ert)

(defun start-proc ()
  (let ((proc (let (process-connection-type)
                (start-process "background" "*background*" "/bin/ls"))))
    (when (process-live-p proc)
      (progn
        (set-process-coding-system proc 'utf-8-auto)
        (set-process-filter proc 'bg-filter-output)
        (set-process-query-on-exit-flag proc nil)))))

(defun bg-filter-output (proc str)
  (message "In filter")
  (find-file "2.txt")
  (message "Buffer name now: %s" (file-name-nondirectory buffer-file-name)))

(defun wait-for-condition (fun)
  (with-timeout (3)
    (while (not (funcall fun))
      (sleep-for 1))))

(ert-deftest change-file-bg ()
  "Check it changes file even in filter output"
  (find-file "1.txt")
  (start-proc)
  (wait-for-condition
   (lambda () (progn
           (message "buffer: %s" (file-name-nondirectory buffer-file-name))
           (not (equal "1.txt" (file-name-nondirectory buffer-file-name))))))
  (should (equal (file-name-nondirectory buffer-file-name) "2.txt")))

What have I done wrong?


texts: How to customize syntax highlight for just a given mode

texts:
I would like to change the syntax highlighting in my lua-mode.el without affecting other major modes.

Just as an example, I would like "key words" like if, then, else to be in bold and blue typeface when in lua-mode (instead of the default pink) without having the same highlighting style while editing a .tex file with AUCTeX.

So far I have tried to put the following code in my .emacs and then also in my lua-mode.el:

(custom-set-faces
  '(font-lock-builtin-face ((t (:foreground "maroon3"))))
  '(font-lock-comment-face ((t (:foreground "green4"))))
  '(font-lock-keyword-face ((t (:foreground "dark blue" :weight bold))))
  '(font-lock-string-face ((t (:foreground "dark cyan")))))

but this way I get the same syntax highlighting for every mode I work with.

This question might be related: Change syntax highlighting without changing major mode?

Is there a (hopefully simple and general) way to do this?


texts: Toggle letter case -- exclude custom words from a list

texts:
Xah Lee wrote (some time ago) the following function that toggles the letter-case of the selected region or the current word.  When toggling to initial caps, some words should not be capitalized such as and, or, for, and perhaps some custom words like to.

Q:  How can toggle-letter-case be modified to exclude select words (e.g., from a list of custom words) when making initial caps.

Scenario #1 -- all uppercase:  FOO TO BAR FOR BAZ; AND, APPLE TO ORANGE

Scenario #2 -- all lowercase:  foo to bar for baz; and, apple to orange

Initial Caps -- Desired Result:  Foo to Bar for Baz; and, Apple to Orange

  (defun toggle-letter-case ()
  "Toggle the letter case of current word or text selection.
  Toggles between: “all lower”, “Init Caps”, “ALL CAPS”."
(interactive)
  (let ((deactivate-mark nil)
        (case-fold-search nil)
        p1 p2)
   (if (region-active-p)
       (setq p1 (region-beginning) p2 (region-end))
     (let ((bds (bounds-of-thing-at-point 'word)))
       (setq p1 (car bds) p2 (cdr bds))))
   (when (not (eq last-command this-command))
     (save-excursion
       (goto-char p1)
       (cond
        ((looking-at "[[:lower:]][[:lower:]]") (put this-command 'state "all lower"))
        ((looking-at "[[:upper:]][[:upper:]]") (put this-command 'state "all caps"))
        ((looking-at "[[:upper:]][[:lower:]]") (put this-command 'state "init caps"))
        ((looking-at "[[:lower:]]") (put this-command 'state "all lower"))
        ((looking-at "[[:upper:]]") (put this-command 'state "all caps"))
        (t (put this-command 'state "all lower")))))
   (cond
    ((string= "all lower" (get this-command 'state))
     (upcase-initials-region p1 p2) (put this-command 'state "init caps"))
    ((string= "init caps" (get this-command 'state))
     (upcase-region p1 p2) (put this-command 'state "all caps"))
    ((string= "all caps" (get this-command 'state))
     (downcase-region p1 p2) (put this-command 'state "all lower")))))


texts: Why does calling `term-send-backspace` (just pressing backspace) create a newline in the `*terminal*` buffer in `term-mode`?

texts:
Specs:
i@debord:~$ emacs --version
GNU Emacs 26.3.50
Copyright (C) 2019 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

i@debord:~$ /bin/bash --version
GNU bash, version 4.4.20(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

i@debord:~$ cat /etc/os-release
NAME="Linux Mint"
VERSION="19.3 (Tricia)"
ID=linuxmint
ID_LIKE=ubuntu
PRETTY_NAME="Linux Mint 19.3"
VERSION_ID="19.3"
HOME_URL="https://www.linuxmint.com/"
SUPPORT_URL="https://forums.ubuntu.com/"
BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/"
PRIVACY_POLICY_URL="https://www.linuxmint.com/"
VERSION_CODENAME=tricia
UBUNTU_CODENAME=bionic
i@debord:~$

In term-mode calling term-send-backspace creates a newline in the buffer. I'm suspect that send_process (process.c) might have something to do with this.
Is there any way/work-around that can prevent this behavior?

Step To Reproduce:
emacs -q
M-x term
ret
ret
asdf
del
Observe (by clicking on the line below the prompt in the *terminal* buffer) that a newline has been created in the *terminal* buffer.

EDIT (08/06/2020):
The bug appears to be at the end of function term-erase-in-line:
(defun term-erase-in-line (kind)
  (when (= kind 1) ;; erase left of point
    (let ((cols (term-horizontal-column)) (saved-point (point)))
      (term-vertical-motion 0)
      (delete-region (point) saved-point)
      (term-insert-char ?  cols)))
  (when (not (eq kind 1)) ;; erase right of point
    (let ((saved-point (point))
      (wrapped (and (zerop (term-horizontal-column))
            (not (zerop (term-current-column))))))
      (term-vertical-motion 1)
      (delete-region saved-point (point))
      ;; wrapped is true if we're at the beginning of screen line,
      ;; but not a buffer line.  If we delete the current screen line
      ;; that will make the previous line no longer wrap, and (because
      ;; of the way Emacs display works) point will be at the end of
      ;; the previous screen line rather then the beginning of the
      ;; current one.  To avoid that, we make sure that current line
      ;; contain a space, to force the previous line to continue to wrap.
      ;; We could do this always, but it seems preferable to not add the
      ;; extra space when wrapped is false.
      (when wrapped
    (insert ? ))
      (insert ?\n)
      (put-text-property saved-point (point) 'font-lock-face 'default)
      (goto-char saved-point))))


texts:
I have two files in my agenda: current.org and later.org. My setup has it so that current.org has all active tasks (state TODO) and later.org has all inactive ones (state LATER). Right now, in my agenda I have to change the state of a task using C-c C-t and then refile it to one file or the other using C-c C-w depending on the new state.

Is there a way to write a command so that in org-agenda I can change the state of a task and refile it to a different file in one go?


texts: evil-mode visual selection copies text to clipboard automatically

texts:
Setup:

GUI version GNU Emacs 25.0.50.1 (x86_64-w64-mingw32) of 2015-07-25 on KAEL
Compiled from EmacsW64.

Package Evil, using the latest version of Evil from MELPA

Windows 7 x64 bit.

Situation:

Tested with empty Emacs configuration with only Evil enabled.
I copy some text from Windows application. Then I paste it into Emacs inside normal mode with p. I see the text.

Then I switch to the Windows application, select another text, copy it.
Switch back to Emacs, visually select the text, and paste inside visual mode. But the text inside the region will not be replaced with the text from the Windows clipboard.

This is not with the default Vim. How could I configure it, that the visually text gets replaced by the latest copy action, in this case the Windows clipboard?


texts:
So, I've made a little batch file that simply compiles all the code I need and moves it to their right places. I've seen some people using the compile function  to launch something like the batch file I've made, but I can't seen to figure out how they do that. Also, I need the launch environment to be the same as the batch file is. This is the batch I have.

@echo off
mkdir ..\..\build
pushd ..\..\build
cl -Zi ..\alfa\code\win32_alfa.cpp user32.lib gdi32.lib
popd

There's also a second feature I would like to know if it's possible. Can I somewhat search the folders near where my code is and if it finds the build.bat, launch it?


texts: Problem with org-agenda view when going forward 1 week

texts:
I have my org-agenda to start on a Sunday. Hence I have this code in my .emacs file:
(setq org-agenda-start-on-weekday 0)
org-agenda opens with the cursor on the current day of the week.
If I press "f" to move forward a week, Emacs will move the calendar forward from the place of the cursor. Hence if the cursor is on a Friday, it will move forward to the next Friday. This means that part of my agenda is not visible and I have to scroll up or press C-Home. I would always like the whole agenda to be visible regardless of where the cursor rests.
See the accompanying pictures:
https://drive.google.com/drive/folders/1-pVsp7pAkPsVQCXn49mDw0c-bUS5Vef0?usp=sharing


texts:
I would like to use special mark symbols not only in window-system but also in xterm:

(setq gnus-summary-to-prefix (if window-system "▒ " "==> "))

What check I should use?


texts:
I have this line in my .emacs file.

(add-hook 'ibuffer-mode-hook
          #'(lambda ()
              (ibuffer-switch-to-saved-filter-groups "default")))

The settings work fine for me. But flycheck says:

the function `ibuffer-switch-to-saved-filter-groups' is not known to be defined.

I think if I declare the function ahead, the warning would go away. But ibuffer is a build-in package, and I cannot find a way to declare this function.

How to declare a built-in function?

Update

I found the ibuffer-switch-to-saved-filter-groups is not a built-in function, but is defined in a file called ibuf-ext.el, and locate-library can find this file from my environment path. But even after I defined declare-function like below:

(declare-function ibuffer-switch-to-saved-filters "ibuf-ext.el" nil)

I still get this warning from flycheck.


texts: Preview pdf-file if possible when doing `helm-do-grep` or `helm-do-ag`

texts:
Suppose I do helm-do-grep or helm-do-ag on my tex-files, I can select a file on the results list and get a preview in another buffer by pressing tab. Is there a way (by pressing another key, not by redefining tab), to preview the corresponding pdf-file (if available) instead?

Another idea would be to define a variant of 'helm-follow-mode' say 'helm-tex-pdf-follow-mode' which previews the compiled pdf of the corresponding tex file if existend.

You may say that I could use pdfgrep, but with grep on the source files, I can for example find files containing specific comments (for example tags), not contained in the pdf-file or you can better search for math formulas.


texts: Emacs, pretty print but showing spaces and \n

texts:
I'm making diagrams with plantuml and org mode, when preparing the JSONs, in order to plot well the diagram I need this representation of JSON:

(with-temp-buffer
  (insert (json-encode '((calimero . pato) (gato . 3))))
  (json-pretty-print-buffer)
  (buffer-string))

Whit this result:

"{
  \"calimero\": \"pato\",
  \"gato\": 3
}"

but I really need, this in one line with tabs and returns:

"{\n  \"calimero\": \"pato\",\n  \"gato\": 3\n}"

I tried with this but I get many extras things that I do not need:

(with-temp-buffer (insert (json-encode '((calimero . pato) (gato . 3))))
                         (let ((print-escape-newlines t))
                         (json-pretty-print-buffer)
                         (prin1-to-string (buffer-string))))

"\"{\\n  \\\"calimero\\\": \\\"pato\\\",\\n  \\\"gato\\\": 3\\n}\""

I want to fullfill this org mode plantuml block, with a json, with returns and spaces in order to view it as emacs pretty json but in the drawing inthe palntuml doc says that it needs to be in one line with "\n" and spaces:

Begining from this:

'((calimero . pato) (gato . 3))

getting this:

{\n  "calimero": "pato",\n  "gato": 3\n}

I will use in a plantuml diagram like this:

#+BEGIN_SRC plantuml :file hola.png
Alice -> Bob: {\n  "calimero": "pato",\n  "gato": 3\n}
Bob --> Alice:
#+END_SRC

#+RESULTS:
[[file:hola.png]]


texts: How to get rid of flickers in python shell?

texts:
In a fresh emacs session, each time I hit enter in inferior-python-mode, the window flickers.

This does not happen in shell-mode. One can see the cursor goes to the middle of current window when flickers happen.

How can I get rid of these flickers? Thanks.

Emacs version: GNU Emacs 26.1 (build 2, x86_64-apple-darwin17.5.0, Carbon Version 158 AppKit 1561.4) of 2018-05-25


texts: Org Weekly Agenda filter tags with logical OR

texts:
Background information to motivate my question:

With the agenda open, I can press "\" then "+" to show only results containing a certain tag, say A. I can then press "\" and "+" again to show results with both A and another tag, say B.
These combinations are boolean expressions of the tags AND'ed together: A AND B for the former and A AND NOT B for the latter.

My question:

I would like to filter my agenda in the same way but with the union of tags A and B, so that any entries with either tag A OR tag B are shown (A OR B). How can I do this?

org-agenda-custom-commands can define tag searches using the full boolean expression syntax described in the manual (as described in the answer to this question), so that defining a custom command like
(setq org-agenda-custom-commands '(("z" "test" tags "A|B")))
but these searches do not produce a weekly agenda. For example, they are not sectioned by date, they do not only show scheduled and deadline items, and they do not show upcoming deadlines.

How can I filter the weekly agenda using a query for tag A OR B?


texts:
Is there a problem combining key-chord-mode with evil?  After some puzzlement I
discovered that key-chord mode only works (this may have changed recently) when
activated (by M-x) in insert mode.
Leaving insert mode disables key-chord mode.


texts:
In LaTeX, I use extra spacing to separate sentences from each other.
This may for instance be achieved by

\spaceskip=.33333em plus .16667em  minus .083333em
\xspaceskip=.8em plus .4em minus .13333em
\nonfrenchspacing

With these settings I must take care to make it known when I want to
use a full stop for something other than ending a period, such as
marking an abbreviation.
This I do by typing

Mr.\ Charles

&c.  But if I write Mr.\ Charles in an org buffer and export to
LaTeX, I get a literal \ in my pdf, which corresponds to \\ in
the exported source.  How can I get \ in the source and a normal
space skip in the typeset document?

I know I can do Mr.@@latex:\@@ Charles, but is there no better way?


texts: Make ispell automatically clear minibuffer when replacing word

texts:
When using ispell to check spelling and encountering an incorrect word, pressing r takes you to the minibuffer where you can enter a replacement for the misspelled word. By default the minibuffer already contains the incorrectly spelled word and so I need to clear the minibuffer first before being able to type in the replacement.

How do I add a hook to clear the input prompt automatically?


texts: Insert parens while completing functions in company mode

texts:
If i select first option it will become

l.remove

But as the completion candidate is function type, how can i make it to

l.remove()

so that i don't have to manually type parens?


texts:
I'm currently using spacemacs.
I have put the line (global-linum-mode t) into the .spacemacs file but it doesn't work at all.
It used to work when I used the normal emacs.
I don't have any clue of what is going on. Apparently emacs --debug-init doesn't have any output.


texts: How to run my own hook that accumulates the result of each call?

texts:
I would like to define my own hook, where the result of each caller is collected (when the hook is run).
Is there a way to do this?
Currently I pass in a function to the hook, that function can be run with the result of the hook, but this feels quite awkward,
(defun my-hook (fn-result)
  ;; This allows me to emit a result for each function, but isn't nice.
  (funcall fn-result (+ 1 1)))

(add-hook 'my-custom-hook #'my-hook)


texts: Directed Acyclic Graphs in Org mode, and Cloned Nodes

texts:
By default, Org-mode headers form trees. That is, every header can have an arbitrary number of sub-tasks, and this relationship is recursive to an arbitrary depth. However, a task in practice can be a dependency of two parents. Adding this property creates a directed acyclic graph (a DAG).

This relationship is not supported out of the box by Org mode, though it is available in Leo, as well as a number of enterprise issue managers. Leo, in particular, implements a DAG through cloned nodes. These are nodes that can appear in more than one place in an outline. Hence, they can have multiple parents, correctly reflecting the property that they may be required for multiple higher-level concerns.

Further justification for this feature is provided in the Leo documentation on personal information management:

  Clones can greatly accelerate your work flow. To start a project,
  clone nodes related to the project and drag them at or near the top
  level, where you can get at them easily. When the project is complete,
  just delete the clones. This work flow is surprisingly effective:

  The original nodes never move, but they change whenever their clones do.
  There is nothing to “put back in place” when you are done. Just delete the clones.

  Used this way, clones create views: when you gather cloned nodes
  together for a project, you are, in effect, creating a
  project-oriented view of the outline. This view focuses your attention
  on only those nodes that are relevant to the task at hand.

How can cloned nodes be implemented in Org mode?


texts:
I want to show all entries with status WAIT along with their parent entries and hide everything else.

#+SEQ_TODO: TODO(t) WAIT(w) | DONE(d) PASS(p)
* Item
  Description.
** TODO Task 1
   Description.
** WAIT Task 2
   Description.
* Item
** WAIT Task 3
   Description.

If I do C-c / m TODO="WAIT" I get

#+SEQ_TODO: TODO(t) WAIT(w) | DONE(d) PASS(p)
* Item...
** WAIT Task 2...
* Item
** WAIT Task 3...

As you can see the entries are collapsed. How do I get an expanded view of the selected entries?


texts: How to bind meta-shift-arrow to mark one word at a time

texts:
I am having trouble of marking one word at a time (ctrl-shift-arrow or meta-shift f/b) when connecting from one of my terminals. I would like to bind it also to meta-shift-arrow.

I couldn't find what are the commands to do it.

Any idea?

EDIT: I am looking for something like (pseudocode) (global-set-key (kbd "M-S-right") 'mark-word-right)

If it's relevant, I am using CUA mode.


texts: The difference between save-current-buffer and save-selected-window

texts:
Consider:

(defun test()
  (interactive)
  (save-selected-window
    (switch-to-buffer-other-window "Test buffer.")))

When test is run interactively while in a buffer visiting a file, the buffer is successfully restored. Why doesn't the following do the job?

(defun test()
  (interactive)
  (save-current-buffer
    (switch-to-buffer-other-window "Test buffer.")))


texts: Org-mode inlinetask neither exporting nor archiving correctly

texts:
I use emacs a lot and have been using Org-mode more and more. One of
the killer features for me is the inlinetask. These are TODOs which can
be placed anywhere in a document without being a part of the document
structure. I think of them as virtual sticky notes.

There are two problems that I've found that I can't solve:

an inline task at the end of a paragraph will cause the preceding
paragraph to be merged with the proceeding paragraph when exporting
(to ASCII, for example). Is there any way to fix this?

For example, If I start out with the following:

#+TITLE:
#+OPTIONS: inline:nil toc:nil author:nil

Here is paragraph one. It has some
mistakes so I need to make some changes.
*************** TODO revise
*************** END

Here is paragraph two. I want it to
remain a separate paragraph.

Then I would expect this when I export

Here is paragraph one. It has some mistakes so I need to make some
changes.

Here is paragraph two. I want it to remain a separate paragraph.

But I get this:

Here is paragraph one. It has some mistakes so I need to make some
changes.
Here is paragraph two. I want it to remain a separate paragraph.

This problem is even more obvious when exporting to LaTeX because the two paragraphs will flow together with no obvious space between them.
inline tasks can't be archived. When I try to archive an inline
task, I get an error: "The kill is not a (set of) tree(s)". Is there
any way to archive inline tasks? The documentation notes:

  Also, if you want to use refiling and archiving for inline tasks,  The END line must be present to make things work properly.

All of my inline tasks have an END line, but I still get the error.


texts:
I'm trying to byte compile predictive mode and I have an issue that I can't solve. If I clone it from the official repo, and make it, I get:

In toplevel form:
predictive-auto-overlay-auto-dict.el:35:1:Error: Symbol’s function definition is void: trie-lexical-binding-p
Makefile:149: recipe for target 'predictive-auto-overlay-auto-dict.elc' failed
make: *** [predictive-auto-overlay-auto-dict.elc] Error 1

If I download the tar ball I face this error:

makeinfo predictive-user-manual.texinfo -o predictive-user-manual.info
make: makeinfo: Command not found
Makefile:154: recipe for target 'predictive-user-manual.info' failed
make: *** [predictive-user-manual.info] Error 127

In both cases it compiles some stuff and eventually fails. I'm quite new to not using package manger, so I might be doing something wrong here though.


texts: Insert column in org-mode moves the content

texts:
I am trying to insert a column in a table in org-mode and I get the content moved.
For example, I have this table:

| Name   | Age |
|--------+-----|
| Tarzan |  40 |
| Jane   |  39 |

Now I want to insert a column between Name and Age.
So I add a pipe (|) just after Name:

| Name  | | Age |
|--------+-----|
| Tarzan |  40 |
| Jane   |  39 |

And the press TAB.
I get this:

| Name   |    | Age |
|--------+----+-----|
| Tarzan | 40 |     |
| Jane   | 39 |     |

While what I would expect is:

| Name   |    | Age |
|--------+----+-----|
| Tarzan |    |  40 |
| Jane   |    |  39 |

It seems kind of simple to fix manually for that table, but... I haven't told you all the story.
In the real table I have Boy, Cheeta, Cheeta's family, the herd of elephants, lions, tigers, crocodiles, etc... and all the psychological relationships between them...

Is there a way to avoid that column content move?


texts: Standard ML Emacs "real time" compilation?

texts:
I'm interested in configuring my Emacs environment to perform real-time compilation of a Standard ML buffer, on the event corresponding to a ";" character being entered (at the end of a line), such that the result of the compilation shows in a second buffer in a parallel window. The online SML interpreter SOSML (https://sosml.org/editor) does something like this, with the compiler output going in another text field on the same page. It is reactive this same way, using the ";" character.

I have been able to figure out how to compile SML in Emacs via a shell in a separate buffer and window (M-x run-sml), but only by explicitly entering commands when I'd like to compile an entire file. I do have SML Mode installed in Emacs and the text analysis is working well. But I'm struggling to find documentation about how Emacs might be able to watch a buffer and react in realtime to a character (such as ";") to trigger compilation of that same buffer in another buffer and window.

I appreciate any suggestions as to the appropriate convention and tool here.


texts: How to cycle back through parameters on a yasnippet?

texts:
When I got a snippet with a few parameters:

<img src="http://lorempixel.com/${1:width}/${2:height}/${3:$$(yas-choose-value '("abstract" "city" "animals" "food" "people" "transport" "business" "sports" "technics"))}/${4:text}" alt="$3">

I can cycle forward pressing tab, but if I change my mind and want to modify a previous parameter the only way is leaving the cycle and go back by hand. Am I missing something or there's a key binding to go back?.


texts: orgmode change face of headings depending on tag

texts:
I am adjusting the face of my current heading based on the tag like this:
(defface org-tag-face2
  '((nil :foreground "VioletRed3" :background "dark gray"))
  "org tag face")
(font-lock-add-keywords
 'org-mode
'((":\\(noex[^\:]+\\):" (1 'org-tag-face2))))

This results for my tag "noexport" in something like

This works quite good, but it also changes the actual face of the heading title as you see in the image above.
Does anyone know how I could keep the almost the same face for the relevant headings but just change to italic fonts or underline the particular headings in its own color?
I think this would improve the readability of the documents a lot.
Thank you in advance!
Fab


texts:
I am pretty new to Emacs.  Could someone please help me to write a custom command which I can add to my init file? It would do the following:

Split the screen vertically to get two windows.
Check if a buffer named '* ansi-term *' (without spaces) exists. If so, it would open this buffer in the one of vertically split windows.
If a buffer with such a name doesn't exist it would run command ansi-term (ignoring all prompting) to start a new terminal instance in one of the vertically windows.


texts: How to override Q in term-mode with passthrough if the shell process is still live?

texts:
I wrote the following emacs lisp procedure to kill a dead ansi-term buffer. It works well if called with M-x. Also, it appears to run correctly when the called in a living term buffer. However, dead buffers happily insert Q anyways. Why is that and how can I make it actually kill the buffer when the process is dead without calling M-x?
(defun terminal-burn-when-dead-or-insert-Q ()
  (interactive)
  (setq buf (current-buffer))
  (if (not (process-live-p (get-buffer-process buf)))
      (kill-buffer buf)
    (insert "Q")))

(define-key term-raw-map (kbd "Q") #'terminal-burn-when-dead-or-insert-Q)
(define-key term-mode-map (kbd "Q") #'terminal-burn-when-dead-or-insert-Q)


texts: Spacemacs: kill buffer and kill window in one command?

texts: Is there a spacemacs command that both closes the window and kills the buffer? In other words, the equivalent of Vim's :q?


texts: Display sunrise and sunset time from agenda view


texts: How to set the coding system for new files with specific extensions

texts:
When I visit a new file, ^xf, that has an extension of .sql or .dsql I would like the coding system to be set to utf-8-with-signature-dos. The default is currently iso-latin-1-dos.

I'm running (version) of "GNU Emacs 24.3.1 (i386-mingw-nt6.1.7601)\n of 2013-03-17 on MARVIN"

Both the .sql and .dsql extension start up sql-mode, but I doubt a hook off of sql mode is the appropriate place to change the coding system for new files.


texts: Need to load initial file every time when restart emacs

texts:
I'm a newbie in Emacs who just is familiar with basic key bindings. I'm trying to learn more. I just learned to create initial file ~/.emacs.d/init.el and how to evaluate. But I find I need to load the initial file every time when I restart Emacs. I tried following things:

check there is no ~/.emacs or ~/emacs.el
go to /usr/local/share/emacs/site-lisp, add a code in subdris.el

(add-to-list 'load-path "~/.emacs.d/init.el/")

And I checked that this file is in load-path.

However, I still need to reload the init file every time I restart Emacs.
Any suggestions?


texts:
I'm quite new to emacs and a lot of the documentation I'm finding online is going over my head a bit at the moment.

I've been using emacs as my git editor for a while now by mostly eye-balling reasonable line lengths but it's not at the point where I want to have line lengths taken care of for me. I'm not yet at the point of using emacs as my shell environment so I'm looking for a simple solution to simply handle the recommended line lengths (50 chars for the summary line, and 75 chars for all other lines)

I found this EmacsWiki page which explains that there's a log-edit.el bundled with emacs by default. I'd rather not pull in a large package like magit while I'm still getting to grips with things but I can't find any explanation of how to enable the git log editing mode with log-edit.el

My question is two fold, does log-edit.el enforce these recommended line lengths some how (some sort of colour change perhaps), and if so how would I enable it in my emacs config / git config so that it is used for editing git commits?

If log-edit doesn't have this capability, I'm open to further suggestions or I will take a look at getting started with magit. I'd just like to avoid overloading myself with too much to learn all at once.


texts: Create a file link in org-mode that accepts spaces in the text

texts:
My org file looks something like this:

* Space Radiation
** Gamma Ray Info
   - file://Library\March 2015\Gamma Ray Radiation Fundamentals.pdf
   - some notes

However the title has spaces so the link stops at the first space. As I have literally thousands of collected papers and books that spaces in the name, adding %20 or even '+' to fill the space is a major task and also makes the linked document title difficult to read especially if you have several lines of such links.

Is there a way to work around this without having to change all the file names to convert or delete the spaces in the file name?


texts: org-mode with predictive mode key conflict

texts:
I'm using org-mode with predictive and having an issue with predictive changing a key binding that org-mode uses. Specifically, predictive changes M-tab and I prefer to keep org-mode's definition of M-tab.

I'm loading up predictive with

(add-hook 'org-mode-hook 'predictive-mode)

which makes me think that I can do something like:
(eval-after-load 'org-mode
    '(define-key....

But I'm not sure if this is the correct "emacs" way to solve this problem.


texts: emacs --daemon frozen when started with emacsclient file

texts:
This is somewhat of a follow up to Prevent emacsclient from blocking other instances.

I am using emacsclient -a '' -nw --socket-name=$TTY where TTY=$(basename tty). I use emacs in the terminal and this gives a unique daemon for each terminal session.

If I start the daemon by running emacsclient with no arguments, it starts and everything works fine. However, if I start it by running emacsclient file, it locks down. It opens the scratch buffer and then gets frozen. The only way to fix it is to kill -9 the daemon process and to restart it without opening a file.

I am using emacs 24.4 compiled with --without-x with Mac OS X in iTerm 2. You can get the exact build of emacs I am using with conda conda install -c asmeurer emacs.

EDIT

I found after disabling flyspell (commenting out these lines from my .emacs), it fixes it. It still hangs on the scratch buffer for a few seconds, but then goes to the file. I suspect it has something to do with starting the hunspell process.


texts: Emacs momentarily stalling with Flycheck

texts:
I am using the GUI version of Emacs. I have noticed that while editing text, mainly in js2-mode with Flycheck enabled, the editor frequently stalls.

Is there a way to prevent this from happening or should I just not enable Flycheck mode constantly?


texts: iimage-mode - resize an image in Markdown mode to fit the window

texts:
I would love to be able to see images in Markdown that are rescaled to fit into my window. I googled for the answer but could not find how to rescale images shown with iimage-mode in Markdown. I can see a solution for org-mode or an image open with Emacs. Any idea how to do this to an inline-image in Markdown?

Workaround for now: for i in *; do convert $i -resize 800x500\> ../imgs/$i; done I rescale images in the terminal and then use them in my notes.


texts: Spacemacs config on OSX is not detected?

texts:
I have installed spacemacs following this tutorial:
https://github.com/syl20bnr/spacemacs#prerequisites

The spacemacs config is not detected.

The $HOME dir is set to /home/<username> and is correct.

Upon running emacs --insecure errors with "Unknown command insecure"
So I tried running emacs and manually setting the path to emacs.d dir like so:

emacs --load ~/.emacs.d/init.el and I got the following error:
no such file or directory core-spacemacs

I am pretty sure that I am missing something, since I am following the official tutorial, but I can't figure out what to do.

I think the config isn't loaded properly but since these are my first steps I am having a hard time debugging further.

Help appreciated!

PS:
OSX Catalina

emacs --version
GNU Emacs 28.0.50


texts:
I installed spacemacs using "git clone https://github.com/syl20bnr/spacemacs.git ~/spacemacs/.emacs.d"
but I got an error:  Package 'tabbar-20160524' is a system package,not deleting....

When I started emacs with --debug-init I got this:

but I am not good at elisp, this error is difficult for me , can you help me solve it, thanks!


texts: Clear console output on *R* buffers when using ESS

texts:
I have this kbd in my init.el
(global-set-key (kbd "C-l") 'comint-clear-buffer)

When I use Emacs-ess mode fro programming in R, I use this kbd to clear the R output buffer, this is usually called *R*. That works, but it requires that I go into the *R* buffer and do C-l from there.
Can this be modded so that wherever I am into some other buffer, the comint-clear-buffer command is applied specifically to the *R* buffer when I am into an ESS mode buffer?


texts: Sorting an org-mode table with horizontal lines

texts:
I have a table in org-mode which has the following format:

| Name       | email           | number |
|------------+-----------------+--------|
| Doe, John  | jod@example.org |      7 |
| Doe, Jane  | jod@example.org |        |
|------------+-----------------+--------|
| Foo, Pete  | pf@example.com  |      5 |
|------------+-----------------+--------|
| Bar, Mary  | maba@127.0.0.1  |      3 |
| Quux, Mike | bz@192.168.12.1 |        |
|------------+-----------------+--------|

But I want the table to be formatted to look like this:

| Name       | email           | number |
|------------+-----------------+--------|
| Bar, Mary  | maba@127.0.0.1  |      3 |
| Quux, Mike | bz@192.168.12.1 |        |
|------------+-----------------+--------|
| Doe, John  | jod@example.org |      7 |
| Doe, Jane  | jod@example.org |        |
|------------+-----------------+--------|
| Foo, Pete  | pf@example.com  |      5 |
|------------+-----------------+--------|

This table should be sorted alphabetically. So the last two rows should be the first. The separation with the horizontal lines should stay. If there are different words in in grouped columns, it doesn't matter how they are sorted. So the last group in the table above can either be Bar followed by Baz or Baz followed by Bar. How can I do this with Emacs org-mode?


texts: Simultaenously viewing two different Info areas

texts: I'd like to have two emacs frames simultaneously open, with the first frame showing the Info(elisp tutorial) and the second frame showing the Info(elisp manual).  After setting the first frame and opening the second frame, when I set the second frame to the Info(elisp manual), the first frame also changes to the Info(elisp manual).  Is there an emacs variable that I can set to prevent the first frame from moving away from the Info(elisp tutorial) when the second frame is set to the Info(elisp manual)?


texts: Org: have multiple TODO sequences that terminate with DONE

texts:
So, let’s say I have two different TODO keyword sequences:

TODO | DONE
RESEARCHING WORKING FINISHING | DONE

I want both to cycle to “DONE.” But, the Org manual says not to use duplicate TODO keywords. And, I can’t find any established way to have separate sequences “merge” into one. I know the obvious solution would be to have two separate “DONE” keywords, but that just sounds insane to me; I’d rather have a heading start as a TODO, then I either shift+right to DONE or shift+Ctrl+right to the other sequence, which will eventually lead to DONE as well.
Please help! Thanks!


texts: How can I update ATTACH tags in org-mode to reflect reality?

texts:
In a Microsoft-centric workplace, I use task attachments heavily to store emails, design documents, and the like.  Especially with email attachments, I'll usually open up the task's attachment folder (C-c C-a f) and simply drag the relevant emails to the folder (which conveniently also copies all of its attachments :)).

Since Org isn't the one adding attachments, the ATTACH tag is often missing.  As I move around attachments and tasks, I'll also move their attachments appropriately, sometimes emptying the folder.  This causes ATTACH to become a false-positive.

Is there any way I can synchronize the presence of the ATTACH tag with the presence of actual attachments?  As an added bonus, can I also update the :Attachments: property with the appropriate file list?  (It helps with searching.)


texts: Org-mode: different key bindings for different types of code blocks

texts:
Is is possible to define key bindings for org-mode that:

Only work inside code blocks;
Are specific to the programming language of the code block.

For example: if my source code block is for Python, then C-c C-a runs a function that formats python code (like python black), but if the code block is for R, then C-c C-a runs a function that formats R code (like styler). If I am outside a source code block C-c C-a does not do anything.


texts: When using keybindings a capital letter is assumed by Aquamacs

texts:
I have an issue with Aquamacs. When press something like C-c a t (= org-todo-list in org-mode) the minibuffer shows an error message that there is no keybinding for ^C A, despite Shift is neither pressed nor locked. I tried this with various other keybindings, yet to no avail.

Any ideas?


texts: How to prevent Emacs from creating two windows on startup Windows 10?

texts: When I start Emacs not from the command line on Windows 10 it creates two windows, not one. Is there any way to make the blue window go away? I usually needs 4-5 instances of Emacs running so it clutters up my set up. And No, I, unfortunately, cannot use Linux.


texts: Auctex freezes when editing an equation containing '' at the end of a long document

texts:
Whenever I edit a particularly long document (thousands of lines) with auctex, I start getting freezes when I edit a math equation that contains a double prime '' far down in the document. My guess (based also on what gdb told me) is that auctex tries to look for the two (non-existent) `` that would make the start of a quote to fontify the whole thing. Each keystroke literally takes more than ten seconds to process inside such equations.
This behavior is present in the latest version of auctex (12.2.4). I don't think it happened before so this may be triggered by recent changes.
Is there something I can customize to stop this from happening?


texts: Automatically inserting an space when inserting a character depending on the previous character

texts:
Usually after inserting punctuation marks like . , : I make an space before inserting the next character.
Is it possible that Emacs automatically do this behavior? For example inserting something like .x results in typing . x where x is an arbitrary character (except for some particular cases excluded by the user for example the case where x is an space itself).

Sometimes this can help to speed up typing.


texts: equivalent of unix "which" for exec-path?

texts:
I am trying to debug some bizarre issues with my exec-path settings.

When I debug PATH in shell, the key tool is "which", which tells me the absolute path we resolve for a given binary, i.e.

(701) % which ifconfig
/sbin/ifconfig

Is there some equivalent to tell me, for example, what binary Tramp will get when it asks to execute "ssh"?


texts: Closing a repeated task once and for all doesn't work

texts:
According to the docs, C-- 1 C-c C-t aka org-todo with a negative prefix should close a repeated task once and for all. Unfortunately it just doesn't work for me. Any ideas what could be causing this or how I could close the task?

Alternatives seem to be to manually set the task to DONE, delete it, archive it, ... However, I would like to get my setup working :)

EDIT: By "it just doesn't work" I meant that the task is logged as done with the current time but is also rescheduled immediately, i.e. it's not fully closeable.


texts: get more fields with bibtex-completion-candidates

texts:
In Helm-bibtex the function bibtex-completion-candidatesretrieves selected fields (authors, editors, title, year, type, and key of the
entry) from the .bib file. Is there a way to make it retrieve additional fields (eg abstract or url fields) into the the second (alist) element?


texts: is there a way to get two separate next-error lists so I can bind them to two different keys

texts: I often have grep (technically rgrep) in a buffer/window and another buffer/window with a "compilation" of my active project in it.  I would like to bind two different keys (e.g. f2 and f3) to next-error and next-grep-hit and have them be independent.  Is there a package that does that?


texts: How to know the current configuration options of the running Emacs?

texts:
How can I know the current configuration options, like
with-cocoa, with-librsvg, with-modules(i.e. the options using when Emacs was built), of the running Emacs, programmatically?


texts:
I tried to install emacs and in an attempt to install MELPA, tried:

(this is my init.el file)

(package-initialize)
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))
(add-to-list 'package-archives '("melpa" . "http://melpa.milkbox.net/packages/"))

(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
                    (not (gnutls-available-p))))
       (proto (if no-ssl "http" "https")))
  (add-to-list 'package-archives
               (cons "melpa" (concat proto "://melpa.org/packages/")) t))
(package-initialize)

When I tried running the following commands
 M-x package-initialize then M-x package-refresh-contents, it said that it Failed to download 'gnu' archive. Is there anyway of getting around this?

I'm using MacOS and using emacs version 26.2.


texts: Assume I'm opening a new window with for example C-x 2 or C-x 3 then the buffer opens and I need to switch to it by hand with C-x o. Is there a build in solution to do this with one command? Or even modifying the above would be cool as well.


texts: Understanding elisp idiom(boolean values vs. quoted arguments)?

texts:
I have some basic questions about elisp.

I often see something like

(search-forward "something" nil 'noerror)

And sometimes I see something like

(search-forward "something" nil :noerror)

What is the difference and should I prefer one form over the other?

As far as I understand everything but the empty list evaluates to true in a boolean context. But how comes the following:

When the searchterm "something" does not exist in the buffer the point jumps to the end of the buffer when 'noerror is used instead of t. When t is used the point stays where it is.

First case:

(search-forward "something" nil 'noerror);; 1.Evaluate this

;; end of buffer 2.point jumps here

Second case:

(search-forward "something" nil t);; 1.Evaluate this, 2. Point stays here

;; end of buffer


texts: Capitalize word as you type in emacs/spacemacs (YAS snippet)

texts:
Trying the following yas snippet

# -*- mode: snippet -*-
#name : vuex-action
#key : va
# --
[${1:$$(capitalize-word yas-text)}]: ({ commit, dispatch, getters, }, { $2, }) => {
  commit($1, { $2, });
},

and get the following errors in messages buffer

Wrong type argument: stringp, (integerp #("H" 0 1 (fontified nil face (rainbow-delimiters-depth-1-face))))
Wrong type argument: stringp, (integerp #("HE" 0 2 (fontified nil)))
Wrong type argument: stringp, (integerp #("HEE" 0 3 (fontified nil)))
Wrong type argument: stringp, (integerp #("HE" 0 2 (fontified nil help-echo "Undeclared variable or function 'HEE'" cursor-sensor-functions (js2-echo-error))))
Wrong type argument: stringp, (integerp #("HEL" 0 3 (fontified nil help-echo "Undeclared variable or function 'HEE'" cursor-sensor-functions (js2-echo-error))))
Wrong type argument: stringp, (integerp #("HELL" 0 4 (fontified nil help-echo "Undeclared variable or function 'HEE'" cursor-sensor-functions (js2-echo-error))))
Wrong type argument: stringp, (integerp #("HELLO" 0 5 (fontified nil help-echo "Undeclared variable or function 'HEE'" cursor-sensor-functions (js2-echo-error))))
Wrong type argument: stringp, (integerp #("HELLO_" 0 6 (fontified nil help-echo "Undeclared variable or function 'HEE'" cursor-sensor-functions (js2-echo-error))))
Wrong type argument: stringp, (integerp #("HELLO_W" 0 7 (fontified nil help-echo "Undeclared variable or function 'HEE'" cursor-sensor-functions (js2-echo-error))))
Wrong type argument: stringp, (integerp #("HELLO_WR" 0 8 (fontified nil help-echo "Undeclared variable or function 'HEE'" cursor-sensor-functions (js2-echo-error))))
Wrong type argument: stringp, (integerp #("HELLO_W" 0 7 (fontified nil help-echo "Undeclared variable or function 'HELLO_WR'" cursor-sensor-functions (js2-echo-error))))
Wrong type argument: stringp, (integerp #("HELLO_WO" 0 8 (fontified nil help-echo "Undeclared variable or function 'HELLO_WR'" cursor-sensor-functions (js2-echo-error))))
Wrong type argument: stringp, (integerp #("HELLO_WOR" 0 9 (fontified nil help-echo "Undeclared variable or function 'HELLO_WR'" cursor-sensor-functions (js2-echo-error))))
Wrong type argument: stringp, (integerp #("HELLO_WORL" 0 10 (fontified nil help-echo "Undeclared variable or function 'HELLO_WR'" cursor-sensor-functions (js2-echo-error))))
Wrong type argument: stringp, (integerp #("HELLO_WORLD" 0 11 (fontified nil help-echo "Undeclared variable or function 'HELLO_WR'" cursor-sensor-functions (js2-echo-error))))
Quit [4 times]

1. How to fix?

2. Also how to replace space with the underscore in the word as you type?


texts: Using Emacs/Org to Create a Tagged, Searchable Collection with Images

texts:
Background

After exiting the Linux world for a few years to do the gaming PC thing, I have recently come back to the fold. For the most part, the transition has been easy, but there's one 'tool' I'm having problem replacing: Evernote.

As some of you may know, Evernote does not provide an official client for Linux, and the unofficial alternatives are... Pretty lacking. Currently, I have a pretty sweet setup when it comes to writing notes to Evernote in the form of Sublime Text + the Evernote plugin, but when it comes to viewing notes I'm stuck with the not-very-good web client. For that reason, I'm investigating Emacs + Org mode as a replacement.

I should also note that I'm not a total newcomer to Emacs. In fact, back before I switched to Windows I was one of those guys who was using Emacs for everything from note-taking and writing LaTeX documents to listening to music and emailing. That being said, I never figured out a way to do the one thing I do a lot in Evernote, and which is trivially easy on that platform, but not so easy in Emacs/Org: building up large collections of tagged, searchable notes with lots of images.

To give an example, I have a collection of favourite female actresses, musicians, models, and so on. Each of these is a single note with an image and one or more tags depending on the occupation of the persion in question, so that I can quickly view, say, actresses who are also singers:

I have similarly-structured collections for movies/tv shows, videogames, and books. All of these are quite large, and that's one of the areas where I begin to run into problems with Emacs and Org-mode.

For instance, I attempted to somewhat-replicate the above collection using a single Org file; the plan being to sift through said file using agenda views and tags/keywords. I created a directory for this agenda file to live, as well as the necessary image files, but this was about as far as I got before realizing that it was going to take me forever to select the images I wanted to use, copy each one into the folder, set the attribute to scale the image to a reasonable size, and then link the image itself---which I have to do manually at my current level of knowledge, otherwise Org opts for an absolute link that will present problems when viewing the file in clients on other machines from the synced folder (I'm using SpiderOak):

Other options I have looked at include Bookmarks+ and Image-dired. In fact, I remember using Bookmarks+ as a collection manager back when I was an Emacs obsessive, and am still referenced on the Emacswiki for the my somewhat-novel use of that particular plugin. The limitation I ran into then as now, though, is that Bookmarks+ doesn't do thumbnails, and I like to be able to 'see' and then read, instead of the other way around, if that makes sense.

Image-dired, on the other hand, does image thumbnails, and even supports tags, but I don't know of any way to 'save' certain tag views, and the process of marking/unmarking and then viewing is somewhat clunky compared to searching in Evernote or agenda views in Org-mode.

Question

So I know what I want to accomplish in Emacs is possible, but I'm uncertain as to whether it can be accomplished efficiently given the size of the collection/library I'll end up having. Is there an easy, relatively-straightforward-to-implement way of creating image-rich, tagged entities in Emacs which can be searched and sorted, and which would also be the sort of thing you could put in a sync folder without breakage occuring?

Also note that if you think there would be another application more suited for what I'm trying to do (yes, I know it's heresy to even entertain the notion that something should be done outside of Emacs), then I am definitely open to suggestions.

Oh, and if it's relevant, I'm using Spacemacs.


texts:
I am relatively new to emacs. I am looking for a way to do the "exact match" type of interactive search. For example, search string "abcDEF" in following text should only match with line1's text:

line1->   sometext_followed_by_space abcDEF sometext_preceded_by_space
line2->   sometext_followed_by_space .abcDEF sometext_preceded_by_space
line3->   sometext_followed_by_space abcdef sometext_preceded_by_space


texts: does this routine exist? until (while until true)

texts:
I found myself needing this control loop and was very surprised not to find it in the standard library. Does it exist by some other name?

(defmacro until (form &optional guard)
  "Runs `while' on FORM until it is non-nil, returning the value.

A guard is provided which may cause the loop to exit early with nil."
  (let ((res (gensym "res")))
    `(let (,res)
       (while (and (not ,guard)
                   (not (setq ,res ,form))))
       ,res)))


texts: Closing flyspell correction suggestions popup

texts:
If I goto correct a word with flyspell-correct-at-point, a word suggestion box will appear, as expected. Unfortunately I cannot close this suggestion box with escape I have to use C-g.

Any ideas on how to fix this behaviour ?


texts: My code for streching text lines collapses any org-mode headline in a buffer. How to avoid it?

texts:
I have a code for changing a paragraph of auto filled text into a paragraph with one sentence per line, where each sentence stretches out in its full length. This code is perfect when composing and analyzing prose.

However, the code has one annoying and unintended side effect if I use it with org-mode. If my text has any starred headlines, these will collapses when I use the code. Then I loose track of where my writing point is.

The code is attached below. I am grateful for any help removing this side effect.

(defun myfun-split-para-at-sentence-ends ()
  "Split current paragraph into lines with one sentence each.
Then turn off `auto-fill-mode'."
  (interactive)
  (let ((mode  major-mode))
    (unwind-protect
         (progn (text-mode)
                (save-excursion
                  (let ((emacs-lisp-docstring-fill-column  t)
                        (fill-column                       (point-max)))
                    (fill-paragraph))
                  (let ((bop  (progn (backward-paragraph) (point)))
                        (eop  (progn (forward-paragraph)  (point))))
                    (goto-char bop)
                    (while (< (point) eop)
                      (forward-sentence)
                      (delete-horizontal-space)
                      (insert "\n")))))
      (funcall mode)))
  (auto-fill-mode -1))

(define-minor-mode split-para-mode
    "Toggle between a filled paragraph and one split into sentences."
  nil nil nil
  (if (not split-para-mode)
      (myfun-split-para-at-sentence-ends)
    (auto-fill-mode 1)
    (fill-paragraph)))
(global-set-key "\C-s" 'split-para-mode)


texts: Reset custom variable to default value programmatically

texts:
Q: Using Elisp, how can I reset a variable to its default value without knowing what that value is?

I tried to figure out how to do this by bringing up the Customize interface for a variable I set to a non-default value in my init-file and pressing C-h k followed by a click on the "Revert..." button. That brought up the documentation for widget-button-click, which obviously didn't help much. (Similarly, C-h k RET with point on the button shows help for Custom-newline, which is also not what I am looking for.)


texts: How to update an org parent header's checkboxes count automatically?

texts:
I want to update an org-mode checkbox total count automatically.  For example, if I have this:

* TODO Parent task [0/2] ;; I have 0/2
** TODO Children1
** TODO Children2

And then, if I add a third task, the parent task checkbox should be changed automatically to 3.

* TODO Parent task [0/3] ;; now I have 0/3
** TODO Children1
** TODO Children2
** TODO New

The same way, if I remove any task, the parent checkbox should immediately change to [0/2].

How do I do this?


texts: Keybinding conditional on cursor location?

texts:
How do I bind a key to do one thing at the beginning of the line, and another thing everywhere else?

I would like to ask about the possibility that pressing the <home> key when the cursor is at the beginning of the current line, results in the execution of a certain function or command (say myfunction1) and otherwise results in the execution of other function or command (say myfunction2).


texts:
When using predictive-mode, the following error often pops up:

  Error running timer `completion-ui-auto-show': (error "Keyword argument :face not one of (:point :around :width :height :min-height :max-width :truncate :margin :margin-left :margin-right :scroll-bar :parent :parent-offset :nowait :nostrip :prompt)")

I removed all other extensions, removed custom Emacs settings and only left predictive mode turned on, this problem still persists. What can I do about it?

EDIT It turned out that predictive mode also includes a "popup.el" itself, while I also installed the auto-complete popup.el, which conflict with each other. Is there any way to resolve the conflict?


texts: use-package syntax: how to set-face-attribute?

texts:
I'm trying to set helm using use-package. The set-face-atttribute doesn't work within use-package:

(use-package helm-config
      :config
      (progn
        (helm-mode 1)
        ;; other config ...
        (set-face-attribute 'helm-selection nil
                    :background "purple"
                    :foreground "black")))

However, it works well outside the use-package. It is quite neat to put all the config of a specific package together. So how to set face in use-package?


texts: org-mind-map unable to find flatten and dot command

texts:
I get the following error when running org-mind-map.

Paths the each are as follows:

$ which unflatten
/usr/local/bin/unflatten

$ which dot
/usr/local/bin/dot

How to tell org-mind-map to access them at these places?


texts: In Dired, I'm able to drill down folders with the key i, but how can I unfold a folder that was once opened, that is, go to its parent folder?


texts: .bash_profile or .bashrc for shell in emacs?

texts:
I wrote an alias for a huge command and stored it in .bash_profile and to my surprise, emacs didn't pick up the alias that I wrote in .bash_profile. After some searching in the internet, I created a .bashrc file in my $HOME with the alias command and only after that emacs picked up the alias. I'm confused because terminal.app takes alias from .bash_profile but emacs takes alias only in .bashrc.

I was running M-x shell and I'm on macOS. Can someone explain me what's the relationship with emacs and .bashrc & .bash_profile.

More to the point, how can I get Emacs to read my .bash_profile in addition to .bashrc?


texts: How to close the current frame automatically after aborting the commit

texts: For editing messages, Magit opens a frame. It disappears if I finish the editing session, but it stays if I choose to cancel the session. In the latter case, I have to manually close the frame. So I wonder if there is a config variable to close the editing frame automatically.


texts: How can magit 2.x "git rebase --interactive master" from my branch dev-feature-1?

texts:
In 1.x magit I often would rebase my local branch to master, the equivalent of:

git checkout master
git pull --rebase
git checkout dev-feature-1
git rebase --interactive master

In 1.x magit this was super fast and simple:

b b master
F F
b b dev-feature-1
E

In 2.x magit it seems like this "rebase to another branch" functionality is gone, or very difficult to find? I read through the magit doc section on rebasing and it seems to assume the only place to rebase to is your currently set upstream. I don't want my upstream to change, it should remain origin/dev-feature-1, I just need to rebase -i against master to get my branch up-to-date.

Has this functionality been removed from magit, or is it called something else now? Maybe there are just more steps that make this formerly simple/frequent operation more complex and slow? Or maybe I'm just missing how to do it in my quick read of the docs?


texts: How to fix the error "Executable "zip" needed for creating OpenDocument files" when exporting Org mode document to OpenOffice?

texts:
When I try to export an Org mode document to OpenOffice Document format, I get the following error:

This answer suggested to use 7zip. So I

installed 7zip,
copied 7z.exe and renamed the copy to zip.exe, and
added the path of 7zip (C:\Program Files\7-Zip) to exec-path (via M-x customize-variable RET exec-path RET).

But when I try to export my Org mode file to ODT with this setup, I get an error Incorrect command line, probably because 7zip uses different command line arguments than the zip program Org mode expects.

How can I fix this?


texts: What tools can help make the emacs debug output more readable?

texts:
I was expecting to find tools I can use to to e.g. prettify the stack trace, or e.g. show all variables that are bound at each level of the stack trace as you navigate, but haven't found anything. Do any tools to improve the debugging experience exist?

No hits on melpa: https://melpa.org/#/?q=debug%20elisp


texts: How to describe a key sequence that starts with `C-u`?

texts: I am trying to use C-h k to describe the function to which a key is bound. But when I use it with a key chord like C-u C-e C-x it retrieves the documentation for C-u before I can finish typing the chord. What is the correct way to describe this type of chord?


texts:
I want to customize mode-line-format using if or cond etc., to let it show different text conditionally.

Here is a demo that I tried:

(setq-default
 mode-line-format
 (quote
  (
   (:eval
    (cond
     (buffer-read-only
      (propertize " ⚑ "
                  'face (:foreground "red" :weight 'bold)
                  'help-echo "buffer is read-only!!!"))
     ;; (overwrite-mode
     ;;  (propertize "??"))
     (buffer-modified-p
      (propertize " ☡ "
                  'face (:foreground "orange")
                  'help-echo "buffer modified."))
     ))

   (:eval (if (or (eq (buffer-local-value 'major-mode (current-buffer)) 'ruby-mode)
                 (eq (buffer-local-value 'major-mode (current-buffer)) 'enh-ruby-mode))
              (:propertize "Ruby"
                           face (:foreground "green"))
            (:propertize "Not Ruby"
                         face (:foreground "orange"))))
   )))

But it does not show anything, I don't know where is wrong. Need help.

BTW:

I googled this, And got two good results:

http://amitp.blogspot.com/2011/08/emacs-custom-mode-line.html
http://emacs-fu.blogspot.com/2011/08/customizing-mode-line.html

And I saw two different code:

(setq-default
 mode-line-format
 '(
   (:propertize var
                'face (:foreground "green"))
   ))

(setq-default
 mode-line-format
 (list
   '(:eval (if ...))
   ))

I don't know what's the difference.

---------------- UPDATE ---------------------

I found I can't put multiple (propertize ...) in one (progn ...).
Is there any solution to solve this?

(setq-default
 mode-line-format
'(
  (:eval
    (if (memq (buffer-local-value 'major-mode (current-buffer))
              '(ruby-mode enh-ruby-mode))
        (progn
          (propertize " ("
                      'face '(:foreground "#444444"))
          (propertize "Ruby: "
                      'face '(:family "Segoe Print"
                                      :height 80
                                      :foreground "red2"))
          (propertize (rbenv--active-ruby-version) ; `rbenv--modestring'
                      'face '(:foreground "cyan")
                      'help-echo '(concat "\nCurrent Ruby version: " (rbenv--active-ruby-version)
                                          "\nmouse-1: switch Ruby version menu")
                      ;; 'local-map
                      )
          (propertize ")"
                      'face '(:foreground "#444444"))
          )
      ;; (propertize "Not Ruby"
      ;;             'face '(:foreground "red2"))
      ))
))

This is solved, use (list (propertize ...) (propertize ...).


texts: The text that is displayed in my mini buffer is misaligned, like this https://imgur.com/a/htfRVI3 Specially all the columns are garbled, like its trying to wrap text? How can I make it so that they are aligned properly?


texts: Executing multiple replacement regexps against a string

texts:
I wanted to write a function that "auto-corrects" a string, based on a list of regular expressions and their respective replacements.

I've come up with this, and it works:

(setq auto-corrections-dictionary
  [
   [ "cat" "lion"]
   [ "horse" "zebra" ]
  ])

(defun auto-correct (string)
  (interactive)
  (car (last (mapcar
               (lambda (regexp-replacement-pair)
                 (setq string
                   (replace-regexp-in-string
                     (aref regexp-replacement-pair 0)
                     (aref regexp-replacement-pair 1)
                     string)))
                 auto-corrections-dictionary))))

(auto-correct "The cat chased the horse.")
    => "The lion chased the zebra."

Since I'm brand new to Emacs and Lisp, I have a couple of questions:

string is the function's argument. Within mapcar's lambda function I repeatedly set the value of string to the latest auto-corrected string, so that I don't lose any previous replacements. Is that the correct pattern? Is there a more "Lisp-y" way to do that?
mapcar returns a list of strings, with one element for each consecutive replacement. I'm only interested in the last element, which is the final result of the function. However, this seems wasteful when I think of memory use and (possibly) performance. Should I be concerned? Should I have used something else instead of mapcar?
Any other comments along the lines of "nah, here's how to do it properly..."?
Finally: is there a builtin function I could have used instead of writing my function? ;)


texts: How to make a graphical frame when no other graphical frames are present?

texts:
One way would be to somehow guess a display and do (make-frame-on-display display). However, (getenv "DISPLAY") does not give a sensible answer (e.g ":" or nil).
I tried to explicitly specify window-system but that also does not work without knowing a display.
One use-case would be to make a togglable persistent emacs frame available on a key press.


texts: Projectile does not show all files in project

texts:
After visiting a file that is part of a git repository, Projectile acknowledges the existence of my git repository as a project, but it only lists one file (the current file) as being part of the project.  As I visit other files in the project, they become part of the project one at a time.
How do I create projects in Projectile so that they are immediately aware of all files in the project?
All of the tutorials that I have found so far assume that you are visiting a file within an existing project, and that Projectile knows what files that project contains.

Update
When I set up Projectile I took the following suggestion in the Projectile documentation:

Caching
Since indexing a big project is not exactly quick (especially in Emacs
Lisp), Projectile supports caching of the project's files. The caching
is enabled by default whenever native indexing is enabled.
To enable caching unconditionally use this snippet of code:
(setq projectile-enable-caching t)

Since I will occasionally be navigating some large projects, I added this to my init file hoping that it would give me a performance boost.  I do not know how Projectile manages its caching, but at the time I assumed that the first time I visited a project, the project tree would be explored, and the cache would be populated with all of the project files. It appears that my assumption was wrong.
After I set projectile-enable-caching to nil, Projectile was able to find all of the files in my project.  Thanks to alexurba's answer and follow-up comments, I was able to find the problem.


texts:
Is there a convenient way to search through a C/++ codebase and list all the functions with matching type signatures?

I'm working in a codebase that makes heavy use of function pointers.  Conveniently when they're called, they're matched against a typedef that has a particular argument signature.  If I know the name or symbol of the function being called I can use GTAGS to jump to it, or run semantic searches to find references to it.

However I'd like to find all functions that share a type signature for the purposes of inlining these function pointer calls.  Is there a handy trick for that or am I likely going to need to do a regex search?


texts:
Calendar (invoked by M-x calendar) has diary integration feature.
By this, one can view any special date on the calendar buffer (the day will be colored if there is diary entry for that day),
and view the day's detailed entry by d.

Since org-mode also has feature of timestamp, integrating it to the calendar, just like the diary entry, would be nice.
It doesn't necessarily be integration with calendar, but somthing that enables view of dates as in calendar format and then open the detailed date view from that calendar.

Question: is there such feature?


texts: Resize inline images in org-mode to be fit a max size

texts:
In org mode, I am trying to resize inline images to fit a 100px x 100px square, which would be particular useful in the cases in which an image is much taller that wider, or vice versa. In other words I would like the resized image to be contained in 100px x 100px square, and to be with at least one side of 100px.
I am using the following code:
#+STARTUP: showall
#+STARTUP: inlineimages
#+TAGS: HOUSE(h)

* section 1
  - my org file

;; Local Variables:
;; eval: (setq org-image-actual-width 100)
;; eval: (setq org-image-actual-height 100)
;; eval: (org-display-inline-images t t)
;; End:

But it does not work, in the sense that the width is set to 100px, but the height is not taken into account.
How can I obtain the behavior I am seeking?


texts:
Is there a way to treat an inline picture (a link rendered as an image) as one character in org table?

When I align an org table that has a small image in a field, the alignment gets really messy, since the link of that tiny picture is actually really long.

Let's say the "o" below is a tiny picture of an apple. The alignment gets weird like this:

|----------------------------------------------------------------+-------|
| o | apple |
|                                                                |       |


texts: .emacs setq sets a wrong path for a variable

texts:
I put the following in my .emacs file to make sure that the "run-python" variable maps to the right path:

(setq python-shell-interpreter "C:\\Users\\xxxx\\python.exe")

When I restart emacs and do M-x run-python; it I get the following error:

apply: Searching for program: no such file or directory, c\:/Users/xxxx/python.exe

I don't understand why emacs puts "c:/" instead of "c:\" and I assume that is why it cannot find the python's interpreter's path. Am I missing something?

UPDATE: The following works:
C-u M-x run-python RET "python" -i

Make sure you don't put 'python'; and actually use quotation marks like ".


texts: how do you disable all keybinding for a package?

texts:
Sometimes, packages override a whole host of existing keybindings from other packages. The keybindings get associated with infrequently used functions, so I don't even want to rebind them. This is a frequent occurrence. For example, I just installed a package called olivetti-mode (which just centers buffer text), which took over a bind of factory keybindings from ref-tex and org.
Is there a way to just disable all of the keybinding for an entire package?

usepackage (which I have installed) has :bind directive. Maybe it's possible to use that somehow.


texts: How can I stop my scrollbar "bouncing" into and out of existence

texts:
I just installed Spacemacs on a new Mac and am getting some weird behavior—the scroll bar appears when I scroll (making the window wider), then disappears when I stop scrolling. This doesn't happen on my other MacBook so I'm not sure exactly what's going on.

Basic things I've tried to see where the issue might be:

This happens on the emacs included in brew-cask and on emacs-plus, so it's not build-specific

This doesn't happen if I move ~/.emacs.d so I'm just on a vanilla emacs install. With scroll bars enabled, they stay, with them disabled, they stay gone. So something in the Spacemacs config is triggering this.

Wondering if anybody has a clue what the issue is here.


texts: Listing SCHEDULED headlines from an org file ordered by date

texts:
A few months ago, I converted my init file into an org file, and I’ve
since been using it as a way to organize my blog posts.
I won’t go into too much detail here, suffice to say that this is a huge
org-mode buffer, where many headlines have a SCHEDULED date.

How can I list all SCHEDULED headlines in this file, sorted by date?

All I care to see is the date, todo status, and title. Anything else is superfluous.
Other important requirements:

Do not ommit headlines marked as DONE.
List only SCHEDULED items. I don’t want to see headlines
that just happen to have a date (<2014-10-04 Sat>) in them.
Only use this file. Do not search through all my agenda files.

For clarity, take the following file.

* DONE Hi guys
  CLOSED: [2014-10-04 Sat 15:18] SCHEDULED: <2014-10-04 Sat>
* Hello me
** Hello everyone <2014-10-05 Sun>
** TODO The world is at my feet
   SCHEDULED: <2014-10-11 Sat>

I’d like to run a command which would display a list something like this:

<2014-10-04 Sat> DONE Hi guys
<2014-10-11 Sat> TODO The world is at my feet

Of course, I’m not picky about the format. The important thing is to
have this information displayed in a convenient way.

My gut tells me this has something to do with org-agenda, but I’m
not sure how to get there.


texts: How to overwrite defconst/defcustom value in init file, tabbar arrow button image for example

texts:
I was trying to change defconst value for a tabbar image, the following lines are defined in tabbar.el:

(defconst tabbar-scroll-left-button-enabled-image
  '((:type pbm :data "\
P2 13 13 255 255 255 255 255 255 255 255 255 255 255 255 255 255 255
255 255 255 255 255 255 255 255 128 16 48 255 255 255 255 255 255 255
255 144 28 86 128 0 255 255 255 255 255 255 160 44 92 159 135 113 0
255 255 255 255 160 44 97 165 144 129 120 117 0 255 255 176 44 98 175
174 146 127 126 127 128 0 255 255 0 160 184 156 143 136 134 135 137
138 0 255 255 176 32 67 144 146 144 145 146 148 149 0 255 255 255 255
160 42 75 140 154 158 159 160 0 255 255 255 255 255 255 160 40 74 154
170 171 0 255 255 255 255 255 255 255 255 160 41 82 163 0 255 255 255
255 255 255 255 255 255 255 160 32 48 255 255 255 255 255 255 255 255
255 255 255 255 255 255
"))
  "Default image for the enabled scroll left button.
A disabled button image will be automatically build from it.")

So first I put the following lines in my init file but it is not working, but they works if I do replace in the original file tabbar.el:

(defconst tabbar-scroll-left-button-enabled-image
  '((:type png :file "~/.emacs.d/new-scroll-left.png" :ascent center))
  "Default image for the enabled scroll right button.
A disabled button image will be automatically build from it.")

Since I still want to redefine the image in my init file not modify tabbar.el directly, then I tried to append the defcustom found in tabbar.el calling tabbar-scroll-left-button-enabled-image also in the init file:

(defcustom tabbar-scroll-left-button
  (cons (cons " <" tabbar-scroll-left-button-enabled-image)
        (cons " =" nil))
  "The scroll left button.
The variable `tabbar-button-widget' gives details on this widget."
  :group 'tabbar
  :type tabbar-button-widget
  :set '(lambda (variable value)
          (custom-set-default variable value)
          ;; Schedule refresh of button value.
          (setq tabbar-scroll-left-button-value nil)))

And I found no other functions are calling this defcustom in tabbar.el. However so far it is still not working. Anyone who is familar with tabbar loading its images can possibly help to explain a little bit?


texts:
In visual studio,  there is a very convenient line with + and - to show the code which blocks it belongs to.
I was wondering if there was the same function in emacs.

,


texts: org-capture templates: how to fetch name of file during capture-template creation to be used as variable

texts:
I aim to replace "* TODO" with "* %name of the file I am creating".
Is this possible?
This is my code for the capture template:
I would like the * TODO be replaces by the name specified in %s-%s.txt (without the extension).
(defun capture-report-date-file (path)
  (let ((name (read-string "Name: ")))
    (expand-file-name (format "%s-%s.txt"
                              (format-time-string "%Y-%m-%d")
                              name) path)))

(setq org-capture-templates
      '(("t"
         "todo"
         entry
(lambda () (capture-report-date-file  "~/path/path/name"))
         "* TODO")))


texts: How to combine maxima-mode with *imaxima*?

texts:
How can I setup emacs to evaluate maxima code from a buffer in maxima-mode in the *imaxima* buffer rather than the default *maxima* one?

While I can copy and paste the code between buffers, I'm afraid of crashing emacs since my natural use of emacs makes extensive use of frames.

I've tried setting:

(setq imaxima-use-maxima-mode-flag t)

following this email thread but that only made (imaxima) start a normal *maxima* repl.


texts:
I've got code that needs python 2.7 (and other environments)

C:\Users\Me>conda info -e
# conda environments:
#
base                  *  C:\Program Files\Anaconda3
python2                  C:\Program Files\Anaconda3\envs\python2

I would like to be able to selectively activate python2 when I start a python shell in emacs (i.e. I send a line of code to the python interpreter using elpy). being able to put this in an init file would be cool.

I have tried both the conda and pyenv packages with no luck in my current configuration. Conda can't find my environments and pyenv doesn't seem to actually activate the virtual environment.

Using Emacs 26.1 and conda 4.5.11

Any help would be appreciated.


texts: helm, case sensitive search for lower case search

texts:
helm-case-fold-search is smart

  Documentation: Adds ’smart’ option to ‘case-fold-search’. Smart option
  ignores case for searches as long as there are no upper case
  characters in the pattern.

How to search lowercase? I guess I could do that by changing the helm-case-fold-search but then I'd have to keep changing the variable with elisp.. Is there an interactive way of doing it?


texts: Update buffer status in tabbar after saving and auto-compiling LaTeX file

texts:
I have customized tabbar to have a custom face for tabbar-selected-modified. The customizations work nicely for displaying the "modified" status of a buffer, and reverts to the default face when the buffer is saved.

I am now trying to extend after-save-hook to automatically compile LaTeX files on save. This also works correctly. But the problem is that the tabbar status (which was "modified" before I saved the buffer) for the buffer does not change back to the default (i.e., the buffer is saved) face.

Here is the code snippet that can be used to reproduce the problem.

(require 'package)
(setq package-user-dir (expand-file-name "~/.emacs.d/elpa/")
      package-enable-at-startup nil)
(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/") t)
(package-initialize)

(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))
(eval-when-compile
  (require 'use-package))

(use-package tabbar
  :ensure t
  :preface
  (defun tabbar-modification-state-change ()
    (tabbar-set-template tabbar-current-tabset nil)
    (tabbar-display-update))

  (defun tabbar-on-buffer-modification ()
    (set-buffer-modified-p t)
    (tabbar-modification-state-change))
  :init (tabbar-mode 1)
  :config
  (add-hook 'after-save-hook #'tabbar-modification-state-change)
  (add-hook 'after-revert-hook #'tabbar-modification-state-change)
  (add-hook 'first-change-hook #'tabbar-on-buffer-modification)

  (set-face-attribute 'tabbar-selected-modified nil
                      :background "#f2f2f6"
                      :foreground "dark green"
                      :box '(:line-width 1 :color "black" :style sunken)
                      :height 1.3
                      :bold t
                      :underline nil))

(use-package tex-site ; Initialize auctex
  :ensure auctex
  :mode ("\\.tex\\'" . LaTeX-mode))

(use-package tex-buf ; Requires tex and latex
  :config
  (setq TeX-auto-save t ; Enable parse on save, stores parsed information in an "auto" directory
        TeX-save-query nil)
  (setq-default TeX-master nil))

(use-package tex-mode
  :init (setq latex-run-command "latexmk"))

(use-package auctex-latexmk
  :ensure t
  :config
  (auctex-latexmk-setup)
  (add-hook 'LaTeX-mode-hook
            (lambda ()
              (setq TeX-command-default "LaTeXMk"))))

(add-hook 'after-save-hook
          (lambda ()
            (when (string= major-mode "latex-mode")
              (TeX-command-menu "LaTeXMk"))))

To reproduce the problem, start with emacs -Q, evaluate the snippet, then open a LaTeX file and modify the buffer. You will notice that the tabbar face will change. Then, save the buffer. This will also trigger LaTeX compilation (with latexmk in this example). So far so good. But the problem is that the tabbar face does not revert back to the default (i.e., saved) face/state.

I have tried calling tabbar-modification-state-change in after-save-hook, but that does not solve the problem.


texts:
I have a piece of code like this in yaml.

security_group_sig_egress_ipv6: "allowed_remote_sig_egress_ipv6"
security_group_sig_ingress_ipv6: "allowed_remote_sig_ingress_ipv6"
security_group_int_egress_ipv4: "allowed_remote_int_egress_ipv4"
security_group_int_ingress_ipv4: "allowed_remote_int_ingress_ipv4"
security_group_int_egress_ipv6: "allowed_remote_int_egress_ipv6"
security_group_int_ingress_ipv6: "allowed_remote_int_ingress_ipv6"
security_group_om_egress_ipv4: "allowed_remote_om_egress_ipv4"
security_group_om_ingress_ipv4: "allowed_remote_om_ingress_ipv4"
security_group_om_egress_ipv6: "allowed_remote_om_egress_ipv6"
security_group_om_ingress_ipv6: "allowed_remote_om_ingress_ipv6"

as you can see the ":" is the delimiter between the two expressions. I want to transpose/swap the "key:value" pair in following way for the entire rectangular region:

allowed_remotexxxx: "security_groupxxx"
allowed_remotexxxx: "security_groupxxx"
allowed_remotexxxx: "security_groupxxx"
allowed_remotexxxx: "security_groupxxx"

I can use Anchored Transpose to transpose each line separately but not the whole rectangular region. Is there a way in Emacs to achieve this with minimum keystrokes?


texts: How to make Dired sort on special characters in the beginning of file or folder names?

texts:
In Windows File Explorer (FE) I can give a file or folder a name with a special character as the first character, and thereby make them move on top when sorting the files alphabetically. For instance, in FE  the folder named .baby will be sorted above both of the folders atom and car, while in Dired .baby will be sorted between those two other folders, as if the character . is not seen by Dired.

How can I make Dired sort on special characters?


texts: How to define keys in evil mode command mode

texts:
I'm trying to create a shortcut in command mode. Basically, by typing  :bl, I want it to execute gud-break. I tried the following

(evil-define-key 'insert c-mode-map (kbd ":bl") 'gud-break)

However, it complains that bl is not defined. Is there something wrong in my key binding?


texts: How to use abbrev with different configuration for each mode?

texts: How can abbrev-mode be enabled per mode (so enable for org-mode and python-mode for example, but not other modes).And each mode use its own set of abbreviations?


texts: undo-tree: Persistent visibility of the undo visualization buffer

texts:
C-x u aka undo-tree-visualize enables a user visualize the undo tree history of a buffer.

I love undo tree, and I want to have it displayed all the time as a visual map of my changes. I would like it to always be there in a buffer, that is, always open and keeping track of whatever butter I am working in. Then, it will change in real time as I update a buffer (it already does this) but if I displayed the undo tree in its own window, I will see it change dynamically as I switch between buffers. I am relatively new to emacs and have no idea how to do this. Any pointers?


texts: Orgmode: agenda for headlines without any tag

texts:
Having 'org-agenda-files' set, is there a way to display headlines, which does not have any tags?

E.g 'C-c a' runs 'org-agenda', and then 'M' gives TODO items with specified tag. What if I want TODOs, which does not have any?


texts: How do I pick a date in my new major mode?

texts:
I want to insert a date in the current buffer.

I know the function calendar-cursor-to-date that when invoked gives back the date at which the cursor is.

But how do I get that info back into my program?

Here is what I've got so far:

(defun insert-new-entry ()
   (interactive)
   (save-excursion
      (goto-char (point-max))
      ;;next comes mostly pseudocode except *calendar-cursor-to-date*

      (calendar)
       (let ((x (bind-key (kdb "enter) 'calendar-mode calendar-cursor-to-date)))
            (insert x))))

So in english it's:

go to the last location in the buffer
open calendar
store in x whatever is returned where enter is pressed
insert it into buffer.

The problem is step 3. How do I store into x whatever is returned from calendar-cursor-to-date?

Thanks


texts:
Emacs has a really nice mode for applying and navigating hunks of a diff file: Diff-Mode

However, there doesn't seem to be a way to apply the full diff when in this mode. Is this just so obvious that I missed it?


texts:
I have a small snippet like this:

# -*- mode: snippet -*-
# name: options
# key: vop
# --
var options = {
    target:        '#$1',
    beforeSubmit:  showRequest,
    success:       showResponse
}$0

What I would like to do is to increment function name for each insertion. Like this:

var options1 = {
  target:        '#',
  beforeSubmit:  showRequest,
  success:       showResponse
}

var options2 = {
  target:        '#',
  beforeSubmit:  showRequest,
  success:       showResponse
}

etc... Is there a way to achieve this?


texts: assigning TODO status to specific list items (not headings)

texts:
What would be a way to achieve the following:

* interface A
** sample files
1 file "alpha"
2 file "beta"
    TODO fix missing tag
3 file "gamma"

E.g. I am trying to associate a TODO action with a specific list item as opposed to a heading. But it seems that only headings can be marked as TODO in org-mode. Should I use a checkbox instead given that it's suggested that they really are lightweight TODOs?


texts:
My yasnippet version is 0.8.0 and emacs is 25.0.50
I want to add a default value
And I use following code.

# -*- mode: snippet; require-final-newline: nil -*-
# name: matrix
# key: y_ma
# binding: direct-keybinding
# --

\left ${1:[}
\begin{array}{${3:ccc}}
    $0  \\
\end{array}
\right$2

But when I use this code
it shows directly

\left ${1:[}

Instead of

\left [

But if I change \begin{array}{${3:ccc}} into \begin{array}{${3:[}} for a test. It works


texts: Org mode #+PROPERTY: P_ALL Values doesn't work

texts:
I recently started using Org as my planner. While I was trying to setup PROPERTIES, I found the manual says:

  If you want to set properties that can be inherited by any entry in a file, use a line like:
  #+PROPERTY: NDisks_ALL 1 2 3 4

So I did something like:

#+PROPERTY: Effort_ALL 00:10 00:30 01:00

on the top of my org file.

Now when I go to one of the entries and hit C-c C-x e TAB, it tells me "No Match".
When I try to put in the Effort property first by C-c C-c p and then try to use S-TAB on the generated Effort property, it says "Allowed values for this property have not been defined", which obviously is saying that the #+PROPERTY line does not exist.

I can do lines like this without any issue. That is, there's auto-completion and I can do S-TAB to cycle through defined values.

   * CD collection
   :PROPERTIES:
   :NDisks_ALL:  1 2 3 4
   :Publisher_ALL: "Deutsche Grammophon" Philips EMI
   :END:

A bit background info:

Windows 10 pro

Emacs 26.2 (build 1, x86_64-w64-mingw32)

Using Org-Evil (turned it off but the problem still persisted)


texts: How to configure a command to open in same-window unless already open in active frame?

texts:
I can use display-buffer-alist to configure a command to open in the same window:

(add-to-list 'display-buffer-alist '("*grep*" display-buffer-same-window))

The problem in this case, however, is if I then open a result and subsequently run a new search without closing the original window, Emacs will open a second view of the search results in the current buffer.  That gives me two redundant views of the same results, which is obviously not my intention.

I would like this to be a bit smarter, in that if the buffer is already visible in the current frame, it should merely reuse it (or change focus to it), and display in the current window otherwise.

How can I achieve this behavior?


texts:
I'm trying to define a color set (from material color) in order to be able to easily change the set I want to use. I think I've managed to define them but then, I'm not able to use them properly. I guess the last line below is problematic (I got a wrong argument when evaluating it) but I'm not familiar enough with lisp to fix it.

;; Material colors from https://material.io/design/color/
(defconst deep-purple '((level-100  "#D1C4E9")
                        (level-200  "#B39DDB")
                        (level-300  "#9575CD")
                        (level-400  "#7E57C2")
                        (level-500  "#673AB7")
                        (level-600  "#5E35B1")
                        (level-700  "#512DA8")
                        (level-800  "#4527A0")
                        (level-900  "#311B92")
                        (level-A100 "#B388FF")
                        (level-A200 "#7C4DFF")
                        (level-A400 "#651FFF")
                        (level-A700 "#6200EA")))

;; Get a material color
(defun color (hue level)
  "Return the color from the given shade-list and specified shade."
  (cdr (assoc level hue)))

;; Define default hue
(defconst default-hue deep-purple)

;; Get some color
(defconst background-color (color default-hue 'level-700))

;; Problematic line
(set-face-attribute 'mode-line nil
                :weight 'regular
                :background background-color
                :box `(:line-width 1 :color background-color :style nil))


texts: Show blame information for a line from the *magit* buffer

texts:
There's a workflow I tend to do fairly often and I wonder if Magit could help me. I've made a bunch of git commits on a branch, I haven't pushed them yet, and I notice a small mistake in my unpushed work which I'd like to fix by amending the commit that introduced it rather than making a new commit.

I can use blame to find the offending commit, do an interactive rebase and edit the offending commit. But that's not always convenient. For example, if I run a validation process and find multiple minor issues, then I need to fix multiple commits. What I do is to make all the fixes, commit them separately, and then do an interactive rebase to apply them as fixups. (For the sake of this question, assume that this won't lead to a conflict.) So my workflow is, for each fix:

Stage the fix.
Use blame to locate the commit that needs to be amended. I do this from vc-annotate, because it shows me the commit ID for each line in a very handy way.
Commit the fix with the message fixup 1234567 where 1234567 is the commit ID.
Then I do an interactive rebase to apply the fixup NNNNNNN as fixups to their respective NNNNNNN.

Can Magit help me with step 2? I'm in the *magit* buffer, looking at a deleted or unchanged line, and I want the blame information for that line, i.e. the commit ID that introduced that line.

modified   myfile
@@ -1,3 +1,3
 foo
-bat               ←My cursor is here. What commit introduced `bat`?
+bar
 qux


texts:
I'm having an intermittent issue where Emacs appears to freeze. Pressing C-g eventually returns control of Emacs to me with the following message in the *Messages* buffer:

Waiting for process to die...done

How do I find out what process is hogging Emacs?


texts: Why do open buffers in orgmode show links?

texts:
Each open org-mode buffer on my laptop shows a link involving my internet provider, for example,

lrwxr-xr-x   1 peterkelly  staff    47 Jun 15 09:48 .#todo.org -> peterkelly@Peters-MBP.hsd1.ct.comcast.net.89840

Why are these links created?


texts:
EMMS shows only the playing time, not the track length, e.g.:
02:37         not
02:37/05:49.

The variable emms-playing-time-display-short-p has the correct value: nil.
My default player is mplayer, but I've tried also vlc. I never get the track length.

How can I get the format 'playing time/length' ( 02:37/05:49)?

My init.el has for EMMS just these lines of https://www.gnu.org/software/emms/manual/#Quickstart-Guide:

(add-to-list 'load-path "~/elisp/emms/lisp/")
(require 'emms-setup)
(emms-all)
(emms-default-players)


texts: Is there any way to abbreviate dired-header?

texts:
/home/farhad/phpPlay:
 controllers
 index.php

/home/farhad/phpPlay/controllers:
 index.php

In a dired-mode buffer like above I want to replace /home/farhad/ with ~. Is it possible?


texts: Emacs robe mode for ruby, why does it need to start the server?

texts:
I've only gotten into the ruby world on emacs, and I'm looking for a lot of the good stuff I normally get with rubymine like code completion and jumping into modules. I'm attempting to use robe with autocomplete for the most part.

Most robe stuff requires a server running which can be done by running robe-start. I may be doing things wrong but it appears the application has to be running and set-up completely to be even able to use the functionalities that robe offers. By set-up I mean, making sure configs are all set-up, gems have all been downloaded via bundler, rbenv is working correctly and whatnot.

I find it weird that to edit my code, a server has to be running the same code; code which can be broken at many points during my development. I'm not thinking of ruby debuggers yet so please don't go there yet. This brings me to my question, am I even looking at what robe can do correctly?

For some context, I come from the PHP world where I can generate phpctags and use ac-php to do all the same cool stuff, no servers and none of that stuff.

Enlighten this ruby emacs neophyte please.


texts:
I would like to have a single shortcut to jump to the next item on the imenu of current buffer.  E.g., if the current buffer is in org mode, next-imenu-item = org-next-visible-heading.

Anyone did that before?


texts: How to auto-compile LaTeX source file and auto-revert PDF output buffer

texts:
I am creating and editing latex source files using AUCTeX. When I use the associated command for compiling the source file (C-c C-a) the file is successfully compiled and the resulting PDF output is displayed in a buffer in a second window that is automatically opened within the current frame.

If I make changes to the LaTeX source file and compile again, these changes do not automatically update the buffer containing the PDF. To display these changes I need to switch to the PDF buffer and execute the "revert buffer" command.

I'm wondering if anyone can suggest some elisp code that I can put into my config file that will automatically compile my latex source file upon any modification which in turn will automatically activate the "revert buffer" command thereby automatically displaying the alterations to the latex source file in the PDF output.

I posted a related question a few days ago on this forum that can be found here which relates to automatically saving a buffer when modified.

I'm sure the elisp code I'm looking for is somewhat similar to the code suggested to me in the previous post but unfortunately I don't have enough experience with programming/elisp to alter this code to suit my needs.

*edit: the code for automatically saving a buffer when modified

(defun savebuf(begin end length)
  (if (and (buffer-file-name) (buffer-modified-p))
       (save-buffer)))
(add-hook 'after-change-functions 'savebuf)


texts: How do I get org-mode heading faces in helm

texts: When using commands like helm-in-buffer-headings, it would be much more readable to see output styled (and ideally even indented) like it is in the original document. Is there a way to do this?


texts:
I have the following line :

mod_name func_name /users/username/workspace/path_name/file.c 283

I wanted to capture the 3rd and 4th entry in this line, I am able
to do that using regular expressions like so:
^(?:\S+\s){2}(\S+)\ ([0-9]+)

How do I translate this into a lisp regex ? so that elisp functions can
understand. I couldn't use the above regex into re-builder within emacs. Says it is an invalid expression. What am I doing wrong ?