texts: Transform selected text like a Python macro

texts:
I've only just started with Emacs (about 6 weeks now) so I'm not really familiar with its coding language. I was wondering if it was possible to write, for Emacs, the equivalent of a Python macro I have in my Sublime Text setup.

In Sublime Text, I have a Python macro which can transform selected lines of text. If I select the lines

foo
bar
baz

and press my chosen shortcut C-l C-s the text is transformed to ['foo', 'bar', 'baz'].

I was wondering how to could do this for Emacs.


texts: Tramp mode is much slower than using terminal to ssh

texts:
I am using the Macports flavor of Emacs on OSX Yosemite, and have looked through every thread here on Tramp being slow without any solution.

Tramp is usable, but there is about a 100ms delay between every action. It's not a problem on the server's end because this delay does not exist if I just use terminal/iTerm to just ssh to the same server.

I thought maybe the problem was limited to editing files, but it turns out it's ubiquitous. Whether I'm using just a remote shell, or just pressing M-x (with helm) it's all delayed.

I've tried ssh, scp, and rsync as methods for connecting without any solution. Also have tried the ControlMaster auto without any effect.

Has anyone else had this problem, and was able to solve it?


texts:
How do you track down errors reported during the export process?  I am writing an Org document and exporting it to PDF. (I do not know LaTeX).

I was getting the following error: org-latex-compile: PDF file ./myfile.pdf wasn't produced: [undefined control sequence] [package error] Runaway argument. By trial and error, I narrowed it down to this section of the document:

* Prefix key
  * ~M-p~ (currently unassigned)
  * ~H-c~ (currently unassigned)
  * ~H-;~ (currently unassigned)

After much web searching, I discovered that a limitation of LaTeX is that verbatim text cannot be used in a subheading.  The LaTeX generated from the above snippet included lines like:

\subsubsection{\verb~M-p~ (currently unassigned)}

Changing the subheadings to an unordered list fixed the problem:

* Prefix key
  - ~M-p~ (currently unassigned)
  - ~H-c~ (currently unassigned)
  - ~H-;~ (currently unassigned)

because those generated lines looked more like this:

\item \verb~M-p~ (currently unassigned)

Now, finally, here is my question: Is there a better way of tracking down, diagnosing, and solving such errors than my trial-and-error-plus-web-search (short of, say, spending a few weeks learning LaTeX)?

Currently, my file produces a seemingly-fine PDF... but the export process does issue an error message: Process completed with errors: [package error].  I have no idea whether this is serious, whether it has affected my PDF output in a way that I haven't noticed yet, or if it's trivial and should be ignored. Any help is appreciated.


texts: Difference between pcase-let & cl-destructuring-bind?

texts:
I noticed both pcase-let and cl-destructuring-bind seem to perform the same operation.

Is there any difference or reason to use one instead of the other?

eg:

(pcase-let ((`(,filename ,buf) (pop filename-and-buffer-list)))
  ;; do stuff.
  )

Seems to behave the same as:

(cl-destructuring-bind (filename buf) (pop filename-and-buffer-list)
  ;; do stuff.
  )


texts: Org-mode export bullet as HTML into specific folder with extra exporting option

texts:
I would like to add a extra exporting option to my org-mode export dialog.
this option shall export the data as html to a specific folder.

I want to press C-c C-e to open my export dialog and then choose this extra option. I would also like to have it in a separat Category not within the "Export to HTML" category. In best case I would like to have a new Category with different options for different folders.


texts: conflicting libraries Autoloading failed to define function: problem sending mail with gnus

texts:
When I'm in gnus and type m
I got the following error
gnus-group-mail: Autoloading failed to define function gnus-nnir-group-p

I couldn't not find the function gnus-nnir-group-p

From this post , i tried M-x list-load-path-shadows and think I've found the culprit. I'm still trying to sort this out. Any idea?

/usr/share/emacs/site-lisp/gnus-bonus/spam-stat hides /usr/share/emacs/24.5/lisp/gnus/spam-stat
/usr/share/emacs/site-lisp/gnus-bonus/nnir hides /usr/share/emacs/24.5/lisp/gnus/nnir
/usr/share/emacs/site-lisp/gnus-bonus/nnnil hides /usr/share/emacs/24.5/lisp/gnus/nnnil


texts:
It's not clear to me how to disable a window scroll bar.

I have frame scrollbars turned off:

(scroll-bar-mode -1)

I can enable a window scroll bar with

(set-window-scroll-bars (selected-window) nil 'right)

I expect the following to remove the scroll bar, but it doesn't.  It only removes the fringe adjacent to the scroll bar.

(set-window-scroll-bars (selected-window) nil nil nil nil)

Checking (window-current-scroll-bars (selected-window)), it returns nil as expected.  My understanding is that window-current-scroll-bars should tell me the dimensions of the window's scroll bar, returning nil if there is no scroll bar.

Maybe it's a frame scroll bar that somehow snuck in?  Yet (frame-current-scroll-bars) returns nil as expected.

If I do something like C-h f or M-x after calling (set-window-scroll-bars (selected-window) nil nil nil nil), the scroll bar will disappear.  Yet simply switching windows does nothing.  The scroll bar remains.

I'm confused!  Am I missing something?

I am using GNU Emacs 26.1 (build 1, x86_64-w64-mingw32) of 2018-05-30.


texts:
There are some general well-known coding standards and styles for SQL (e.g. capitalizing reserved words, placing main keywords in different lines, etc.).

Does Emacs come with any modes for this, or are there any packages for formatting SQL to make it adhere to common standards?


texts: How can I automatically generate an index from headings in org-mode?

texts:
Let's say I have this:

* Title
** Subtitle 1
   some text
** Subtitle 2
*** Sub-Subtitle 1
    some text
*** Sub-Subtitle 2

How can I automatically generate an index with links to all those headings?


texts: I am trying to setup my init files, and want a special set of dimensions for my main Emacs window. If I place my window wherever I want it, is there a way of querying Emacs as to the main window dimensions? I.e., is there a way of querying the value of the top, left, width, and height values of the main window as it is currently placed?


texts: Multi-line echo area for displaying function signature with semantic-idle-summary-mode

texts:
Description

I've got some c-functions with long argument lists. Even if that is bad style I would like semantic-idle-summary-mode to help me with those bad style functions.

Pityingly it keeps the height of the echo area at one line even if the function signature does not fit into that area.

I would like the height of the echo area being adapted to the function signature.

As far as I understood the source code of semantics-idle-summary-mode it uses (parts of) eldoc-mode. Therefore I already tried to set eldoc-echo-area-use-multiline-p to t without any effect on semantic-idle-summary-mode.

Version information

Emacs: GNU Emacs 25.1.50.2 (i686-pc-linux-gnu, GTK+ Version 3.10.8) of 2016-04-25

semantic: version 2.2 shipping with emacs

Reproduction

start emacs -Q
Call M-x semantic-mode and switch on menu item Development->Show Tag Summaries
customize eldoc-echo-area-use-multiline-p to t
create new buffer with C-x C-f test.c (there is no need for saving this buffer as file)
paste the following c-code into that buffer:

#include <stdio.h>

void fun(int a, int function, int with, int many, int arguments, int that, int dont, int fit, int on, int one, int line) {
    printf("%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",a,function,with,many,arguments,that,dont,fit,on,one,line);
}

int main() {
    int a=1,function=2,with=3,many=4,arguments=5,that=6,dont=7,fit=8,on=9,one=10,line=11;
    fun(a,function,with,many,arguments,that,dont,fit,on,one,line);
    return 0;
}

adjust frame size such that the signature of fun is wrapped at the window edge
place point at the open parenthesis of the call of fun in main
the function signature in the echo area is truncated as shown in following Figure


texts: How to use helm to complete sources which are lines in a buffer?

texts:
I have a buffer (not a file) containing data. I would like a function that lets the user select 1 or more lines of this buffer, e.g., by typing a regexp, and that returns the result as a list of selected lines.

The result would be equivalent to a grep run within helm except that, as a result of validating the selection, I don't want to visit the matching lines but get them in a list.


texts: How can I slightly modify an emacs powerline theme?

texts:
The screenshot below is my current emacs powerline:

I'm pretty happy with the theme, but I'd like to slightly change the color of the text in the blue areas.

What can I put in my .emacs file to achieve this?


texts:
I'm using emacs inside a mintty (configured to say it's xterm-256color) terminal on cygwin. list-colors-display works fine. and colors are displayed in dired listings etc. Now I set the color for git branch current branch to be yellow reverse. However, neither shell nor eshell windows display the correct color; instead, the current branch is shown in default color. In an ansi-term window, or Outside of emacs, inside the same terminal, it displays as it should.

I have this in my .emacs:

(add-hook 'eshell-preoutput-filter-functions  'ansi-color-apply)

Any way to get these colors to display inside the shell or eshell windows?


texts: Why are threads not used much in emacs packages?

texts: Is there some drawback in their current implementation which makes using them less appealing?


texts: How can I select only the content of a @media in CSS with regexp in Emacs?

texts:
I am trying to select the content of @media in CSS with regexp in Emacs (elisp) to make a slight change in the color of the background or font, so I can easily see that I am editing inside of them.

I already came up with this regexp:

@media.*\{\\(.*[^]]*?\}\\)[ \t\n]*\}

And this is selecting the content most of the times, but I'm having a problem when I have comments or leading spaces after the last bracket before the closing bracket of the @media statement.

I want to match just the content inside every @media query brackets.

/*... css above*/
/*tablet*/
@media (max-width: 800px){
    ._desktop-only {display:none !important;}
    ._tablet-only {display:initial;}
    ._mobile-only {display:none;}
}
/*mobile*/
@media (max-width: 480px){
     ._desktop-only {display:none;}
     ._tablet-only {display:none !important;}
     ._mobile-only {display:initial;} /* comment */
}
/*more css below...*/

Some people might suggest that I should create separated files. I usually do that, but sometimes I have to edit the files as they are. And don't mind much the sample, because my goal is to edit large CSS files with a lot of statements inside of them, and I want to be able to see if I am editing the main statements or the variation of them.


texts: Inadvertent paste when correcting spelling mistakes using flyspell

texts:
When I click with the middle mouse button that usually inserts the primary selection at the point where I clicked.  However, the same button opens flyspell's context menu when I click on a misspelled word.  The problem is that when I use the context menu to, e.g., save a word to the dictionary, this also inserts the primary selection after the flyspell action is finished.  I thought that this problem may be due to a mess-up in my configuration but I can also reproduce this with emacs -Q.  How can I fix this?

Steps to reproduce:

Start emacs -Q.
Insert the following sentence (in the scratch buffer):

Here is a sentence with a mistaake.
M-x flyspell-buffer, the word mistaake is highlighted.
Double click on sentence to select it.
Click middle mouse button (mouse-2) on mistaake, choose the correct spelling mistake from the context memu.

Result: mistaake is replaced with missentecetake.

I found some really old bug reports that sound related (going back to 2005) but no working solution.


texts:
Windows has an environment variable HOME which is on a remote serve (say Y:/, set by administrator and suppose not to be changed) and I start Emacs on my local disk, say C:/. (Emacs becomes slow if I start from Y:/)

However .gitconfig file locates on Y:/ by default and magit cannot find it so I don't have the right settings for user name and emails, even if I move .gitconfig to C:/.

Is it possible to set magic and git settings independently or read .gitconfig from Y:/?

Magit version: Git 2.7.4.windows.1, Emacs 24.4.1, windows-nt


texts:
In a ruby project.
when point is at a ruby symbol, for example UserCart::PromotionService.new(blah blah
how can I jump to the definition of that class/module.


texts: Line numbering: stick with linum or nlinum?

texts:
I see that both linum and nlinum are actively maintained: one is built-in, another recently had a release.

With older Emacs version, linum used to be slow with a lot of folding in a buffer (e.g. in Org mode, and with hs-minor-mode in various source code modes). So I switched to nlinum.

Currently (on Emacs 15 and 26) I see that linum is sort of fast again, though maybe not always as smooth as nlinum.

Is there a reason why I should stick to one of them from maintainability POV? That is, does one of them obsolete, or is going to obsolete, another?


texts: Make multiple lines TODOs at once in org mode

texts:
I'm new to emacs and org-mode and this seems like it should be easy but I haven't been able to find an answer.

Let's say I'm typing a todo list in ~/my_todo.org and i type up something like this:

* item 1
* item 2
** item 2.1
** item 2.2
* item 3

and now I want to make all of them TODOs. I could move the cursor on to each line and do C-c C-t but then I have to do that a bunch of times. Is there a way to select all of the lines and apply something like C-c C-t to each one to get something like

* TODO item 1
* TODO item 2
** TODO item 2.1
** TODO item 2.2
* TODO item 3

in one fell swoop?


texts: AUCTeX: toggle sub- and superscript-fontification

texts:
Or: How to put face changes in a defun?

I use AUCTeX to edit my LaTeX files and I like the way AUCTeX displays the sub- and superscripts (not only in formulas).

Not only it shifts the sub- or superscripted text up or down, it also scales it down a bit (probably to still fit in the line).

That's great, because it makes the text more clearly.

But it breaks the idea of the monospaced font. So, while working in any way with the rectangular features, the problem occurs, that the same column isn't displayed at the same visual position, which is a bit annoying.

A short demonstration: All cells are filled with the same amount of chars:

\begin{tabular}{cc}
$f^{oo}$ & $b_{ar}$ \\
(f|{oo}) & (b|{ar}) \\
\end{tabular}

but won't displayed this way in AUCTeX (per default).

So I thought, I could write a function to turn the sub- and superscript feature on and off.

As described at Emacs AucTex Latex syntax prevents monospaced font one can give emacs permanent rules, by putting this in your init.el:

(setq font-latex-script-display (quote (nil)))

which prevents the shifting, and:

(custom-set-faces
 '(font-latex-subscript-face ((t nil)))
 '(font-latex-superscript-face ((t nil)))
 )

which turns off the scaling.

So I tried things like:

(defun toggle-LaTeX-rectangular-edit-ready-mode ()
  (interactive)
  (if (equal truncate-lines nil)
      (progn
    (setq-default font-latex-subscript-face '(:height 80)) ; doesn't work
    (set-face-font font-latex-superscript-face '(:height 80)) ; also doesn't work
    (setq font-latex-superscript-face ((t nil))) ; also doesn't work
    (setq truncate-lines t)
    (message "LaTeX-rectangular-edit-ready-mode has been switched on")
    )
    (progn
      (normal-mode)
      (setq truncate-lines nil)
      (message "LaTeX-rectangular-edit-ready-mode has been switched off")
      )
    )
  )

without any success.

My current workaround:

(defun toggle-LaTeX-rectangular-edit-ready-mode ()
  (interactive)
  (if (equal truncate-lines nil)
      (progn
    (text-mode)
    (setq truncate-lines t)
    (message "LaTeX-rectangular-edit-ready-mode has been switched on")
    )
    (progn
      (normal-mode)
      (setq truncate-lines nil)
      (message "LaTeX-rectangular-edit-ready-mode has been switched off")
      )
    )
  )

is hopefully just a miserable intermediate result.

So how can I achieve toggling face changes?

Solution (not only intermediate?)

As giordano mentioned, set-face-attribute helps us adjusting the height of the sub- and superscripted text.

We complete the defun with font-latex-script-display. At first, I thought, we have to restart the major-mode after using font-latex-script-display, but all we need is a font-lock-fontify-buffer call.

As I said, I need this function mostly for manipulating text rectangularly, so that's why I toggle truncate-lines (I use visual-line-mode). To make the function perfect, we add recenter, because by toggling truncate-lines  the cursor appears in a different place, recenter helps us finding the cursor, so we get finally:

(defun toggle-LaTeX-rectangular-edit-ready-mode ()
  (interactive)
  (if (equal truncate-lines nil)
      (progn
    (set-face-attribute 'font-latex-subscript-face nil :height 1.0)
    (set-face-attribute 'font-latex-superscript-face nil :height 1.0)
    (setq font-latex-script-display (quote (nil)))
    (font-lock-fontify-buffer)
    (setq truncate-lines t)
    (recenter)
    (message "LaTeX-rectangular-edit-ready-mode has been switched on"))
    (progn
      (set-face-attribute 'font-latex-subscript-face nil :height 0.8)
      (set-face-attribute 'font-latex-superscript-face nil :height 0.8)
      (setq font-latex-script-display (quote ((raise -0.3) raise 0.3)))
      (font-lock-fontify-buffer)
      (setq truncate-lines nil)
      (recenter)
      (message "LaTeX-rectangular-edit-ready-mode has been switched off")))
  )

which I'll bind to a fn key.


texts: How to bind keys to a function which can be defined per-mode?

texts:
Currently I have variables defined with setq-local, this is useful for modes, so I can define variables only for a particular mode.

How can this be done for functions?

I'd like to have a function, eg:generic-lookup-reference-at-point, bind this to a key, then define it for each mode which has the ability to lookup an item under the cursor.


texts: How to customize date headings in agenda timeline view?

texts:
Within the emacs org-mode agenda timeline view, where items are separated by what I'm calling "date headings", I'd like to be able to control how the dates appear.  Specifically, I'd like to abbreviate the day names and the month names.

For example, the default seems to be usage of full-names for the days and months:

Week-agenda (W06):
Monday      6 February 2017 W06
  Dated:      Scheduled:  TODO Backup laptop.
  Dated:      Scheduled:  PROJ Figure out quantum gravity.
  Habit:      TODO Feed pet whale.
Tuesday     7 February 2017
  Dated:      Scheduled:  TODO Buy new toothbrush.
  Dated:      Scheduled:  PROJ Resolve the Hodge conjecture.
Wednesday   8 February 2017
  Dated:      Scheduled:  TODO Clean finger nails.
  Dated:      Scheduled:  PROJ Create artificial life-form.
.
.
.

But I'd like it to look like this:

Week-agenda (W06):
Mon       6 Feb 2017 W06
  Dated:    Scheduled:  TODO Backup laptop.
  Dated:    Scheduled:  PROJ Figure out quantum gravity.
  Habit:    TODO Feed pet whale.
Tue       7 Feb 2017
  Dated:    Scheduled:  TODO Buy new toothbrush.
  Dated:    Scheduled:  PROJ Resolve the Hodge conjecture.
Wed       8 Feb 2017
  Dated:    Scheduled:  TODO Clean finger nails.
  Dated:    Scheduled:  PROJ Create artificial life-form.
.
.
.

I'd like to know how to make this change, and ideally I'd also like to know how I could have figured out how to do this by myself.  I tried browsing variables using

M-x org-customize RET

but didn't see anything that seemed appropriate to modify.  I was thinking maybe I should be looking at the source code of org-mode to see if I could figure it out.


texts: pull failed from magit, but pull works on command line (windows 10)

texts:
When pull from magit on windows 10 (spacemacs), the error is:

  1 C:/Program Files/Git/mingw64/libexec/git-core/git … pull origin

fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

But if pull from command line it works. Is there any setting in magit to fix it?

C:\code\python\db-in-box>"C:/Program Files/Git/mingw64/libexec/git-core/git" --version
git version 2.11.0.windows.1


texts: Export org-mode to LaTeX without preamble and document environment

texts:
I have recently started using org-mode as an electronic lab notebook for my work, and would like to combine these files with the files that I have set up in my old lab notebook, which was done in LaTeX.

The way my old notebook works is that each day goes under a file, e.g. 20161129.tex, and this file is added to the notebook using the \input{} command, so there is no preamble or \begin{document} in 20161129.tex, and it just starts with \section{2016-11-29 Tuesday}.

Given my file in org-mode, e.g.,

* Logbook
:PROPERTIES:
:DATE_TREE:
:END:
** 2016
*** 2016-11 November
**** 2016-11-29 Tuesday
***** Validation cases for subgrid
Some text and some math ($a + b = c$) to export.

I would like to export the 2016-11-09 subtree so that the resulting TeX file only contains the following content:

\section{2016-11-29  Tuesday}
Some text and some math ($a + b = c$) to export.

Preferably, this would be auto-exported and saved with the date (2016-11-29.tex), but having the same thing in a LaTeX buffer would be almost as good.


texts: Org Mode's :output-dir and :file-ext arguments cause ALL output to be saved to files

texts:
Org Mode's Babel for executing code blocks provides two header arguments, :output-dir and :file-ext that were clearly intended to be used in the global document header, applying to all blocks. They enable Org to auto-generate the names of files that are produced by the blocks - most commonly, I guess, graphics.

This works fine for graphics blocks, as intended. They allow easy switching between graphics formats. However, it also seems to mean that ALL blocks now save their results in a file, even where this is not appropriate (e.g. the block calculates a single value, which should be inserted directly into the document).

Am I missing something, or is this just a limitation, that these useful global arguments can't be used if a document happens to produce a mixture of tables and charts?

#+TITLE: Don't export EVERYTHING as a pdf
#+PROPERTY: header-args:R  :output-dir charts :file-ext pdf

The :output-dir and :file specify the directory and file extension that should be used to save output of all blocks. However, this results in ALL blocks' output being saved to files, even where this is not appropriate.

#+NAME: code_that_should_output_a_value
#+BEGIN_SRC R :exports results :results value
dat <- data.frame( a=1:3, b=10:12)
sum(dat$a)
#+END_SRC

#+RESULTS: code_that_should_output_a_value
[[file:charts/code_that_should_output_a_value.pdf]]

Update: I asked on the mailing list: http://lists.gnu.org/archive/html/emacs-orgmode/2018-05/msg00466.html What emerged:

setting :file-ext indeed sets :results file for all blocks. So if
it's used as a global header, all blocks will be forced to output
files, whether wanted or not.
:file-ext was originally envisioned
for use at block level - to automatically generate file names in
combination with #+NAME: and possibly :output-dir.
The current
behaviour is not seen as ideal, and may well be changed in Org 10.0
(but not straight away, to maintain backwards compatibility with
existing documents)


texts: How to change indent size for typescript layer in Spacemacs?

texts:
I have a tsfmt.json file with

{
  "indentSize": 2,
  "tabSize": 2
}

which does get picked up appropriately by tide when running M-x tide-format.

But when I start a new line by pressing RET or 'o', it gets indented 4 spaces. How do I change this?

Using Spacemacs v.0.200.10 on GNU Emacs 27.0.50 (build 1, x86_64-apple-darwin16.7.0, NS appkit-1504.83 Version 10.12.6 (Build 16G29)) of 2017-09-17

Repro:


texts:
In my org-file, I have entries like this:

*** Some One
%%(org-anniversary 1940 10  27) Some One is %d years old

*** Some Two
%%(org-anniversary 2003 11  3) Some Two is %d years old

What do I do if I do not know the birth year? I have looked at the solution here. But is there a better solution? Like an agenda item that just says its Some One's birthday


texts:
Here is a sample text to illustrate my difficulty:
* H1
L1 Some introductory text for H1
** H2
L2 Some text relating to H2
L3 This is part of H2. But I would like it to be part of H1 only, not part of H2

How do I get lines such as L3 out of H2 and into H1 without moving them around? Is there some kind of 'End of H2' marker?


texts: How to automatically create another file that matches a regex based on a file created?

texts: Suppose I create a file in dir1/file1.txt. As soon as I write the file for the first time, I want to create another file in dir2/file1_friend.txt. But when I create a file dir1/file2.txt, I want the new file created be dir2/file2_friend.txt.


texts:
I have just today started using gnus to read news groups.
I played around with subscribing and unsubscribing from certain groups, and read a few threads.

I exit gnus and emacs, and now when I try to reenter into Gnus, I am stuck on the loading screen (with the blue horse) with the minibuffer indicating

Reading /Users/samlaf/.newsrc.eld...

Is there a way to reconfigure this file, or might I have possibly changed some configurations that would cause such a problem?


texts:
I would like to be able to mark the current block scope. In other words, given some piece of code like:

...
if (1) {
  ...
}
...

If my cursors was sitting somewhere inside the if-body, it would mark that area of code. I guess a quick and dirty solution would be to just have a script scan for the previous curly brace and select everything between it and its match.

If there's no existing command for this, would someone know how to implement it?


texts: Is it possible to modify the emacs buffer with read-only text?

texts:
I am new to emacs lisp and emacs itself, coming from vim. I have seen such a nice feature in the idea:

This is a mutable buffer with read-only text hints: type of a variable and a argument name in the print function. I'd like to implement such functionality in the emacs editor. Is it possible?


texts: Add new header variable in org-mode document, and use it in (LaTeX) export

texts:
I'm using a memorandum specific style when I do LaTeX export of an org-mode document.  It has some fields that I'd like to specify/fill in in a manner similar to the way AUTHOR, TITLE, DATE are specified.

How do I define new document options?
How can I use them in exported documents?

Right now, I'm focused on LaTeX export, but might also want to do HTML output,
in which case I would want to use the new options in a customized postamble.

What I have now:

#+OPTIONS: toc:nil
#+AUTHOR: Dave
#+TITLE: write_me
#+DATE: 22 March 2018

#+LATEX_CLASS: myMemo
#+LATEX_HEADER: \memoto{ Alice }

* Content
  blah....

myMemo is a modified version of this memo template.  The original style uses some
custom macros like memoto and memofrom to setup the To: and From lines in the memorandum.   So far, I've modified most of the lines in myMemo.sty so that
they use the values defined in the org file:

\begin{description}
    \ifthenelse{\equal{\@memoto}{\relax}}{}{\item [{To:}] \@memoto}
    \item [{From:}] \@author
    \item [{Subject:}] \@title
    \item [{Date:}] \@date
\end{description}

so that the header portion of the memo uses the values defined by #+AUTHOR: ... etc.  However, I don't see a good solution for being able to do the same thing for the To: item that doesn't involve defining a new option (so that line is unchanged from the original style file, and it is specified in the org file with at LATEX_HEADER command).

so, it seems to me that I need a new variable in order to be able to specify the other features I'd like to have in the header.  I'd like to have something like this:

#+OPTIONS: toc:nil
#+AUTHOR: Dave
#+RECIPIENT: Alice
#+TITLE: write_me
#+DATE: 22 March 2018

#+LATEX_CLASS: myMemo
# The class file has been modified to make use of the RECIPIENT field
# in an appropriate way; for example using a \@recipient macro
# whose value is specified via the RECIPIENT line above

* Content
  blah...

How do I do it?


texts: How are normal characters inserted into emacs?

texts:
A trivial Problem?

I have somehow managed to set cand a few other keys to prefix-commands, meaning they wait for a further input (like e.g. C-x does) and so I cannot actually type the letter c when yas-minor-mode is enabled.
See here for more details:
Remove strange keybindings from YASnippet

I like yas-minor-mode, however, and so would like to remove these prefix keys so the normal character c on my keyboard to actually insert a c into emacs when in yas-minor-mode.

I had tried removing yas-minor-mode and reinstalling - no luck.
I tried to redfine the keys with things like global-set-key - again no joy.

Here is another similar looking questions, which made me think I could use the function basic-event-type - but I now think it isn't correct - plus my version 24.5 emacs doesn'T even seem to have that function.

How can I convert a C-key code into a 'normal' key code?


texts: How to find out if variable is buffer-local?

texts:
I'm trying to get rid of tabs, following this guide:

(setq-default indent-tabs-mode nil)

So: why setq-default and not setq? I know I would need to use setq-default for a buffer-local variable, but I can't actually determine (except from inferring from the guide) whether indent-tabs-mode is buffer local.

C-h v return something more confusing to me:

  Automatically becomes buffer-local when set.

So it would become buffer local if I setq it, so I must setq-default it?


texts: What's the value in using a REPL for ELISP development?

texts:
What's the value in using a REPL? I've always wondered the advantages/disadvantages of using a REPL are (if there are any) as opposed to eval-print-last-sexp and then undoing the text printed (or saving it if that's what you're into).
In other words, how can using a REPL be objectively more productive than using the latter workflow of just working purely in buffers.
Using a REPL seems like it's more of a constraining environment than an empowering one.
Can anyone give an example where using a REPL (e.g., IELM) is objectively better than just using a buffer?


texts:
I am trying to rebuild my Org Agenda buffer with a timer. I am trying to do it like this:

(defun renewOrgBuffer ()
  (interactive)
  (dolist (buffer (buffer-list))
    (with-current-buffer buffer
      (when (derived-mode-p 'org-agenda-mode)
    (org-agenda-redo t))))
  )
(run-with-idle-timer 60 1000 #'renewOrgBuffer)

I basically swiped this from another answer but they wanted to do somehting when the org file saved. I want to update it with a timer and am running into errors.

When I just run the function in ielm I get the error: *** Eval error ***  ‘recenter’ing a window that does not display current-buffer.

I am running Emacs 25.1.50.2 client connected to a daemon with org verion 8.2.10 on Ubuntu 15.10.

The purpose for this for me is that I like to have my org file with my todos and appointments up in one buffer and the Org Agenda buffer up next to it. So the the main purpose for me to update the Org Agenda buffer is just so that the line that says now - - - - - updates. It is a small think but I just want to figure it out.

Any help or pointers is appreciated.

Edit March 7

I have found that if you enable the sticky agenda view from the dispatcher (* option) then I can call my previously defined renewOrgBuffer function interactively with M-x and instead of getting an error, I get a message in the mini buffer that says "org-agenda-list: ‘recenter’ing a window that does not display current-buffer.", which is great, but I don't want to call it interactively every time.

When I try to run that function from the scratch buffer or on a timer like

(run-with-idle-timer 3 1000 #'renewOrgBuffer)

I get the error:

Rebuilding agenda buffer...done
Error running timer ‘renewOrgBuffer’: (error "‘recenter’ing a window that does not display current-buffer.")

Although it says "Rebuilding agenda buffer...done" it does not actually rebuild it.

Any help with this added information would be helpful, Thank you.


texts: What is a default shell on emacs 26.1 on Windows 10

texts: I've been using default shell in Emacs (not eshell) for some time, defined some useful macros etc. Installed cygwin and now my default shell is bash. All of my macros and functions stopped working. Bash is a good choice, but I really want to go back to a default shell so I don't have to redefine and rewrite all my functions, macros, and scripts. I know how to set a shell to be used by M-x shell, what I don't know where is a vanilla/default shell for Emacs 26.1 on Windows 10.


texts:
I'm using emacs over tramp to edit a project inside a vm on my local machine.  It has something like this:
ssh:vm:~/projects/project/.dir-locals.el
ssh:vm:~/projects/project/src/tests/file-i'm-editing.f90

On my local machine I have .dir-locals.el setup properly, but when I'm editing files on the vm, it doesn't seem to use the .dir-locals.el file.  Is this expected or should it be using that file?
I have edited the file on the vm to have the correct paths.


texts: org: colorize clocked tasks by height and category

texts:
https://orgmode.org/worg/org-hacks.html includes a hook function to "Show Org Agenda tasks with height spacing based on clock time with org-agenda-log-mode." The four colors are applied in a recurring cycle. I'd prefer to have the colors assigned to headline categories. This is way beyond my elisp skills. Any ideas?
;; work with org-agenda dispatcher [c] "Today Clocked Tasks" to view today's clocked tasks.
(defun org-agenda-log-mode-colorize-block ()
  "Set different line spacing based on clock time duration."
  (save-excursion
    (let* ((colors (cl-case (alist-get 'background-mode (frame-parameters))
                                 ('light
                                  (list "#F6B1C3" "#FFFF9D" "#BEEB9F" "#ADD5F7"))
                                 ('dark
                                  (list "#aa557f" "DarkGreen" "DarkSlateGray" "DarkSlateBlue"))))
           pos
           duration)
      (nconc colors colors)
      (goto-char (point-min))
      (while (setq pos (next-single-property-change (point) 'duration))
        (goto-char pos)
        (when (and (not (equal pos (point-at-eol)))
                   (setq duration (org-get-at-bol 'duration)))
          ;; larger duration bar height
          (let ((line-height (if (< duration 15) 1.0 (+ 0.5 (/ duration 30))))
                (ov (make-overlay (point-at-bol) (1+ (point-at-eol)))))
            (overlay-put ov 'face `(:background ,(car colors) :foreground "black"))
            (setq colors (cdr colors))
            (overlay-put ov 'line-height line-height)
            (overlay-put ov 'line-spacing (1- line-height))))))))

(add-hook 'org-agenda-finalize-hook #'org-agenda-log-mode-colorize-block)


texts: Using new features in emacs 27 generators

texts:
I want to try new features in emacs 26, I'm using emacs 27, generators and threads, but when I try to use on ielm buffer, I get the same error:

ELISP> (iter-defun my-iter (x)
  (iter-yield (1+ (iter-yield (1+ x))))
   ;; Return normally
  -1)
*** Eval error ***  Assertion failed: lexical-binding

This example is from ergoemacs


texts: Change *Completions* list to sort vertically?

texts:
When you trigger minibuffer completion for a partial command/filename/etc., the *Completions* buffer lists possible completions aligned vertically (in columns) but sorted horizontally.

../                ./                   ajax-proj/         algorithms/
angular-phone/     angular/             annex/             archives/
blog-ideas/        clojure-koans/       ctags58/           diff-tryout/
encodings/         filters/             game-table/        git-grounds/
hartl/             invoice_angel/       jQuery-basics/     java/
making/            ng-fundamentals/     node-meetup/       pickaxe/

I find this much more difficult to scan than if they were sorted vertically, like Bash does.

../                annex/               encodings/         jQuery-basics/
./                 archives/            filters/           java/
ajax-proj/         blog-ideas/          game-table/        making/
algorithms/        clojure-koans/       git-grounds/       ng-fundamentals/
angular-phone/     ctags58/             hartl/             node-meetup/
angular/           diff-tryout/         invoice_angel/     pickaxe/

Is there a setting that controls this?


texts:
Suppose I have the data
(setq data '((john "/path/to/selfie/john.jpg" "john@domain.com")
             (mary "/path/to/selfie/mary.jpg" "mary@domain.com")))

How do I let john's image show in helm buffer while calling helm for obtaining John's email?


texts:
In vim, assume :r!ls | grep foo is in the register l.
You can then do: @l to exec ls | grep foo and insert the contents matching foo in to the current buffer.
In evil-mode I get:
Usage: grep [OPTION]... PATTERN [FILE]...
Try 'grep --help' for more information.

Is this a bug, or a setting I'm missing?


texts: How can I bind a key to M-x C-r (isearch extended command)?

texts: I am a fiend for C-r (isearch-backward), and I often will enter the minibuffer with M-x (execute-extended-command), then use C-r to search for a previous command. I'd like to bind a key that drops me into the minibuffer to read an extended command and automatically activates isearch-backward, but I'm not sure how to write such a function.


texts: Dired: only reuse buffer for directories

texts:
To prevent creation of a buffer every single time I enter a directory in dired I use this:

(put 'dired-find-alternate-file 'disabled nil)

My problem now is that when I visit a file from dired pressing RET and then kill it, dired buffer is killed too.

Would it be possible to reuse dired buffer only for directories?


texts:
I am unable to set up yasnippet the way I want to set it up.

I only want to use yasnippet for a particular set of modes, so I don't want to use yas-global-mode.

I only want to use my own snippets, not the ones that come pre-packaged with the MELPA installation. I don't want it to ever load the MELPA snippets.

Unfortunately, the package is being insufferable; the only way I can figure out how to add my snippets and get them to actually work is to do the following:

(require 'yasnippet)

;; Use custom snippets.
(add-to-list 'yas-snippet-dirs "~/Dropbox/configs/emacs/snippets/")
(yas-reload-all)

(dolist (hook jrh-programming-modes)
  (add-hook hook 'yas-minor-mode))

I have to call yas-reload-all, or else my snippets aren't available. I have to use add-to-list, because for some reason, when I replace that line with (setq yas-snippet-dirs '("~/Dropbox/configs/emacs/snippets/")), my snippets are not loaded. So I have to suffer through the loading of all the other snippets, which I never use.

What I would like to do is this:

;; Use custom snippets.
(setq yas-snippet-dirs '("~/Dropbox/configs/emacs/snippets/"))

(require 'yasnippet)

(dolist (hook jrh-programming-modes)
  (add-hook hook 'yas-minor-mode))

and never need to use the other snippets or reload at all. Of course, the above code does not work, even though in my head it seems like it should.

Any help on how to accomplish this would be greatly appreciated.


texts:
BACKGROUND:

I have started to use emacs with a macbook and the first difficulty was that the meta keys are used for emacs things, where there would otherwise be used for special characters, such as: [, ], |, {, }, ...

[Not that it changes much, but just to mention it, my macbook has a German keyboard]

To solve this I had defined my own functions for each special character, which lives in my .emacs file. For example, to insert a pipe:

(defun nwm/open-curley-bracket ()
  "A custom function to insert an opening curley bracket as the mac key-bind for it doesn't work within emacs."
  (interactive)
  (insert "\{"))
(global-set-key (kbd "M-8") 'nwm/open-curley-bracket)

QUESTION:

I would like to use electric-pairs to auto-complete these special characters, meaning when I type { I expect both braces to appear {} with the cursor left between them.
The electric pairs mode works nicely for the special characters like normals brackets () that I do not need to remap to my keyboard, however it doesn't work for my new keybound characters like the pipe above.

I have tried setting the required special characters with less convoluted methods, e.g.:

(define-key global-map (kbd "M-8") "{")

... this still doesn't work for me.

I don't know much about Lisp, so if anybody can interpret the colde bhind electric-pairs to find the cause of the problem, please do!
http://www.emacswiki.org/emacs/ElectricPair

Has anybody got a work-around or a different solution?


texts: Create yasnippet placeholder in lisp expression

texts:
I am trying to write a snippet to generate different python based on which directory I am in, as in some directories, I am using an older version of python.  The snippet is

# key: log
# name: logger
# --
`(if (string-match "/projects/old" default-directory )
     "logger.info('$1: {}'.format($1))"
   "logger.info(f'$1: {$1}')" )
`

This sort of works.  It correctly figures out the new/old problem, but yasnippet is not paying attention to the placeholders.  An older version using just

     "logger.info('$1: {}'.format($1))"

processed the placeholders as expected, but obviously did not generate both forms.  What do I do to enable placeholders inside the return value of a lisp expression?


texts: Invoke a agenda-view integrated with a calendar

texts:
Usually, I check the agenda-view with a calendar as:
1. M-x org-agenda
2. invoke calendar by strike "c"

at this moment, the focus stay on the calendar

How could combine the two process?
If C-c a a to invoke a agenda-view, a Day-agenda integrated with a calendar will be invoked and keep the cursor on the agenda's time-grid.


texts: How do I cycle through file locations on counsel results?

texts:
I'm trying to look for all the occurrences of a word in my project and I'm using counsel for this. I get the list of occurrences and their locations in the minibuffer, but I'd like to cycle through the files at exactly the location of the occurrences. This works perfectly with swiper, by just doing C-n/C-p, but is there a way to get counsel to do this?

(I'm using counsel-rg if that matters)


texts: How supress a specific message from image/image+?

texts:
When I open an image in Emacs, there is a message constantly showing in the minibuffer: "Type C-c C-c to view the image as text." which I cleary don't want.

When switching between images, the message is constanting asking for my attention, which bothers me.
So I need to figure out how I could supress this message only. I tried alternatives like

(let ((inhibit-message t))
(message "Type C-c C-c to view the image as text."))

Or message-surpression.el, without any result at all. The message is still popping in my minibuffer when I open an image, and I couldn't figure out which function is calling that message.


texts: Make the column with the line numbers wider

texts: How can I make the column with the line numbers wider?


texts: Projectile buffer names with project relative filenames

texts:
I have a largish project with many hundreds of source files involved, and duplicate filenames. I would like to set the buffer names (automatically) to the (projectile) project relative path, instead of (currently) just the leaf name, which is driving me nuts in this case!

For example foo/bar.txt when I load ~/project/foo/bar.txt.

OR, a valid alternative would be to display this relative path some other way; if there was a second mode line then the full path could even be displayed, but as it is even some of the project relative paths are a bit long for the current status line.

How might I do this?


texts: Change keyword of Org item without triggering repeat

texts:
I have a BLOCKED keyword that I want to be able to temporarily set on repeating tasks in Org mode. However, if I set this up with (org-todo "BLOCKED"), this triggers a repeat. I don't want to trigger a repeat, I just want to change the status.

There seems to be some special behavior in org-mode where if you run org-todo interactively with a prefix argument of -1, then this makes the task TODO without triggering a repeat. See this question for details. I want to be able to do something similar, where I make a task BLOCKED without triggering a repeat.

The function org-cancel-repeater (which is used for the C-u -1 behavior) does not seem to help since it just sets the repeater interval to 0 permanently without providing a way to restore it. This seems almost roundabout. I'm not sure why Org was not simply written to change the keyword without affecting the repeater interval. Setting it to zero so that it works implicitly seems like a hack.


texts: Organize the content of ~/.emacs.d/init.el and ~/emacs.d?

texts:
When we add more and more lines into ~/.emacs.d/init.el for various
purposes (for python-mode, for emacs-eclim, for ...), the file
becomes lengthy and less readable. Is there a way to help organize its content?
My current ~/.emacs.d looks like this

$ ls *
init.el

auto-save-list:

elisp:
python-mode.el-6.1.3

elpa:
archives        auctex-readme.txt         s-20140910.334
auctex-11.87.7  emacs-eclim-20140809.207

eshell:
history

python-mode.el-6.1.3 was manually installed, while
emacs-eclim-20140809.207 was installed by elpa, and I am not 100% sure that the other things under elpa/ were by elpa. How can I
organize the content of ~/.emacs.d/?


texts:
When I run grep by M-x grep, I get results in a buffer.

When i run grep again M-x grep, the new results overwrite the previous ones in the same buffer.

How can I create a new buffer for the second run of grep, to avoid overwriting the results of the first run of grep?

Thanks.


texts: How to automatically adjust whitespace after yanks?

texts:
When editing human language text and moving text fragments around, I frequently run into the problem that whitespace moved at the beginning or end of a fragment doesn't fit into the new position.  For example, consider this paragraph:

This is the first sentence.  This is the second sentence.  These
three sentences are the whole paragraph.

If I move the last sentence before the first one by kill+yank, I have either leading or trailing whitespace.  A similar problem occurs in enumerations.

Another use case is if I want to insert a single word or expression which is in the kill ring without any trailing or leading whitespace.  For example, consider the word "very" in the kill ring, and the following sentence:

Such a minor mode would be useful.

After yanking, this may erroneously become:

Such a minor mode would bevery useful.

Is there a way to have white space in human texts adjusted automatically?


texts: Difference between =text= and ~text~ in org-mode

texts:
On org-mode's website, =text= is called "verbatim", whereas ~text~ is called "code". However, when exporting an org document to LaTeX, both are translated to \texttt{text}. When exporting to HTML, both are translated to text.

Is there a difference between them? I'm particularly interested in LaTeX export. If there is no difference, what's the reason for these synonymous formatting options?


texts: How to change the company complete backend based on the current syntax?

texts:
I would like to have natural language completion (company-ispell for e.g.) but only when editing comments.

How should the company back-end be swapped out when editing commensts?


texts:
I went from this issue Highlighting text in open (displayed) buffers/windows — searching for text from one buffer in another.

I would like to write the function for these commands to jump to word in another window: C-s C-w C-x o C-s C-s C-x o.

This is my code that doesn't work:

 (defun jump-word-other-window ()
   (interactive)
   (save-excursion
     (isearch-yank-word-or-char)
       (other-window 1)
       (isearch-forward)
       (isearch-repeat-forward)
        (other-window 1)))

How can I write this working keyboard combination in the function?


texts:
I started using Spacemacs with GUI Emacs on Windows and all was fine apart from using Tramp with plink so I decided to use Cygwin with emacs-32 (and Spacemacs) because there is proper ssh there.
Now everything is a bit quicker and Tramp works really solidly.

But now (in emacs-w32) there are DOS line endings in the game (meaning ^M) and that breaks some stuff. One example would be that a version check of ipython throws an error because the string containing the version also contains the line ending.

I thought that Emacs makes these line endings transparent (I still don't see them in GUI Emacs on Windows. So what's happening here? Is it because Cygwin is a weird combination of DOS and UNIX and is inconsistent in using just one type of line ending?


texts:
Is there a simpler way to remove the last element of a list than this?

(setq list (reverse (cdr (reverse list))))


texts: Emacs replace-regexp reference the match in the replace argument

texts:
Is there an easy way to use replace-regexp to do something like:

XYZ001
XYZ002
XYZ003

to

'XYZ001'
'XYZ002'
'XYZ003'

i.e. replace-regexp XYZ* 'XYZ*'

Is replace-regexp the the wrong tool for the job? Or is there some special regex syntax to replace with the item that was matched?


texts:
Something seems to have changed in the way HTML is exported from org mode between the 8 and 9 versions.One example, in the Table of Contents, I get entries with anchors like this:

a href="#orgfaf035e"

while earlier (version 8) I think I was getting

a href="#sec.1.1"

Those numbers seem to be completely random, so they differ every time I run the exporter again. The result is that if I make a change of one word only in the text, the diff between the new and the old file will be tens of lines of code. This is just noise for someone using a version control system. I wonder if there is an option to return to the old behaviour.


texts: dired and some keyboard shortcuts don't work on Emacs on MacTerm's vt220 emulator

texts:
I use MacTerm 4.0 on OS X 10.7.5 and I use the vt220 option base emulator.
When I open emacs -nw on it, when I press C-x C-c (to quit Emacs) it says
C-x C-g is undefined
When I type C-x C-s (to save buffer) it displays only the C-x part, not the C-s.
When I press M-x, the M is bound to the alt key to the left of the left cmd button on the Apple Wireless aluminum keyboard, the mini buffer don't display M-x at all. When I repeat the M-x then it displays: \305 is undefined
Here is the related section from my ~/.emacs file:
(setq ns-option-modifier 'meta)
(setq ns-right-option-modifer 'alt)
(setq ns-alternate-modifier 'meta)
(setq ns-right-alternate-modifier 'none)
(setq ns-command-modifier 'super)
(setq ns-right-command-modifier 'left)
(setq ns-control-modifier 'control)
(setq ns-right-control-modifier 'left)
(setq ns-function-modifier 'none)

In order to do the M-x, I do ESC-x  but I think you'll agree that it's not ideal.
To quit Emacs I do
ESC-x kill-emacs
To save buffer
ESC-x save-buffer
1- How to use those (frequently used) C-x C-c and C-x C-s shortcuts on the vt220 emulator?
When I enter dired mode and select a file on the dired window (i.e. by pressing enter) it doesn't open the file and the minibuffer says
Buffer is read-only: #<buffer lisp>
So I have to type the filenames on the minibuffer
2- Is there a way to select and open a file directly on dired window?


texts: How to follow commit hashes in commit messages?

texts:
Some commit messages contain sha1 hashes of older commits in order to reference these commits, e.g.:

Fixes: deadbeef

Is it possible to visit the referenced commit from the first commit message?


texts: Send a command to Emacs from an inferior process

texts:
Is it possible to send a command to Emacs from an inferior process?  For my particular use-case, I would like to instruct Emacs to run the command inferior-ess-r-reload-hook (part of the ESS package) from an R session (an interactive programming language) that was launched as a subprocess of Emacs.

Possibly related:

How to RPC from External Process to Emacs
How can I query Emacs from a separate process?


texts: Temporarily syntax highlighting combined with query-replacements

texts:
In latex-mode many macros comes with syntax highlighting. For example:

where the argument of the command/macro \bibitem (Fisher:99) has font-lock-constant-face.

I need to do something similar with my own macros. E.g., if I have the string

\mymacro{argument}

I need to fontify the string "argument" so the function (face-at-point) will give me the output my-custom-face. Plus, I need to do it "temporarily". Indeed I need to do it during the running of my scripts. After that I need to restore the original face.

I'm not interested in the visual effect of the face. I only need the function (face-at-point) to return non nil when the pointer is on the argument of my macro.


texts: Vertical sum and coordinates relative to separators

texts:
In org-mode, I can sum the rows in a column as follows:

|   | Column 1 |
|   |          |
|---+----------|
|   |        1 |
| 2 |        2 |
| 3 |        3 |
|   |        4 |
|---+----------|
|   |          |
|---+----------|
#+TBLFM: @7$2=vsum(@I..@II)

However, if I add some lines in the middle, the coordinates of @7$1 will move. According to the documentation, I've tried to modify the formula to

#+TBLFM: @II+1$2=vsum(@I..@II)

However, the result for the last line is:

|---+----------|
| 5 |       10 |
|---+----------|

Why is it also summing the first column ?


texts: Get different RefTeX references for Eq. vs. Equation, Fig. vs. Figure

texts:
When invoking RefTeX to generate LaTeX code for a reference (to an equation, figure) I need a short unbreakable space (LaTeX: \,) when the abbreviation is used (Eq.\,\ref{}, Fig.\,\ref{}) and a long space (~) when the full word is used (Equation~\ref{}, Figure~\ref{}).  I thought I understood the reftex-label-alist and added to my init.el:
(add-to-list 'reftex-label-alist '("equation" ?e "eq:" "~\\ref{%s}"   t (regexp "equations?")))

(add-to-list 'reftex-label-alist '("eq"       ?e "eq:" "\\,\\ref{%s}" t (regexp "eqs?\\." "eqn\\.")))

i.e. the first line matching "equation(s)" and the second matching "eq(s)", but this always results in a short space.  Is there a way to do this, or am I asking for something impossible?


texts:
I want to replace the default org-mode priorities with my own.

default: #A #B #C
desired: #1 #2 #3 #4 #5

How can I do this?


texts: How to activate python virtual environment in init file?

texts:
How would I activate a specific virtual environment in my init file? I know how to activate it manually, but I don't like to do it every time I start emacs.

To activate it manually I used:

pyvenv-activate

Then a path needs to be specified and it works. So I tried the following in the init file:

(pyvenv-activate PATH_TO_VENV)

Unfortunately it tells me:

Invalid function: (quote pyvenv-activate)

I want to do this, because without activating the venv, elpy does not find it and thus doesn't find jedi etc.


texts: Suspend frame, run a bash command, sleep for a few seconds and come back to emacs

texts:
[ I'm using the latest emacs, and always emacsclient with the -nw option in a terminal ]

I have this workflow I want to "automate" with an emacs hotkey. I find myself doing this over a hundred times a day:

C-z # or M-x suspend-frame to minimize/bg emacs)
# now I'm at bash prompt
$ /usr/local/bin/t   # this runs some bash tests I wrote
$ sleep 5 # I stare at the test results for about 5 seconds
$ fg   # I resume my work in emacs


texts: In Org mode how to link to a specific line or keyword in a Help or Texinfo page?

texts: For example, I want to create a link pointing to line 16 or the start of the first found keyword "binding" in the projectile mode help page ([[help:projectile-mode]]). I tried the double colon format dealing with normal files such as [[help:projectile-mode::16]] and [[help:projectile-mode::binding]] but it doesn't work.


texts: emacsclient single executions are expensive?

texts:
I have server-mode enabled so that I can use emacsclient to execute functions from other parts of my system. My main example is that I have a polybar module that calls emacsclient for some details about the active Emacs frame. When polybar is periodically calling emacsclient, I've noticed that the server uses up more CPU, seemingly in pursuit of deleting each new client. This makes editing feel a bit slower.
Here is a CPU sample of me editing a file.

How can I execute some elisp in the Emacs server environment without creating a whole new client each time (by calling emacsclient)?


texts: How to use keybindings containing @ in MacOS X?

texts:
I'm using Aquamacs 2.x in MacOS X 10.6.
(I'm using the Command key as M and the Ctrl key as C.)

WHen I try to use keybindings containing "@", it does not work, e. g. C-c @ C-t in outline-minor-mode.

I can type the @ sign in Aquamacs buffers with Alt-L.

But when I try to hit
Ctrl-C, Alt-L, I get the message "^C ⌘L is undefined" even before I can add Ctrl-t

EDIT:
it seems that I can use the Alt key and the Command key as well as META-Key, which is not necessary. I only want to use the Command key as META (to be "compatible" with WIndows and UNIX computers).


texts: Org Babel is returning the results of a cached file instead of the output of any org-babel blocks

texts:
NOTE: After restarting the python session and deleting all of the cache files about five separate times, everything started working as expected and I can't replicate the problem. I would still be interested in any explanations of the original issue, though.
My Problem
I am working with a .org file with org-babel code blocks executing code in a single python session. After executing the first few blocks, once I get to a particular block, all subsequent attempts to execute code blocks with <C-c><C-c> result in the output of a file from my /tmp/ directory being inserted into the buffer. I am looking for any guidance on how to debug this issue. Can I reasonably assume this behavior is coming from babel and not from something in my python code? Are there more details that would help in solving this problem?
The particular block where this problem begins to occur is:
#+BEGIN_SRC python :session tv :results value
with open(impath / "imagenet_classes.txt") as f:
    labels = [line.strip() for line in f.readlines()]
#+END_SRC

This returns a cached file with the results of an earlier block:
#+BEGIN_SRC python :session tv :results value
out = resnet(batch_t)
out
#+END_SRC

out is a pytorch Tensor with 1000 values. After running the block noted above, all subsequent block return the contents of a cached file in /tmp/ with the pytorch Tensor out. This is true even of something very simple that does not reference any existing variables, such as:
#+BEGIN_SRC python :session tv :results value
1+1
#+END_SRC

#+RESULTS:
:results:
tensor([[ 8.0883e+00,  7.6359e+00,  7.5604e+00,  7.4837e+00,  7.2821e+00,
          7.0158e+00,  6.9879e+00,  5.7778e+00,  5.6043e+00,  5.5918e+00,
          5.5413e+00,  5.5319e+00,  5.4627e+00,  5.3930e+00,  5.2824e+00,
          5.1776e+00,  5.1715e+00,  5.0799e+00,  5.0772e+00,  5.0520e+00,
          5.0075e+00,  4.9391e+00,  4.9213e+00,  4.8950e+00,  4.8217e+00,
...(etc)

After executing this or any other block, the python session shows the following:
>>> open('/tmp/python-DDq6Hi', 'w').write(str(_))
>>>

'org_babel_python_eoe'
14832
>>> >>> >>> 'org_babel_python_eoe'
>>>

Where '/tmp/python-DDq6Hi' is the aforementioned tmp file with the Tensor printout.
Configuration
My default header args are as follows:
  (setq org-babel-default-header-args '((:eval . "never-export")
                                        (:exports . "both")
                                        (:cache . "no")
                                        (:results . "replace drawer")))

I added :cache . "no" after the emergence of this problem, but it didn't have any effect. I also tried deleting all of the cache files and restarting the python session, but ran into the same problem at the same place. I've also tried several variations of the :results header (outputs values, leaving it blank, etc.).
Org version: Org mode version 9.3.7 (9.3.7-24-g7b657c-elpaplus @ /home/djliden91/.emacs.d/elpa/org-plus-contrib-20200831/)
emacs version: GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.22, cairo version 1.17.3) of 2020-08-28
python version: '3.8.5 (default, Jul 27 2020, 08:42:51) \n[GCC 10.1.0]'


texts: How can i start web-mode at a file's startup?

texts:
I want my emacs to start .php and others web files in web mode so i copied this code which is on the web-mode webpage:

(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))

But it's not working.
Here's my .emacs config:

(require 'package)

(add-to-list 'package-archives
         '("melpa" . "http://melpa.org/packages/")
         t)
(package-initialize)

(require 'linum)
(require 'linum-relative)
(global-linum-mode 1)
(linum-relative-on)

(require 'auto-complete)
(require 'auto-complete-config)
(ac-config-default)
(require 'yasnippet)
(yas-global-mode 1)

(set-language-environment "UTF-8")

(setq frame-title-format "Emacs")

(menu-bar-mode -1)

(tool-bar-mode -1)

(scroll-bar-mode -1)

(set-default 'cursor-type 'hbar)

(load-theme 'dracula t)

(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.[agj]sp\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode))
(add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))


texts: emacs: reinstall package after installation error

texts:
I'm new to Emacs. I needed to install the elpy package for python (as described here), but as I forgot to install one python package with pip, the installation with M-x package-install RET elpy failed.

I installed the missing python package, but I can't restart the installation of elpy on emacs. It remembers the previous error and won't try reinstalling.

How should I proceed ?


texts: What's difference between + and - in the list in org mode

texts: I find I can create bullets with the - and + both. How can I decide when to use + and -


texts: Weird (point) and (point-max) values in IELM

texts:
When I open IELM and type in (point) or (point-max) in the interpreter, it always returns 710 (#o1306, #x2c6, ?ˆ) and 64292 (#o175444, #xfb24, ?ﬤ) respectively. If I eval these functions via eval-expression instead, then I get correct values for the *ielm* buffer.

As (buffer-size) is just (+1 (point-max)) (unless narrowing is in effect), typing it into IELM yields 64291 (#o175443, #xfb23, ?ﬣ), but evaluating it via eval-expression gives the correct buffer size.

While this doesn't create any problems, I'm just curious why typing these directly into IELM returns really weird results? Is there any technical/theoretical reason for that?


texts: Ediff: compare two (long) buffers Word-by-word

texts:
I use Emacs 26.1 and try to compare two (long) buffers (opened side by side) by clicking Tools -> Compare (Ediff) -> Windows Word-by-word... Then I choose both Windows (A and B) by clicking on each opened buffer. However it looks like Emacs compares only the visible parts of the two buffers, not the whole buffers. Why?

I saw there is a command ediff-windows-wordwise... How is "Window" defined? - as "currently visible part of a buffer"? If yes, is there something like ediff-buffers-wordwise?

Update:
I have git in exec-path, so maybe I can make ediff to display the output of git diff --word-diff file1 file2 in ediff style?


texts: How to bypass (or disable) a command's "advice"?

texts:
In my .emacs I have an expression of the form

(defadvice find-file ...)

...which modifies the behavior of the standard find-file command.

There are times, however, when I want to bypass this customized behavior altogether, and run the original, unmodified, find-file.

The only way I have found to do this is to comment-out the (defadvice find-file ...) expression in my .emacs file and start a fresh Emacs session.  This is an extremely disruptive, not to mention heavy-handed, solution.

Is there a way to tell Emacs to run the original find-file?

Alternatively, is there at least a way to rescind the defadvice altogether for the remainder of the Emacs session?

EDIT:
An earlier attempt to try something like what PythonNut suggests in a comment failed because I could not figure out how to write a simple wrapper for find-file.  More specifically, I replaced the (defadvice find-file ...) expression in my .emacs file with

(defun my-find-file (&rest args)
  (apply 'find-file args))

(global-set-key (kbd "C-x C-f") 'my-find-file)

(defadvice my-find-file ...)

...where the code shown as ... in the new (defadvice my-find-file ...) is identical to the ... in the original (defadvice find-file ...).

If I start a new Emacs session with this new .emacs file, and type C-x C-f, I get the error message Wrong type argument: commandp, my-find-file.  It looks like my-find-file is not an adequate wrapper for find-file.  (I posted a question specifically about this.)


texts: How to set automatic indentation to move past numbers on first line?

texts:
I'm using auto-fill-mode with indented-text-mode to write numbered lists.  I'm trying to figure out how to persuade the automatic indentation to move past an item number on the first line.  I'm working with emacs -q and I have fill-column set to 70 (the default).  I'm editing this line:
 2. Every value-projection function in `value.h` fails in the same way: by

When I place the cursor at the end of the line and hit the space bar, I am hoping for the buffer to become like this, where the second line is indented past the 2.:
 2. Every value-projection function in `value.h` fails in the same
    way: by

But instead, the second line is indented to the 2:
 2. Every value-projection function in `value.h` fails in the same
 way: by

I have gotten as far as discovering the existence of adaptive-fill-first-line-regexp, but I have not figured out how to use it effectively---and I have a sneaking suspicion that it is actually intended to solve another problem.
How can I customize the automatic indentation to work the way I want?


texts:
I'm very new to org-mode and org-babel. After installing oh-my-zsh I noticed that I cannot run the source code in my org files like before.

My code is like follows

#+BEGIN_SRC python :results output  :session

# some computations

#+END_SRC

I noticed something went wrong because after I ran the source block code, the output showed the prompt you get when you call python through the terminal, given below.

#+RESULTS:
#+begin_example
WARNING: Python 2.7 is not recommended.
This version is included in macOS for compatibility with legacy software.
Future versions of macOS will not include Python 2.7.
Instead, it is recommended that you transition to using 'python3' from within Terminal.

Python 2.7.16 (default, Feb 29 2020, 01:55:37)
[GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.20) (-macos10.15-objc- on darwin
Type "help", "copyright", "credits" or "license" for more information.
'org_babel_python_eoe'
16286.2414
#+end_example

(I also got some other problem which got fixed after adding (setq python-shell-completion-native-enable nil) to the init.el file if that helps)

When everything was working just fine, I just got

#+RESULTS:
16286.2414

Which is what I want.

I then added the following to my init.el file

(setq org-babel-python-command "python3")

After which it is loading an installation of Python 3 BUT it doesn't have the packages I previously made use of in the same file (numpy, scipy etc) when everything was working fine

Any ideas on how to fix this? I also noticed when I run the code block for the first time, the Python and Clang version come up like when you open the Python REPL on the terminal, this did not happen before as well.
Which Python installation does org-babel even load?

Uninstall oh-my-zsh didnt work


texts: Adding new commands to the syntax highlighting of a language mode

texts:
I am working on a corporate installation. They have emacs, and it has tcl mode. The issue is that the command lassign is not highlighted, unlike, for example, set, or return.

What that I would like, is that w/o changing the original, installed, Tcl-Mode ELISP code, add lassign (and others) to the list/dict that are highlighted.


texts: Can I format the arguments in a table and provide the rows to a shell block as arguments?

texts:
In org-mode, is possible to provide arguments formatted as a table to a shell block?
E.g.
argument
|a|b|
|c|d|

shell script
echo $a

expected results
a b
c d

Basically, I want org-mode to read the values in the table row by row and provide them to the shell block as space separated strings.


texts: Tramp with Dired produces unwanted //DIRED// line

texts:
Connected via Tramp to an old remote system, when I list a
directory using Dired, I get:
  /plink:user@example.com:/tmp:
  total used in directory 549 available 114.7 MiB
  drwxrwxrwt   3 root     root         2048 Mar 24 06:59 .
  drwxr-xr-x  19 root     root         1024 Sep 12  2011 ..
  drwxr-xr-x   2 root     root        12288 Oct 30  1998 lost+found
  -rw-------   1 root     root       446528 Mar 24 06:59 quota.user
  -rw-r--r--   1 root     root        46909 Mar 14 01:07 zman06938aaa
  -rw-r--r--   1 root     root        46909 Mar 21 01:07 zman28862aaa
//DIRED// 69 70 128 130 188 198 256 266 324 336 394 406

According to Tramp’s debug buffer, the command that is executed by
Dired is:
/bin/ls --color=never --dired -al /tmp/ 2>/dev/null

It outputs:
total 549
  drwxrwxrwt   3 root     root         2048 Mar 24 06:59 .
  drwxr-xr-x  19 root     root         1024 Sep 12  2011 ..
  drwxr-xr-x   2 root     root        12288 Oct 30  1998 lost+found
  -rw-------   1 root     root       446528 Mar 24 06:59 quota.user
  -rw-r--r--   1 root     root        46909 Mar 14 01:07 zman06938aaa
  -rw-r--r--   1 root     root        46909 Mar 21 01:07 zman28862aaa
//DIRED// 69 70 128 130 188 198 256 266 324 336 394 406

I assume there is some incompatibility between the output from an old
ls and the current Dired.
Is there any way to get rid of the //DIRED// line at the end?
The problem is that the presence of this line makes navigation in
Dired super slow if there are many files in the directory. Moving from
line to line can then take more than a second.


texts: What's the Magit equivalent of 'git add'?

texts: What is the Magit equivalent of git add [--intent-to-add] <filename> for checking a newly created file into Git?


texts:
I want CTRL to be my personal modifier for my bindings and CAPSLOCK to act as CTRL only in Emacs. Most of the material out there shows you how to swap these two modifiers. However, since I use CTRL outside of Emacs regularly, changing the meaning of CTRL in OS level is not something I desire.

Is there any way to do it?

OS: Debian Wheezy (amd64), Gnome 3.4.2


texts: Using spacemacs with Evil. :vsp opens a new split vertical, but it always does it to the left. How can one configure it to open them to the right?


texts: How to prevent org-mode from repositioning text in the window when cycling visibility?

texts:
In org-mode, when I cycle through the visibility of the document via the TAB key (org-cycle), the text sometimes gets repositioned.

If there is enough text below the headline such that it will not all fit within the window when it is expanded, Emacs will reposition the headline line (the line my cursor is currently on) to the top of the window.

How can I make org-cycle cycle through visibility, but not move the text in the window?


texts: Print elapsed time in compilation buffer

texts:
The compilation buffer prints out start and end date for my compilation. How can I make it also tell me how many minutes & seconds it spent?

I'd like something like:

Compilation started at Thu Mar 16 09:10:44
[..]
Compilation finished at Thu Mar 16 09:13:04
Compilation took n hours n minutes n seconds


texts: "Args out of range" error when replacing with visual-regexp-steroids

texts:
I have been trying to use visual-regexp-steroids without luck (a thread on this package can be found here)

When I do vr/replace (C-c p), I get a prompt in the minibuffer. I can enter regexps and Emacs shows interactively every match in the buffer. So far so good.

The problem comes when I click RET and then enter another string (the one I want to replace my matches with). If I now do RET (to do the actual replacements), I get the following message in the mini-buffer:

Args out of range #<killed buffer>, 0, 0

Why? How can I debug the problem and get it to work?

Update: I have opened an issue in the GitHub repository here


texts: How to run a command with 'modify-syntax-entry' reset?

texts:
I have used modify-syntax-entry to remove underscores from being delimiting characters. e.g:

(modify-syntax-entry ?_ "w")

However I would like to temporary allow underscores to be used as a delimiter.

Normally I would temporarily override a variable with let in a function.

How can the syntax table be temporarily overridden?


texts:
Until today, when I was in the normal state in evil, the cursor was a block, and it would switch to an I-beam when in insert state.  Something changed, however, and the cursor is now always the I-beam.  How can I get the old behavior back?

More generally, how do I change the cursor appearance according to evil's different states?


texts:
I'm trying to use compose-region with TABs but fail to see difference.

I'd like to get 'sqrt' composed to '√' but taking as much space as original text and aligned to the right.

I tried each of:

(compose-region begin end "√")
(compose-region begin end "\t√")
(compose-region begin end "√\t")
(compose-region begin end "\t√\t")

but fail to see any difference. Is there a way to compose region but keep its width?

Emacs is 24.4.


texts: After `M-x pdb` switch to `compilation-mode` automatically?

texts:
M-x pdb is great while debugging.  When the python process exits though, often there is a traceback left behind in the gud buffer that I'd like to view using compilation-mode so I can use next-error to step through the stack frames.

I can always M-x compilation-mode on python exit.  Can I have emacs automatically do that for me?


texts: AceJump key bindings not working in org-mode

texts:
My ace-jump-mode bindings don't seem to work when I'm editing in org-mode.
This is how I define them in my .emacs.

(progn
  (require 'ace-jump-mode)
    (define-key global-map (kbd "C-c SPC") 'ace-jump-mode)
    (define-key global-map (kbd "C-c C-c SPC") 'ace-jump-char-mode)
    (define-key global-map (kbd "C-c C-c C-c SPC") 'ace-jump-line-mode)
)

Instead, when editing in org-mode, C-c SPC gives on the mini-buffer:

Not in table data field

... with the other bindings also failing (in different ways). I would prefer to disable these bindings from the org-mode commands they are bound to as I don't use them (for the time being at least).

If that's not possible, is it possible to instead only define alternative bindings for the ace-jump commands only when working in org-mode?

In general what is the "proper" way of addressing such clashes?


texts:
In function "shell" this line display shell buffer and almost always its open new shell in random frame. And I have to swap the buffers, it's annoying.

...
(pop-to-buffer buffer)
...

In docs says:

  If that window is on a different graphical frame, that frame is given
  input focus if possible.

I don't understand how I can display buffer in target frame, I'm not good enough in elisp. How I can do that? Thanks if someone could help.


texts:
I've been using Python command 'conda' in the terminal on my Mac. But when I run a command like 'conda activate ...' in Emacs's shell (M-x shell), it gives me this objection:

CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.

It tells me
To initialize your shell, run

    $ conda init <SHELL_NAME>

Currently supported shells are:
  - bash
  - fish
  - tcsh
  - xonsh
  - zsh
  - powershell

But when I run conda init bash, it has no effect: I just get back the same result trying to run the 'conda activate ...' command again. Is there anything I can do about this?
Note: I just want to run conda in the shell as I do in the terminal. I'm not really interested in other improved methods of running conda in Emacs (such as conda mode). Thank you.


texts: Display summary information on command when running Meta-x

texts:
Since I'm new to GNU Emacs (version 26.1 running on Debian Stable) I'd like to get some information when invoking a command using Meta-x.  Currently I'm only able to see a list of possible completions but I have to guess what the commands are actually doing (although, to be honest, many of them are named very intuitively).
As an explanation: when I'm running
pac <tab> li <tab> <tab>
the following lines are shown in my minibuffer
Possible completions are:
package-list-packages
package-list-packages-no-fetch

but I'd like the following functionality
Possible completions are:
package-list-packages               Display a list of packages.
package-list-packages-no-fetch      Display a list of packages.

or something similar.
Is there a way to get this option?  Additionally: can I do this without installing additional packages?


texts: How do I use xref-find-definitions with multiple source directories?

texts:
I'm attempting to make changes to an Emacs package. I currently have the version in use installed in ~/.emacs.d/elpa/<package> and the source checked out from git in /src/<package>.

When I navigate to, for example, fileA.el in /src/<package> and press M-. (xref-find-definitions) on an identifier in fileB.el, Emacs will jump into ~/.emacs.d/elpa/<package>/fileB.el. I would prefer if it instead jumped to /src/<package>/fileB.el.

Now, I've created a TAGS file, and that seems to work correctly if I call M-x xref-etags-mode prior to using M-.. However, I don't want to remember to do that for every buffer that I open. Is there an easier solution?

For clarity, /src/<package> is /not/ on my load-path (and I would like to keep it that way).


texts: What is Emacs' default character encoding for saving files? If it is UTF-8, is a BOM (Byte Order Mark) inserted?

texts:
What is the default character encoding used by GNU Emacs 25.1.1 to save files? Is it UTF-8?
Assuming that it is UTF-8, does Emacs insert a BOM at the beginning of the file?


texts: How to change a variable value in the current buffer?

texts:
I spent a long time looking for this and kept getting reference to M-x customize. But, that didn't give me access to certain variables like comment-start. I couldn't access comment-start with M-x customize-option either.

I decided to look for a way to use setq in the current buffer, but couldn't find that so I figured I'd document it here.


texts: Can't find google-translate package from melpa

texts:
Why can't my emacs find the google-translate package from melpa ?
I have trried

(use-package google-translate :ensure t)

And it doesn't find it, also M-x install-package does provide a google-translate entry with tab completion, but it still doesn't find the package.


texts: How can I copy and paste characters displayed with compose-region?

texts:
I use several modes that display Unicode characters in my code without changing the underlying file. For example, in Haskell mode, the following code:

foo :: forall a. Eq a => a -> a -> a

gets displayed as

foo ∷ ∀ a. Eq a ⇒ a → a → a

This is implemented with compose-region, which can replace a region with a character without changing the actual buffer text.

When I copy the code, however, it copies the underlying text without the Unicode. Most of the time this is the desired behavior, but sometimes I want to copy the displayed characters instead—I had to type up the second version of my example myself!

How can I copy the result of character substitutions like this rather than the underlying text? (In fact, I'm not sure this is possible at all!)


texts: Add breakpoints to a source code file en masse

texts:
I'm editing a .rb file with about 3000 lines of code.

This file has about 30+ statements that does a .create(

create() appears in many ways:
as part of another expression: puts Foo.create(...)

or

multiline:

Foo.create(
  baa: "baz"
)

etc

We suspect there might be a bug close to the create()s, so we want to add a line containing the word "byebug" to
the preceding line of any line containing create(

Can Emacs help me do this easily?


texts: Magit equivalent to 'git push origin HEAD'

texts: I usually use git push origin HEAD on the command line when I want to push my local branch to GitHub for the first time. That way I don't have to type the branch name. What is the equivalent in Magit?


texts: Browser not opening when exporting HTML from org-mode

texts:
Org-mode can export as HTML and open on a browser with C-c C-e h o (org-export-dispatch), but the problem is that the generated html file opens in a buffer inside emacs. There is no error in the message buffer, either. How can I make it work?

When I click a link inside org-mode, the browser opens correctly.

I'm running org-mode 8.2.10, emacs 24.3.1 on manjaro linux 0.8.10. I checked preferred applications in KDE and it points web browsing to firefox.


texts: Make org-agenda show only first occurrence of recurring task?

texts:
In Org-Mode, I have a few mundane re-occuring tasks.

When a task is set to re-occur, it shows up on every day it reccours. E.g a daily task:

* TODO Bugzilla Triage
 SCHEDULED <[today] ++1d>

Week-agenda (W09):
Monday     23 February 2015 W09
  leo:        Scheduled:  TODO Bugzilla Triage                      :RECURRING::
  leo:        Deadline:   TODO Weekly report                        :RECURRING::
Tuesday    24 February 2015
  leo:        Scheduled:  TODO Bugzilla Triage                      :RECURRING::
Wednesday  25 February 2015
  leo:        Scheduled:  TODO Bugzilla Triage                      :RECURRING::
Thursday   26 February 2015
  leo:        Scheduled:  TODO Bugzilla Triage                      :RECURRING::
Friday     27 February 2015
  leo:        Scheduled:  TODO Bugzilla Triage                      :RECURRING::
Saturday   28 February 2015
Sunday      1 March 2015

I don't really want them to take up all the Agenda space, I just want to see the first occurrence, (i.e only monday's occurance, but not all the other occurrences). Is it possible to configure emacs to show only the first occurance? (i.e monday in this case)


texts:
I'm looking into figuring out if it would be possible to display a random quote on the top of my agenda that changes daily or whenever I check out the agenda.

I have a Quotes.org file that I capture to with ** QUOTE items.

Would anything like this be possible?

EDIT: Works with the following code.

(defun read-lines (filePath)
  (with-temp-buffer
    (insert-file-contents filePath)
    (split-string (buffer-string) "\n" t)))
(setq number-quotes (length (read-lines "~/Documents/emacs/myFile.org")))
(setq org-agenda-custom-commands
      '(("c" "Daily Quote & Agenda & TODOs"
         ((insert (nth (random number-quotes) (read-lines "~/Documents/emacs/myFile.org")))
          (agenda "" nil)
          (alltodo "" nil)
                  nil))))


texts: Disabling section numbering causes Table of Contents to disappear in org mode Latex export

texts:
If I export the following document as a PDF through C-c C-e l p I get a PDF with a table of contents as expected:

* Hello

  This is a test.

* World

  Of org mode section numbering.

but if I add num:nil to the options (to disable section numbering) like so:

#+OPTIONS: num:nil
* Hello

  This is a test.

* World

  Of org mode section numbering.

my table of contents becomes empty.

I'd like to have a table of contents but without all the section numbers.  Is there any way to do that?  I've tried adding toc:2 as well but that didn't help.

The first one (without the num:nil) looks like this:

and the second one (with the num:nil) looks like this:

(a rather useless table of contents...)


texts:
This code

(defun insert-dateutc.* ()
  (interactive)
  (insert (with-temp-buffer
            (call-process "date" nil t nil "+%Y-%m-%dT%H:%M:%S")
            (buffer-substring-no-properties 1 (line-end-position 0)))))

(defun insert-random-uuid.* ()
  (interactive)
  (with-temp-buffer
    (call-process "uuidgen" nil t nil)
    (buffer-substring-no-properties 1 (line-end-position 0))))

which works stand-alone, but when stuck into this code

(defun foo ()
  (interactive)
  (insert (format "'(start-symbol :id %s
               :graph
               :ts %s
               :0.0
               :1.0
               )" (insert-random-uuid.*) (insert-dateutc.*))))

produces this:

2015-11-19T16:07:38'(start-symbol :id 9c5a8a91-325a-44d1-8535-03afc10f405a
               :graph
               :ts nil
               :0.0
               :1.0
               )nil

That is, it's sticking the formatted date outside the format output. I can only assume that I'm going to the buffer-substring-no-properties too many times, or it needs to be reset or something. An earlier version that simply did this

(defun foo ()
  (interactive)
  (insert (format "'(start-symbol :id %s
               :graph
               :ts %s
               :0.0
               :1.0
               )" (insert-random-uuid.*) (format-time-string "%Y-%m-%dT%H:%M:%S"))))

played well with insert-random-uuid.*

See:

'(start-symbol :id 2bfebed2-82c3-4ccb-b9f3-84b82a421e06
               :graph
               :ts 2015-11-19T16:21:39
               :0.0
               :1.0
               )nil

Not sure what the problem is. . . .


texts:
I've been searching for a while the following org-mode color theme on the net, which replace asterisk by circle, but I can't find it.

Anyone happens to know the name of this theme?

Thanks


texts: EMMS + Mplayer: stop cover showing up when playing music

texts:
I've been using EMMS with mplayer for a couple days, and a minimal config:

(setq exec-path (append exec-path '("/usr/local/bin")))
(require 'emms-setup)
(require 'emms-player-mplayer)      ; load mplayer
(emms-all)
(emms-default-players)
(setq emms-source-file-default-directory "/Users/me/Music/iTunes/iTunes Media/Music/")
(emms-add-directory-tree emms-source-file-default-directory)

It worked very well, M-x emms would generate a buffer with the name of all files, and hitting RET would play it. However, for some reason, whenever I RET to play a song, an mplayer window pops up with the album cover, and when a songs end, this window pops up again showing the album cover for the next song. How can I remove this behavior and make emms as "silent" as possible? The album covers are embedded in the audio files.

Question: how to stop this popup window with the album cover?


texts: Function call inside mode hook has no effect but manual execution of function from buffer works

texts:
I use AucTeX as my latex major mode. I have been trying to setup the minor mode latex-pretty-symbols which is available from melpa. I did:

;; Install from package-list-packages
(require 'latex-pretty-symbols)
(add-hook 'LaTeX-mode-hook
  (lambda () (message "Show that my code ran") (latex-unicode-simplified)))

What's supposed to happen is that font-lock should render  \alpha = 1 as α = 1 in a latex buffer.

Unfortunately, this doesn't happen in AucTex. Instead I have to either interactively call latex-unicode-simplified or manually evaluate M-:(latex-unicode-simplified) from the buffer.

Is there a way to programmatically send keystrokes after a mode is loaded? Is there some other way to tell auctex to do what I want ? I have been trying to solve this for 2.5 hours now so any help is welcome.

NB 1: This problem only happens when I use auctex. When I deleted auctex and
did (add-hook 'latex-mode-hook 'latex-unicode-simplified) then the problem got resolved. But I can't stop using AucTex.

NB 2: This problem is not resolved through file local variables, I tried to put a % eval: (latex-unicode-simplified) but that did not work

NB 3: The package author is using bitbucket, with issues disabled.


texts: Is there a setting  in auctex that can hide (fold) comments (paragraphs which start with %)?


texts: pdf-tools view bottom of one page and top of another page simulatenously

texts: Does pdf-tools have scrolling where I can view the bottom half of one pdf page and the top of the next page? Right now, my installation simply jumps to the next page and I cannot view two pages simultaneously.


texts: emacs philosophy: add dwim behavior when pressing Enter

texts:
I recently added a modification to my Enter keybinding based on an answer (if you can't see it, this is a link) on this SE. It was good and I liked it. So of course...

Now I want to add MORE dwim behavior. Specifically, while programming, if I'm typing a comment, I'd like to press the Enter key and the next line automatically also be a comment. E.g. in Ruby, if I have # blah blah| where | is the cursor, I want to press Enter and see

# blah blah
# |

So the question - what is preferred / philosophically correct with emacs?

Do I:

Expand my enter-key-dwim function to just check for more things?
Do I switch to two small functions that work as a local-buffer post-command-hook and only run if the last command was the Enter key?
Put an advice around the Enter key behavior?
Something else?

One comment says that I generally want to avoid post-command-hook because it gets run after every keystroke as well, which seems to be a vote against option 2.


texts:
I want to write a function that jumps to a given string in a pdf document. I am using pdf-tools. Naively, I thought this would work:

(defun goto-string-in-pdf (pdffile)
  "Jump to string 999 in pdffile"
  (let ((win (get-buffer-window pdffile)))
    (with-selected-window win
      (pdf-view-goto-page 1)
      (search-forward "999"))))

But it seems search-forward doesn't work in PDFView-mode. So how do I make this work?


texts: Problems with backslashes in hyperlinks in Emacs org-mode on Windows

texts:
I'm struggling again with Emacs 24.4 and org-mode (version 8.3beta (release_8.3beta-1013-g187dae`` @ c:/Users/mbec.POLYWBR/Documents/sorga/org-mode/org_current/lisp/)

I'm having problem with paths like that:

[[file+sys:\\servername.domain.de\dir\]]

which produce the error "No such file c:/servername.domain.de/dir/"

So org-mode seems to replace \ by / and then create a local path on my hard disk c: instead of resolving the path to the network server correctly.

Does anyone else work on Windows in a Windows Server network environment with similar paths and can tell me how to set things up correctly?

Remark: in dired+ it works well:
if I launch M-x RET dired and then paste a path like \\server.domain.de\dir1\dir2 , dired seems to convert it to //server.domain.de/dir1/dir2and opens the right directory


texts:
I know that emacs supports Arabic and I have seen many questions on Arabic support but my problem here is specifically with emacs in the terminal.

It can be seen in the image bellow in the left side that the text is shown correctly in the GUI mode. However the problems appear in the terminal in the middle and right frames of the screenshot.

In the middle one, it is just emacs running normally from the terminal. Here the letters are shown in the correct order from right to left but the problem is that the letters are separated.

A classical solution to problems with Arabic in the terminal is BiCon. It works pretty well with programs that are not aware of right to left languages.

In the right of the image emacs can be seen running under BiCon. The letters here are connected, which is good, but it is in the reversed order. I Believe that this is because emacs is already taking care of order and then BiCon is reversing it back.

One last thing to mention is that I tried some different terminals including xterm, gnome-terminal, konsole, and mlterm.

Any suggestions?

UPDATE:

This is not really a solution but it's workaround..
Using python-arabic-reshaper save this as ar-reshaper.py:

import arabic_reshaper
import sys
for line in sys.stdin:
    sys.stdout.write(arabic_reshaper.reshape(line))

Then:

cat INPUTFILE | python3 ar-reshaper.py > OUTPUTFILE

The OUTPUTFILE will be the reshaped version of INPUTFILE with the connected Arabic letters and the result on emacs:

But still, an actual solution is needed...

UPDATE:

Reported as bug and here's a little minor-mode if anyone is interested


texts: Lispy movement commands that treat atoms and parenthesized s-expressions the same?

texts:
lispy-flow almost does what I want. The problem is, though it descends into a parenthesized sexp, it does so only if that parenthesized sexp contains another parenthesized sexp. The fact that it skips over atoms is problematic: there are times when I want to go to the next sexp, regardless of whether it's parenthesized or a simple atom. lispy-forward doesn't do what I want because it won't descend into an s-expression. What I really need is something analogous to hitting Space in an info manual: i.e., keep going to the next node, even when that means descending a level. Perhaps I've just overlooked it, but I haven't seen anything like that in lispy. lispy-down isn't quite right because it skips over atoms.

forward-sexp is closer to what I want, I guess, as it won't skip atoms, but it doesn't descend into parenthesized sexp's. I guess I could live with this, since I can descend with lispy-flow, then use forward-sexp to move across the list, but forward-sexp isn't even provided by lispy. Is it consistent with "the lispy way" to rely upon it when using lispy?

On the subject of "the lispy way"... I see that lispy-ace-symbol can be used to mark (and position cursor on) a specific symbol within the list at point, and then j/k can be used to move the mark to different sexp's (including atoms) in the list. So perhaps I could get some of the functionality I need this way, though it seems a bit heavy-handed. I mean, if I'm planning to move a sexp around within the list, it makes sense, but if I just want to move cursor to an atom within a list (e.g., to modify a symbol, or perhaps to insert a new sexp just before or after it), I'll need to cancel the region mark, and perhaps reposition cursor to the other end of the atom before doing my editing. Also, there's the side-effect of changing the region, when all I wanted was to move the cursor. (Perhaps that's not really an issue. It may be only because I'm relatively new to emacs, but that sort of side-effect seemed problematic to me, if only from an aesthetic standpoint...)

So what's "the lispy way" to move cursor from outside a list to a specific element (possibly an atom) within the list for editing?


texts:
Since the last upgrade of org-plus-contrib to 20170210 I can no longer create clock tables in org mode. Computing the begin statement creates an empty table (see below) and throws the error org-clocktable-write-default: Wrong type argument: char-or-string-p, nil.

#+BEGIN: clocktable :maxlevel 5 :scope tree2 :tcolumns 1
#+CAPTION:  [2017-02-12 So 14:42]
|
#+END:

I have not changed anything in the clocked tree nor in the init file. So, to me it seems that the error results from changes in the org-clocktable command. Have you also run into this error? Has anybody found a solution to that?

UPDATE from 27.02.2017: The clocktable command works if I duplicate a single org file and run it as a different user with a not customised init file. Does anybody has a tip how to interpret the error message, so I can find the causing error in the init file?


texts: How to change window splitting behavior in Magit?

texts:
emacs: 26.2
spacemacs: develop (19c429e)
magit: 20190609.1424

Some time ago (e.g. 20190222.1746), magit's window management used to be different from how it currently is. For example, magit-status would always try to use an existing window, or if there was only one window in the frame, it would open a split (as if split-window-right was called). Now, magit will always open a new window.

Another example is that previous-buffer will skip over magit buffers, whereas before it would land on magit buffers.

I've been looking through the commits and so far I haven't seen any with an obvious commit message that signals these changes. Is this behavior the new default behavior? Is there any way to customize that it work like it used to?


texts: I would like to reset my working directory to the state in another commit. In pure git, I'd use git checkout <commit> -- <file>. Is there a way to reach similar functionality from any of the dispatch popups in magit?


texts: replace char at position using Emacs script

texts:
Below script will insert a char at position:

#!/usr/bin/env emacs --script

(defun modify(filename)
  (find-file-literally filename)
  (goto-char 3)
  (insert "\x39")
  (save-buffer 0)
  (kill-buffer))

(modify "a.txt")

How can I modify it to replace a char at positon?
for example:

a.txt content is:

abcdefg

Output changed to:

ab9defg

Current script output is ab9cdefg.


texts: How to call "echo ${GOPATH}" with call-process?

texts:
I try to execute echo ${GOPATH} with call-process as below:

(call-process "echo" nil t nil "${GOPATH}")

But it only output "${GOPATH}" not the value of that value. Would anyone please let me know what the correct way to do it?


texts: I would like to rename a connected Jabber buffer. However, if I rename the buffer in the usual way, new messages coming in recreate the original one. How can I rename the buffer so that it remains connected to the Jabber session?