texts: Recenter buffer when clickable text is clicked?

texts:
TASK 1:

If I run C-h f goto-line(or any other function) it will open help buffer with clickable text like this.

If I click this text, it will open that file in a new buffer and it will take to that definition. But the point will be on last line like this.

TASK 2:

If I call (recenter 0), it will place point in top line like this.

How can I link both of these tasks, so that every time I click on a button it will place point on top line of buffer? I couldn't find any useful hooks to do these.


texts:
Does Emacs allow it to implement POSIX signal handling in Lisp?

Specifically, I would like to handle SIGTERM to finish desktop-mode related things.


texts: Why does lisp-interaction-mode exist, and do we ever need it?

texts:
Q: Why does lisp-interaction-mode exist, and are there any reasons to use it instead of emacs-lisp-mode?

The manual states that emacs-lisp-mode and lisp-interaction-mode are identical except that the latter binds C-j to eval-print-last-sexp.  Beyond that, "all other commands in Lisp Interaction mode are the same as in Emacs Lisp mode."  As far as I can tell, only the *scratch* buffer uses the latter mode.

It strikes me as odd that there is an entire mode that differs from another by only a single keybinding, so I presume I'm missing either some history or context.

So:

Why does lisp-interaction-mode exist?
Not counting the C-j keybinding, are there any circumstances in which it would be preferable to emacs-lisp-mode?
Would there be any unexpected consequences to changing the *scratch* buffer's mode to emacs-lisp-mode?

The motivation for this question is that, right now, I'm binding keys twice (in the two modes) so that my *scratch* buffer behaves like buffers visiting *.el files.  If there's no practical reason to keep lisp-interaction-mode around, I'll just (setq initial-major-mode 'emacs-lisp-mode) and be done with it.


texts: org-mode smart-quotes (probably prb with the regexps)

texts:
I have a problem with org smart-quotes. There are two cases that don't seem to be covered by the standard regexps to identify quotes, namely in the case '" and the case "'. The double quote in both examples is not identified and left as it is. I'm wandering if that's a bug to signal.

I don't know if there is a use-case for the second case, but the first is common for exemple in french: L'assise d'"opinions" muettes...
But to make a general point I did a general example.
For a working example, use virgin emacs with
    #+OPTIONS: ':t
and that's all

The lines in org:

"Lorem" ipsum 'dolor' sit "'amet' consectetur" adipiscing "elit 'sed'"
do '"eiusmod" tempor' incididunt 'ut "labore"' et dolore magna aliqua.

become exported in tex as:

``Lorem'' ipsum `dolor' sit ``'amet' consectetur'' adipiscing ``elit `sed'''
do '"eiusmod'' tempor' incididunt `ut ``labore"' et dolore magna aliqua.

and so in the pdf it reads:

“Lorem” ipsum ‘dolor’ sit “’amet’ consectetur” adipiscing “elit ‘sed” ’
do ’"eiusmod” tempor’ incididunt ‘ut “labore"’ et dolore magna aliqua.

So everything works fine except the cases that I mentioned.

A minimal exemple easier to follow:

L'assise d'"opinions" muettes

in org becomes in tex:

L'assise d'"opinions'' muettes

My guess is that the double quote in these cases is not covered in the regexps used by smart-quotes and is overlooked.
The standard regexps in org-export-smart-quotes-regexps are

("\\`\\([\"']\\)\\(\\w\\|\\s.\\|\\s_\\|\\s(\\)"
 "\\`\\([\"']\\)\\(\\s-\\|\\s)\\|\\s.\\)"
 "\\`\\('\\)\\S-"
 "\\(?:\\s-\\|\\s(\\)\\([\"']\\)\\(?:\\w\\|\\s.\\|\\s_\\)"
 "\\(?:\\w\\|\\s.\\|\\s_\\)\\([\"']\\)\\(?:\\s-\\|\\s)\\|\\s.\\)"
 "\\S-\\('\\)\\S-"
 "\\(?:\\s-\\|\\s(\\)\\([\"']\\)\\'"
 "\\(?:\\w\\|\\s.\\|\\s_\\)\\([\"']\\)\\'"
 "\\S-\\('\\)\\'")

I'm not a programmer so to me this is gibberish. Could somebody good at regexps tell me how to modify it to cover my orimary case? Or if someone had another solution, that would evidently be as good.

Unfortunately the Documentation of org-export-smart-quotes-regexps is "brief" and doesn't say how the regexps are used. It says only:

  List of regexps matching a quote or an apostrophe. In every regexp, quote or apostrophe matched is put in group 1.

So one would have to identify which regexp is interesting here and how to modify it.

Thanks!!


texts:
How can I convert a number of lines with text into a list?

Input:

line one
line two

Then I want to mark the lines and after executing a function it should be:

line one

line two

I know I can use web-mode-element-wrap to wrap the lines with the
 tags, but I'm not sure, how to iterate over the lines in a region.

Or is there already some built-in way to do this in web-mode?


texts: Spacemacs evil-mode : How to toggle off visual mode in interactive function call?

texts:
;; .spacemacs file
(defun my/function (beg end)
     ;; To work with visual selection:
     (interactive "r")

    ;; Displays visual selection in message buffer:
    (message (buffer-substring-no-properties beg end))

    ;; Now I want to toggle off visual selection in buffer
    ;; But I do not know how to do it?
)

Any ideas?


texts:
So far I've been using Moba Xterm on Windows to connect via ssh to remote linux machines on my network, but I'd like to switch to Emacs.

However, just running an eshell or shell buffer and trying to ssh from there ends poorly:

Pseudo-terminal will not be allocated because stdin is not a terminal.

My understanding is that this is because shell and eshell are not "real" terminals like ansi-term, it also seems that they can't handle printing output and/or taking input in real time very well as they tend to print to stdout all of a program's output at once when it finishes.

I would like to access those machines directly from an emacs buffer, possibly with dired in the same frame to manipulate files at the same time. I know about tramp but I was not able to connect to any machines using it (connections time out as if those machines were not responding), and I can't access remote folders either. I know this should be possible in principle because I can ssh from powershell with no problems.

So to clarify, my question boils down to this: what is the recommended procedure for connecting to remote machines via ssh in interactive mode on Windows, and what is the recommended procedure for accessing their files via dired?


texts: Have `projectile-find-file` fall back to `ido-find-file` outside of projects

texts: How can I bind C-x C-f to invoke projectile-find-file when inside a project, and ido-find-file when not in a project?


texts: Typing composite characters (e.g. diacritics) in emacs

texts:
When running GNU Emacs as a GUI (under Ubuntu), I can't type composite characters with a Spanish keyboard.

For example, to type character á in a Spanish keyboard you first type the ´ key followed by the a key.

So when I fire up Emacs, these kind of key sequences don't work; the diacritic is ignored.  That is until I use the Ctrl+x 8 Enter Enter (C-x 8 RET RET).  After that, typing works as expected.

How could I automate this from init.el?


texts: How Do you export only R code from Rnw file

texts:
I am working with knitr, polymode, ess and I would like to export just the R code from my .Rnw into a .R file. A basic file might look something like this:

\documentclass[a4paper]{article}

My Rnw file

<<>>=
##This is some R code
1+1
@

\end{document}

In the end, I would like an R file with just

##This is some R code
1+1


texts: Is there a function that returns the position of the first and last non-whitespace characters in a line?

texts:
I have a sentence. For example:

foo bar

When I do gl in Evil normal modus, that sentence turns into:

;; EDH: foo bar
;; ------------

So I need to bind the keys gl to a function, that will turn the sentence into the above.

Eventually I came up with:

(evil-define-operator my-comment (beg end)
  "Comment selected lines."
  :motion evil-line  ;; in normal mode, no motion is read but the current line is used
  :type line         ;; this operator always works on whole lines
  (goto-char beg)
  (insert "EDH: ")
  (goto-char (+ 4 end))
  (let ((n (- (line-end-position) (line-beginning-position))))
    (newline)
    (insert-char ?- n)
    (comment-region beg (point))))

(define-key evil-normal-state-map "gl" #'my-comment)

This allows, e.g., to visually select some lines and then gl comments those lines and adds EDH: before the first.

Later I noticed another bug with this function. For example, I have the code formatted as following.

start
    foo []

[] = cursor.
So I toggle my-comment on foo

Then it will be:

start
;; EDH:    foo
------------

Which is wrong, I need to make it like:

start
     ;; EDH: foo
     ------------

The culprit is the  (line-end-position) and (line-beginning-position), with no respect for the indentation.
So I'm wondering if is there a Evil alternative or a built-in Emacs command, that returns the position of the (evil-first-non-blank) and (evil-end-of-line), as well the postion of the first character in the line and the last characther in the line?

Any suggestion would be appreciated.


texts: How to align both of comments and macro of multiple lines with space instead tabs for C/C++ code?

texts:
This is my configuration in init.el for C/C++ code which is default value in linux kernel:

(setq indent-tabs-mode t)

I'm using this style and won't change it to nil.

And indentation and alignment work perfectly when I'm writing C/C++ code.

But I found that when I try to manually align multiple lines of comments (comment at the end of a line) or macro, the M-x align or M-x align-regexp command will align them with tabs, sometimes tab+space, this is really annoying, since when I tried to view the file in other tools such as vim, less or in git diff, the alignment will be messed up, and I work with other people, so I cannot change all the tool.

The easiest thing to do is to change Emacs align and align-regexp.
So how can I make M-x align and M-x align-regexp align all the multiple macros and comments with pure space instead tab (or tab+space)?

Original:

Current align or align-regexp, I enable whitespace-mode to show the tab/space, you can see that all the blanks of the alignment of macros and comments are tabs instead spaces.(If the original block contains multiple spaces, it will be space+tab):

Desired align or align-regexp:

How can I modify align/align-regexp or define a new function for both macros and comments of multiple lines?

UPDATE:

I already come up a solution, it is not smart, but it is enough. If anyone got any better idea, welcome.

https://gist.github.com/c02y/53f3dc97f2c985e89b86095d6a27a1c3


texts: Pulse text inserted, changed or removed when undoing and redoing

texts:
I heard about pulse.el recently on r/emacs and thought of using it to highlight the chunks of text inserted, removed or changed on undoing and redoing edits, just like evil-goggles used to do:

 There's another neat thing that evil-goggles used to do, using different colors for different type of changes (insert, delete or edit).
My problem is that while pulse.el has a function that looks like it could be used to this end, pulse-momentary-highlight-region, I don't know how to find the two arguments it requires, which are the points where the chunk of text involved in the undo/redo begins and ends.


texts:
How could I make an interactive function to toggle in between two color themes?

From what I have been able to find there is no variable set to what color theme is currently in use, in fact several can be loaded simultaneously?

Also, in order to toggle you would need to first do disable-theme for the currently loaded theme, to not make themes clash.

How to do that without knowing which theme is currently loaded?


texts: how to print a pdf with Japanese letters on org-mode

texts:
I'm trying to print a pdf file which has Japanese letters on org-mode.
I use macbook pro and I installed MacTex 2016 and updated all the programs after installation.

I typed "C-c C-e l o" to make a pdf file.
I can export English letters, but I cannot export Japanese ones.
Do you know how to embed Japanese letters in a pdf file?

I'd appreciate your advice.


texts: How to input number-series (with appointed amount) in Emacs?

texts:
I want to input 90 number-series starts from 1, here is what I did:

set-mark
type enter 90 times
C-u C-x r N Enter %3d Enter

The output is like this:

1
2
3
4
5
6
7
....
90

Is there a way to set the amount of output? (I don't want to hit enter / or hold enter for 90 times.)


texts:
Whenever I open an org file, I have to activate auto-fill-mode and go through every signle line that I need to read and press RET to get a filled paragraph. Is there any way to globally set auto-fill-mode and applied to all the paragraphs in an org file while opening the file?

Best.


texts: Why does font-lock for comment work in cpp, but not in c?

texts:
This comment gets font-lock-comment-face in C++ mode, but not in C mode:

/**
 *   \file test.cpp
 *
 */

If I add another * to /** -> /***, it's working in C-mode, too...

I'm not aware of any customisations, but I could be wrong.

Using CC Mode version 5.32.5
GNU Emacs 24.5.1 (x86_64-unknown-cygwin) of 2015-06-23 on desktop-new


texts:
Aim:
I am writing papers in different languages mostly in multifile latex projects. Thats why I would like to set the ispell dictionary in the directory local variables.
Problem:
Flyspell is not using the dictionary defined in .dir-locals.el.
The value of ispell-local-dictionary is nil.
In .dir-locals.el I have:
((nil  (ispell-local-dictionariy . british)))
Creating a test.txt in the folder and manually activating flyspell works! (not for .tex files)
Solution(so far):
Flyspell is activated with latex-mode-hook in my init.
I am pretty sure it has to do with the load times of mode specific hooks and the local directory variables. The directory local variables are loaded at a later point. Answers online suggest the use of hack-local-vars-hook. However, I am struggling to make it work.
Could someone please supply a syntax example for this or point me towards a different solution?
Cheers


texts: emacs' internal documentation missing info?

texts:
Emacs 26.1 on Debian 10 stable

I have previously used the Windows version of Emacs and now I'm back in Linux (thanks to it).

When pressing C-h i d there seemed to be a lot of more information in the Windows version.

Now I can only see Org-mode, and Emacs FAQ among other things I don't really need right now. The Window Version had the (full) Emacs documentation, Lisp documentation and a lot more.

Am I missing something? Or Looking in the wrong place?


texts:
I'm using Spacemacs, and I REALLY love how Dr. Racket background highlights parentheses as you move around.

I'm wondering if I can do this in Emacs instead of this God forsaken "rainbow delimiters" that give me a headache.


texts: How do I change the highlight color for selected texts on isearch?

texts:
When I search a text on isearch due highlighed color it is not readable.

Following line does not have any affect on the main selected word on the isearch:

(set-face-attribute 'lazy-highlight nil :foreground "black" :background "green")

Example:

[Q] How do I change the highlight color for selected text on isearch?


texts: How to increase the number of displayed digit decimals in Emacs calculator

texts:
Currently Emacs calculator (calculator not calc) only shows, up to three digit decimal values.
For example calculating 22/7 gives 3.143.
Is it possible to increase the number of displayed digit decimal in Emacs calculator?


texts:
Following Sending Mail

  Since no credentials are given in this configuration, Emacs will look
  them up in $(HOME)/.authinfo or $(HOME)/.authinfo.gpg (encrypted). The
  content of this file should follow this scheme:

machine example.org login [your login name] password [your password]

After finished the configuration and send mail

From: abst.proc.do@qq.com (abst.proc.do)
To: igabriel_job@163.com
Subject: Testing
Date: Wed, 22 Jan 2020 07:56:03 +0800
Message-ID: <874kwo2wks.fsf@foxmail.com>
--text follows this line--
Testing

but got the error:

 gnutls-negotiate: GnuTLS error: #<process smtpmail<1>>, -15

What's the problem?  I did not set gnus.

Ubuntu 19.10 emacs 26.3


texts: Convert math in org file to markdown file correctly

texts:
I'm trying to convert/export a org file to Markdown. Most Markdown supports math with $x^2$ or $$x^2$$. I tried ox-gfm and pandoc, but they don't seem to handle it correctly:

org file:

\[x^2\]
$$x^2$$
$x^2$
\(x^2\)
$x^2$

exported markdown file:

\[x^2\]
\[x^2\]
\(x^2\)
\(x^2\)
\(x^2\)

None of these show up as math in a markdown file (correct would be $x^2$).

Does anyone know how to get the correct behavior?
Note: I use spacemacs.


texts:
I'm using emacs (GNU Emacs 25.1.1 (x86_64-w64-mingw32) of 2016-09-17), and trying to define SumatraPDF as my default PDF-viewer for LaTeX. After some trials, nothing happens, and I have no idea why...

I wrote this in my .emacs-file (just after calling the emacs-leuven configuration ):

(eval-after-load 'latex
  '(progn
     (if (eq system-type 'windows-nt)
         (progn
           (add-to-list 'TeX-view-program-list
                        '("Sumatra PDF"
                          ("\"c:/Program Files (x86)/SumatraPDF/SumatraPDF.exe\" -reuse-instance"
                           (mode-io-correlate " -forward-search %b %n") " %o")))
           (assq-delete-all 'output-pdf TeX-view-program-selection)
           (add-to-list 'TeX-view-program-selection '(output-pdf "Sumatra PDF"))))))

And this is what I see in the buffer for the customization of the TeX-view-program-list :

'(("Sumatra PDF"
   ("\"c:/Program Files (x86)/SumatraPDF/SumatraPDF.exe\" -reuse-instance"
    (mode-io-correlate " -forward-search %b %n")
    " %o"))
  ("SumatraPDF"
   (concat "\"" "c:/Program Files (x86)/SumatraPDF/SumatraPDF.exe" "\" %o")))

Does someone have any idea what's wrong ?


texts: How to prevent macOS from overriding some Mac Emacs bindings

texts:
I wonder how the "Pass Command/Control To System" options (mac-pass-command/control-to-system) are supposed to work? In my case I would like to have Ctrl-space and Cmd-space bound in the macOS system keyboard settings (the macOS default bindings to switch keyboards and for spotlight search) but have them overridden in Emacs (among others, to be able to use the default Emacs bindings [C-space] for set-mark).

Even if I have the above two options set to nil (I have mac-command-modifier set to control, so I am actually hitting Cmd-space) a [C-SPC] keyboard event seems to be passed directly to macOS triggering a spotligt search instead of Emacs set-mark. (Unless I unbind the key in the macOS system settings, in which case it works.)

Is this a bug or some intended behavior? I vaguely recall that I had this working in previous version of Mac Emacs.

I am running a modified version of Emacs known as "Emacs Mac Port":   GNU Emacs 26.1 (build 1, x86_64-apple-darwin13.4.0, Carbon Version 157 AppKit 1265.21) of 2018-05-30".  Here is a link to the source code:  https://github.com/fgeller/emacs-mac-port

mac-pass-command-to-system is defined in macterm.c and its doc-string is:  "Non-nil if command key presses are passed on to the Mac Toolbox."

mac-pass-control-to-system is defined in macterm.c and its doc-string is:  "Non-nil if control key presses are passed on to the Mac Toolbox."


texts: company-mode in shell-mode doesn't complete ./executables

texts: With company-mode on in shell-mode, if I'm in ~/bin I can get completions if I type ~/bin/someprog or even ../bin/someprog but not ./someprog – is there some setting to fix this?


texts: Is it possible to insert images from the web with its url?

texts:
Is it possible to insert images directly from the web with its url in org-mode? i.e. Can I paste something like this into emacs' buffer, so that it changes into the image of a cat in the link in image mode?

[[https://d1ra4hr810e003.cloudfront.net/media/27FB7F0C-9885-42A6-9E0C19C35242B5AC/0/D968A2D0-35B8-41C6-A94A0C5C5FCA0725/F0E9E3EC-8F99-4ED8-A40DADEAF7A011A5/dbe669e9-40be-51c9-a9a0-001b0e022be7/thul-IMG_2100.jpg]]

It just makes it a clickable link in my current settings.


texts: How to use the GUI color defaults in emacs terminal

texts:
With some googling I managed to get emacs to work in 24bit mode in the terminal (I'm working in windows in WSL2, so don't have access to a gui). When I loaded my colour theme, it looks completely different from what I'm used to. I figured out this is because I haven't got all the the colours explicitly defined, and apparently the defaults are different in terminal emacs (the colours I defined explicitly in my theme are being used). Can someone tell me how to:

Load the GUI standard default colorscheme, with my own colorscheme on top of it

or:

Save my colourscheme on my old laptop with GUI access, in such a way that all defaults are saved explicitly as well


texts: Apply template to files created from an org-mode link

texts:
If you click on a file: link to a document that does not exist, org-mode will create this file for you.

How can I get this behavior to work with a org-capture template, so that files created in this way include the following header:

#+TITLE: {filename token}
#+AUTHOR: Me
#+DATE: {date token}
#+STARTUP: showall latexpreview inlineimages

%? <- Place pointer here {token}


texts:
I try to make a clocktable report that filters by tags like so:

#+BEGIN: clocktable :tags ("REP") :tstart "<-6d>" :tend "<now>"
...
#+END:

But I get an error:
Wrong argument type: stringp, ("REP").

If I remove :tags ("REP") then it works. But I'd like to filter by tag.

Can anyone tell me what I'm doing wrong?

[edit]
On the side similar 'clocktable-by-tags' post:
https://stackoverflow.com/questions/17353591/timetable-grouped-by-tag

This is similar to what I want, but not quite it. I'd like the classical clocktable report but only display entries that match certain tags. (REP meaining things that go on my weekly REPort.


texts:
I'm an amateur in Emacs and I would like to change TAB with C-q TAB. I used the code:

(define-key key-translation-map (kbd "TAB") (kbd"C-q TAB"))

But by doing so, I need to press TAB twice in order to get a indent and under the screen it shows C-q TAB TAB.

Why would this happen? How can I get the indent only by pressing TAB once?


texts:
I am trying to run emacs-daemon on a remote machine (connected via ssh), which was working fine. After I try to setup ports for mosh between 60000:61000 emacs-daemon started not to open :-(
The way I start emacs: emacsclient -t -q
echo $DISPLAY returns empty. Please note that I am not using any X11 connection.

$ emacs --version
GNU Emacs 27.1

$ emacsclient --version
emacsclient 26.3

The error output I get:
emacsclient: connect: Connection refused

Warning: due to a long standing Gtk+ bug
https://gitlab.gnome.org/GNOME/gtk/issues/221
Emacs might crash when run in daemon mode and the X11 connection is unexpectedly lost.
Using an Emacs configured with --with-x-toolkit=lucid does not have this problem.
Starting Emacs daemon.
Unable to start the daemon.
Another instance of Emacs is running the server, either as daemon or interactively.
You can use emacsclient to connect to that Emacs process.
Error: server did not start correctly
Error: Could not start the Emacs daemon

=> Could it be related to emacs version or ports? How could I debug and fix this issue?


texts:
I use Emacs in a corporate environment behind a proxy.
I have customized url-proxy-services:
 '(url-proxy-services
   (quote
    (("http" . "proxy:3128")
     ("https" . "proxy:3128"))))

I use the package tool:
(require 'package)

And I have customized the Melpa archives:
 '(package-archives (quote (("melpa" . "http://melpa.org/packages/"))))

When I run package-list-packages I see the packages and the list gets updated. This means the proxy gets used for this.
But when I try to install a package, Emacs stalls:
Importing package-keyring.gpg...done
Package refresh done
2 packages can be upgraded; type ‘U’ to mark them for upgrading.
2 packages marked for upgrading.
Upgrade these 2 packages (groovy-mode-2.0, s-1.12.0)? y
Package menu: Operation started [Upgrading 2]
Contacting host: melpa.org:80
Quit

When I sniff the network with tcpdump, I can see packets send directly to some hosts on port 80. This matches the last message "Contacting host: melpa.org:80".
Why does Melpa ignore the proxy for the download? And how can I change this?


texts: Projectile only sees project related to current buffer, if the buffer belongs to a project

texts:
I have two projects opened in my Emacs. Both are git repos and have .projectile files in their directories.

Relevant lines in my init.el

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

Problem:
projectile-switch-project (C-c p p) only shows a list containing the project related to current buffer. If I switch buffer to a file from the second project, the list contains just the second project. If I switch to a buffer not related to any project the list is empty.

When I disable Helm, then running C-c p p results in "There are no known projects" info in the minibuffer. Which is strange, because I see Projectile[projectdirname] in the modeline and for example C-c p f runs projectile-find-project-file as expected and lists the files from the current project.

I've tried projectile-invalidate-cache and projectile-cleanup-known-projects without success. Is there a trick (or an obvious step I have overlooked) to make projectile aware of opened projects?

platform: Windows7, Emacs version: GNU Emacs 25.0.50.1 (x86_64-w64-mingw32) and GNU Emacs 24.3.1 (i386-mingw-nt6.1.7601), Projectile 20150108.957 from Elpa.


texts: eshell grep thinks options are patterns on windows

texts:
I'm using Emacs on windows, and was trying to run grep from within eshell (M-x eshell). The default shell through M-x is cmd.exe, but eshell has linux utilities so I'm trying to use eshell.

Now, when i try grep with typical arguments, say -i to a case insensitive search, I get a message saying 'pattern "-i" not found'. So, the grep tool seems to think the option is the pattern. But if I give the exact patter without any options, and the exact filename to search in, it works. For example, this works:

> grep "Hello" main.c

It opens up a new buffer with the results which I can click on, or browse through

This is quite inconvenient. Any help to fix this would be appreciated.

Side note, I've tried using the WSL ubuntu bash and that works fine, except the PROMPT looks all messed up, and the results of grep are not clickable.


texts: org-capture fails: base buffer has been killed

texts:
I am trying to set up GTD for org-mode by Nicolas Petton. I have a very simple org-capture-template:

(setq org-capture-templates '(("t" "Todo [inbox]" entry
                               (file+headline "~/org/gtd/inbox.org" "Inbox")
                               "* TODO %i%?")))

Whenever I want to capture something, first Org-Select buffer opens and when I select the template, the buffer closes and it gives me the message Capture template 't': Base buffer has been killed.

There is nothing wrong with the template but I couldn't figure out what is going wrong.


texts: Make visual-line-mode more compatible with org-mode

texts:
visual-line-mode is very useful to wrap lines with the window size changing without inserting any newlines. But in org-mode, it also wraps the headline and source blocks which is a little bit annoying.

So here comes my question:
How can I turn off visual-line-mode for org-heading and source blocks permanently in org-mode?


texts: Inline the value of an Org-mode property?

texts:
Quite a while ago, I've created a word document where I defined variables, did
calculations with them, and had the results printed inline into the
document. Example output, where the result has been calculated from
variables a = 1 and b = 2:

“The result of 1 plus 2 is 3”

For org-mode, I found that I can defined properties, and do basic
calculations with them. But how do I output their values into running
text, i.e. without using a table.

Naturally, I want the calculated value to be visible in the text buffer
right in EMACS. If it’s only possible to see the value in an exported
PDF, for example, then that’s not interesting.


texts: tramp + async-shell-command ignores shell-file-name

texts:
If I locally call async-shell-command it takes the shell from shell-file-name (/bin/bash).

However if I use su or ssh via tramp to invoke a shell command remotely it always runs as /bin/sh.  The default shell on the remote box is bash.

This is not the case if run an interactive  M-x shell where the correct bash shell is always used, both remotely and locally.

My config looks like:

(setq explicit-shell-file-name "/bin/bash")
(setq shell-file-name explicit-shell-file-name)

I'm using emacs 25.3

Any ideas how to make bash the default shell when running shell commands via tramp?


texts: Customized c-offsets-alist override c-file-style in dir-locals

texts:
Assuming I customized my default C indentation settings through M-x customize-variable c-offsets-alist:

(custom-set-variables
 '(c-offsets-alist
   (quote
    ((statement-case-open . 0)
     (substatement-open . 0)
     (case-label . +)
     (access-label . -)
     (label . 0)
     (arglist-intro . +)
     (arglist-cont . 0)
     (arglist-cont-nonempty . +)
     (arglist-close . 0)))))

When I want to edit a project using a specific indentation file, there is (or I can create) a .dir-locals.el indicating it:

((c-mode . ((c-file-style . "GNU"))))

However, the c-offsets-alist from my configuration still override the c-file-style defaults.

I've tried setting c-file-offsets and c-offsets-alist in .dir-locals, but it didn't work; setting c-file-offsets to nil had no effect, and setting c-offsets-alist to nil completely disables indentation.

Is it possible to disable c-offsets-alist from having an effect when c-file-style is non-nil?


texts: Visual-line-mode and org-indent-mode are not working together

texts:
If I understand correctly, the documentation says the visual-line-mode should now play nicely with org-indent-mode. That is not the case for me. It seems very buggy!

Note when I first collapse all trees, one of them looks like it is not employing visual line mode. If I turn visual line mode off and back on, text bellow all headings is not employing visual line mode. Also, notice, if I edit the heading (in this case just adding a space), the text bellow correctly displays per visual lines.
Copy-pasted text is also not displayed correctly. My org configs are pretty long so I'll just show the relevant parts for now. Ask for more.
[snip]
  :hook
  (org-mode . org-indent-mode)
  (org-mode . visual-line-mode)
[snip]

This is how I turn the aforementioned modes on. Any help?


texts:
Can anyone think of a way to hide org-mode tags, perhaps something along the lines of this solution to completely hide the properties drawer?

I would love to hide tags but still have them searchable and be able to make them visible through cycling.

Ideas?


texts: Stop emacs treating touchpad scrolling like C-g in minibuffer

texts:
I have a ThinkPad with a trackpad, and emacs exits from C-s and also from interactive replace using M-%, whenever I brush my hand over the trackpad while touch-typing - which happens far too often. With my previous laptop I worked around this problem by disabling the trackpad completely, but I can't do that here because the trackpad is an important fallback for when my erratic Bluetooth mouse stops working. How can I make C-s and M-% ignore touchpad scrolling?

UPDATE: It's not caused by mouse movement as I originally thought, but by mouse scrolling, or something even more obscure. From C-h l I can see that emacs is interpreting my brushing the touchpad as mouse-4/5/6/7, so I've tried

(global-set-key (kbd "<mouse-4>") (lambda () (interactive)))
(global-set-key (kbd "<mouse-5>") (lambda () (interactive)))
(global-set-key (kbd "<mouse-6>") (lambda () (interactive)))
(global-set-key (kbd "<mouse-7>") (lambda () (interactive)))

but that doesn't fix the problem, it just stops emacs complaining.


texts: Search files with many search options. Is it possible?

texts:
Windows 10, Emacs 25.1

Suppose I have some folder (not project folder). In this folder I has 10 subfolders.

Suppose:

I has to find some file.
I don't what is the name of this file.
I exactly known that in this file has word "time"
I exactly known that this file has extension ".cpl"

So as result I want to have a next possibility for search:

Use mask (e.g. "*.cpl")
Containing text: "time"
Show search history
Case sensitive
Whole word only
hex,  e. Search file that has content AEFF
Inverse (not content text)
Search in archives, e.g search file I zip files
Search only in

in root disk C:

in current folder

in selected folders (e.g. search only in subfolder5 and subfolder7)

in PATH folders (in environment variables)

Is it possible in Emacs? Or maybe has some package that can do all of this?


texts: Why can't Emacs find gfortran on my Mac?

texts:
I have tried to compile a simple helloworld.f95 on my Mac, using emacs.
The root of emacs was set in the directory containing helloworld.f95.
I used the following commands

M-x compile
gfortran -o helloworld helloworld.f95

I got the following error:

-*- mode: compilation; default-directory: "~/Desktop/fortran/" -*-
Compilation started at Wed Sep  4 17:37:51

gfortran -o helloworld helloworld.f95
/bin/bash: gfortran: command not found

Compilation exited abnormally with code 127 at Wed Sep  4 17:37:51

I have previously been able to compile with the same command on the terminal.
Fortran was installed on my mac by following the instructions on this link:
http://www.lapk.org/gfortran/gfortran.php?OS=7

The location in which gfortran is installed is at:

Desktop$ which gfortran
/usr/local/bin/gfortran

How do I compile .f95 files from emacs, as well as run them?


texts:
I recently came across a python file "*.py" containing several prints consisting of unicode symbols. I noticed that several symbols are
displayed with different glyphs in emacs than in another editor.
Specifically, the glyphs in emacs seem to be wrong, i.e. not
the ones intended to be displayed. The file is encoded in
utf-8 (as is allowed in case of python files).

One specific case is the symbol Δ (capital Greek Delta, \u0394).
I typed list-charset-chars, followed by unicode-bmp. The
corresponding table is the following:

    0   1   2   3   4   5   6   7   8   9   A   B   C   D   E   F
30x ̀   ́   ̂   ̃   ̄   ̅   ̆   ̇   ̈   ̉   ̊   ̋   ̌   ̍   ̎   ̏
31x ̐   ̑   ̒   ̓   ̔   ̕   ̖   ̗   ̘   ̙   ̚   ̛   ̜   ̝   ̞   ̟
32x ̠   ̡   ̢   ̣   ̤   ̥   ̦   ̧   ̨   ̩   ̪   ̫   ̬   ̭   ̮   ̯
33x ̰   ̱   ̲   ̳   ̴   ̵   ̶   ̷   ̸   ̹   ̺   ̻   ̼   ̽   ̾   ̿
34x ̀   ́   ͂   ̓   ̈́   ͅ   ͆   ͇   ͈   ͉   ͊   ͋   ͌   ͍   ͎
35x ͐   ͑   ͒   ͓   ͔   ͕   ͖   ͗   ͘   ͙   ͚   ͛   ͜   ͝   ͞   ͟
36x ͠   ͡   ͢   ͣ   ͤ   ͥ   ͦ   ͧ   ͨ   ͩ   ͪ   ͫ   ͬ   ͭ   ͮ   ͯ
37x Ͱ   ͱ   Ͳ   ͳ   ʹ   ͵   Ͷ   ͷ   ͸   ͹   ͺ   ͻ   ͼ   ͽ   ;   Ϳ
38x ΀   ΁   ΂   ΃   ΄   ΅   Ά   ·   Έ   Ή   Ί   ΋   Ό   ΍   Ύ   Ώ
39x ΐ   Α   Β   Γ   Δ   Ε   Ζ   Η   Θ   Ι   Κ   Λ   Μ   Ν   Ξ   Ο
3Ax Π   Ρ   ΢   Σ   Τ   Υ   Φ   Χ   Ψ   Ω   Ϊ   Ϋ   ά   έ   ή   ί
3Bx ΰ   α   β   γ   δ   ε   ζ   η   θ   ι   κ   λ   μ   ν   ξ   ο
3Cx π   ρ   ς   σ   τ   υ   φ   χ   ψ   ω   ϊ   ϋ   ό   ύ   ώ   Ϗ
3Dx ϐ   ϑ   ϒ   ϓ   ϔ   ϕ   ϖ   ϗ   Ϙ   ϙ   Ϛ   ϛ   Ϝ   ϝ   Ϟ   ϟ
3Ex Ϡ   ϡ   Ϣ   ϣ   Ϥ   ϥ   Ϧ   ϧ   Ϩ   ϩ   Ϫ   ϫ   Ϭ   ϭ   Ϯ   ϯ
3Fx ϰ   ϱ   ϲ   ϳ   ϴ   ϵ   ϶   Ϸ   ϸ   Ϲ   Ϻ   ϻ   ϼ   Ͻ   Ͼ   Ͽ

This seems correct, however, the situation looks differently in emacs:

Specifically, the Delta is replaced by a strange-looking glyph instead.

I reproduced this using emacs -q, so it is not my specific dotemacs
causing this problem (although it could be another part of my setup,
such as the installed fonts).

Q: What am I doing wrong, how can I fix the behavior?


texts: Save search and replace queries for future use

texts: I was wondering if anyone knew of a way or recommend a method to save often use search and replace queries for future use after emacs restarts?


texts:
I'm editing an HTML file that also contains CSS and Javascript. I would like to keep this in an Org file with each in separate blocks like

#+BEGIN_SRC css
CSS code ...
#+END_SRC

#+BEGIN_SRC js
Javascript code ...
#+END_SRC

#+BEGIN_SRC html
html ...
#+END_SRC

so that when I edit the blocks with "C-c '" I can be in the proper mode. However the HTML block needs to include (substitute) the other 2 blocks verbatim, but Org wants to "evaluate" them, which doesn't make sense in this case. I haven't found a way to make a variable contain a whole named block literally and then be substituted. Is this possible?


texts: How can I get VolatileHighlights to work with evil-yank, evil-delete, etc?

texts:
With the guide on extending Emacs, I discovered the volatile highlights package.

But it only works on Emacs operations like kill and yank. I would like to use it with Evil operations like evil-yank evil-delete, and evil-paste-after.

I thought about advising those functions with defadvice, but that didn't work.  Any other suggestions for getting it working with Evil?


texts:
I have a whole series of curl commands that I would like convert into ob-http code blocks in a org file (second choice would be to do them in restclient).

Here is a simplified sample command:

curl -X POST
     --proxy http://my-proxy.local:9001 \
     --data "foo=bar" \
     --data "fizz=buzz" \
     --header "Content-Type:application/x-www-form-urlencoded" \
     --header "my-custom-header" \
     http://my-server.local/my/endpoint

(The resulting json passed back by this call would be used in the next call)

How can I convert the above into ob-http code block (or, restclient text file if ob-http cannot support)

I found this old question, but it does not fully cover my use case, and I didn't see in the linked docs how to accomplish the above conversion:
How to test REST API with Emacs?


texts: Specifying a binding for control shift tab?

texts:
I defined a function like this:

(defun switch-to-prev-window ()
  (interactive)
  (other-window -1))

and it appears to work if I call it with M-x.  But I've added the binding

(global-set-key [(control shift tab)] 'switch-to-prev-window)

and that does NOT seem to work. In fact when I use M-x to run it, it reports you can run the command 'switch-to-prev-window' with <C-S-tab>.  But when I type ctrl-shit-tab I see <C-S-iso-lefttab> is undefined.   And yet

(global-set-key [(control tab)] 'other-window)

seems to work fine.  Based on the error message I tried

(global-set-key [(control shift iso-lefttab)] 'switch-to-prev-window)

and that works fine too.

So I'm left wondering: is control tab aliased to control iso-lefttab, but there's no corresponding control shift tab alias?  And yet if that were the case, why the reminder that <C-S-tab> is available?


texts:
Windows 10, Emacs 25.1.

Suppose I open file D:/temp/test/myfile.txt.
But in the in the mode line show only file name (myfile.txt).

But I need to show FULL path to file:
D:/temp/test/myfile.txt

This path can show on mode line OR in the frame title.
How I can do this?


texts: How to use unicode for the checkbox in customize buffers (**not** in org mode)?

texts: I'm trying to modify the appearance of customize buffers. I managed to modify the button but I did not find how to change the appearance of the checkbox nor the dropdown indicator (▽). Ideally I would like to replace them with corresponding unicode glyphs. You can see what is the "real" character using describe-char but I'm a bit clueless on where the translation into images occurs and how to modify it.


texts: How to tangle all code blocks to a common file

texts:
I am planning to keep my .emacs file settings inside an org file which I can then tangle to a .emacs file. However, for every emacs-lisp block I don't want to have to type the redundant :tangle .emacs everytime.

e.g.

Description of flim-flam

#+BEGIN_SRC elisp :tangle .emacs
<flim-flam>
#+END_SRC

Description of foo-bar

#+BEGIN_SRC elisp :tangle .emacs
<foo-bar>
#+END_SRC

What must I include at the top of the Org document so that all code blocks (unless explicitly marked :tangle no) are automatically tangled into the same file say .emacs?

(This question applies to Org mode ≥9.0. For older versions, see Specify global tangle file for source code export in Org mode 8.x)


texts: org babel :exports always exporting both code and results

texts:
It seems that :exports option has no influence when exporting to HTML or PDF.
I am using Org 9.0.9 and Emacs 25.1.1.

The following code, for example, even with :exports=none both code and results are exported to the output.

 #+TITLE: my document
 #+AUTHOR: Alice Bob

 * one section
  ia oja jofij aofjodfj
 ** sub section
 sd sssioj oi j

 #+NAME: named-block
 #+HEADER: :var data=2
 #+BEGIN_SRC emacs-lisp :exports none
   (message "data:%S" data)
 #+END_SRC

 #+RESULTS: named-block
 : data:2

Anyone has the same issue?


texts: Automatic package install is not available, package exists

texts:
I want to automatically install packages that I don't have locally installed when I initialize Emacs. I use the following code to install some packages.

(package-initialize)
(mapc #'(lambda (pkg)
           (if (not (package-installed-p pkg))
                     (package-install pkg)))
            (list
             'json-mode
             ; ...

However, when loading Emacs, Emacs says the package is not available for installation. However, it exists on the packages buffer.

error: Package `json-mode' is not available for installation

Does anyone know what I am doing wrong?


texts: Magit remove local branches that were merged into another branch

texts:
Explaining the problem more in-depth than the titular definition:
Often I merge branches into master and want to prune based on that. M-p works fantastic for removing the remote branches (eg origin/mergedbranch) but not the local branch (eg mergedbranch) that referenced it before. I'm left with branches like the in the screenshot below.
There seem to be a lot of cli git commands such as this SO answer, but I was wondering if there was a magit equivalent.


texts: File local export filter functions - Org Mode

texts:
I have the following code within an org file:

#+BEGIN_SRC emacs-lisp :exports both :results none :eval export
(defun my-html-body-onload-filter (output backend info)
  "Add my onload attribute to<body>  tag, if any."
  (when (and (eq backend 'html)
             (string-match "<body>\n" output))
    (replace-match "<body onLoad=\"setUp();\">\n" nil nil output)))

(add-to-list 'org-export-filter-final-output-functions
           'my-html-body-onload-filter)
#+END_SRC

The problem with this setup is that it permanently adds this function to the list, so that every org-mode file that I export goes through the same filters.

How can I make these filters file local?
I tried using the following too, but it didn't work, i.e., the export was not filtered:

# Local variables:
# eval: (add-to-list 'org-export-filter-final-output-functions 'my-html-body-onload-filter)
# End:


texts: Can I clock a duration without a start/end time in org mode?

texts:
I just want to indicate that a task took 2 hours - I don't care when it started or ended, and I'd prefer not to put in false info for that!
Is there a way to do this?


texts: Make the org-habit agenda display further into the future

texts: I've started using org-mode these past few days, and I've set up a few org-habits. I'm having trouble with the consistency graph and agenda mode however. Habit TODOs only seem to show up for habits that are due today. How can I make the org agenda show habits further into the future?


texts:
I just installed Helm and it looks really cool.  However, I don't understand how to use dired anymore.

I'd usually C-x d to see my directory, then I could do operations like add or delete files.  Now I get a helm dired buffer, which is super fast, but when I scroll to the file I'm looking for and type 'd', it's just doing auto-complete, not in a mode where I can do file operations.

What should I do instead?

My init.el has the minimal, vanilla helm additions:

(require 'helm-config)

(global-set-key (kbd "M-x") #'helm-M-x)
(global-set-key (kbd "C-x r b") #'helm-filtered-bookmarks)
(global-set-key (kbd "C-x C-f") #'helm-find-files)
(helm-mode 1)


texts: How to font lock the second token on a line of tokens

texts:
I'm trying to font lock some tokens in a simple text file, without
picking up adjacent tokens. For example, here are some example lines that I have been working with:

name: foobar (&optional arg1 arg2)
key:  somechars-1
(defun my-fun-name

I want to recognize and font lock the second token on each line -- "foobar", "somechars-1", or "my-fun-name",  without matching "name:", "arg1", or "key:". I've tried using re-builder and a bunch of regexp examples from the net, but without success.

I've tried what I know from using font-lock-defaults in major/minor modes, but what I know is not doing the job.

It's easy to match and font lock tokens with unique syntaxes (like pathnames), or to match the whole line, or both the key: and first token of the value. But I can't figure out how to match only the second token on each line, when there are other (optional) tokens on the same line, with the same syntaxes.

Various language modes do this (eg Lisp mode font locks the defun names), but I don't know how they do it. I looked at the lisp-mode code with pcase-let matching patterns, and could see them matching keywords, error tokens, etc, but I couldn't recognize anything that showed how it matches the second token on a line.

Perhaps I am using the wrong approach, thinking in a "font-lock-defaults" way for a major mode. Those kinds of regexp matches are global kinds of things. Maybe the only way to do what I want is to parse the lines, mark off the special tokens programmatically, and font lock them individually. I don't know the right answer (or maybe even the right approach).

Perhaps someone could explain how to do this with a short example, or point me to some kind of a reference doc that explains how to do this kind of font locking matching. (or how to match the nth token on a line, when all the syntaxes are the same (eg foobar and arg1 in my example above). Thank you


texts: icicles search and replace; need help to do a successfull replace

texts:
I try to use Icicles to search and replace. I understand to search with it (some details, that I need), but I'm unable to do a replace.
The link below shows a recipe, that I try to follow, but it doesn't seem to work.
Question on stackoverflow
Here is a recipe to do a search and replace:

this is text1
this is text2
and this is text3

I want to search for the string text and replace it with othertext.
Set option replacing whole search context to nil in my config.
Here we go:

Initiate Icicles search: Menu: Edit-Search-Icicles-Search(regexp) or M-s M-s M-s
Type text
S-TAB and see the contexts
C-down to first candidate. I do not want to narrow further on.
Minibuffer shows choose an occurrence: text. Cursor in the minibuffer is at the end of text .
I press S-RET. Nothing happens... no prompt.

Unfortunately that's it. What is wrong?


texts: in yasnippet, how to insert variable date with fixed time of day?

texts:
I want a yasnippet to insert an org-mode date and time.

The date should be today's date, but the time should be fixed.

So far my snippet correctly inserts today's date, but not the time:

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

* TODO meditate
  SCHEDULED: `(let ((x (org-insert-time-stamp (current-time)))))`

How do I get the time (8:30am) inside the timestamp?

Desired output:

* TODO meditate
  SCHEDULED: <2015-09-18 Fri 8:30am>


texts: Complete using match in middle of string - work with pop-up list?

texts:
I'm trying to use auto-complete to match in the middle of a string (after the characters ::). I'd like to typing a then hit tab and have the list of candidates appear 'in full' e.g. fruit::apples, others::apples, veg::asparagus.

So far, I'm approaching this using an alist:

(setq l1 '(("apples"  "fruit::apples")
       ("apples"  "other::apples")
       ("bananas"  "fruit::bananas")
       ("asparagus"  "veg::asparagus")))

The completions are matched to the car of each element in l1 but return the cdr. The 'prefix' part always ends with :: and I would prefer to avoid using alternatives such as fruit-apples...

Here is a function which prompts in the minibuffer and can display a list of candidates in another window:

(defun f1 () "
Replaces text at point with completion, including the appropriate prefix"
       (interactive)
       ;; ac1 = all completions
       ;; lc1 = list of completions
       (let ((tap1 (thing-at-point 'symbol))
         ac1
         (lc1 ())
         (resize-mini-windows t)
         (p1 (point))
         elem1 r1)
     (when (not tap1) (set 'tap1 ""))
     (set 'ac1 (all-completions tap1 l1))
     (mapc (lambda (elem1)
         (when (member (car elem1) ac1)
           (push (cdr elem1) lc1)))
           l1)
     (set  'lc1 (mapcar (lambda (x) (print (car x))) lc1))
     (set 'elem1 (concat "Complete " tap1 " (TAB for selection) : "))
     (set 'r1 (completing-read elem1 lc1))
     (delete-region (- p1 (length tap1)) p1)
     (insert r1)))

so that if I call f1 when at text that says a I can replace it as desired.

Now, is there any way to adapt auto-complete to behave like this? I've been going through the source files and can't figure out where I should replace the usual list of (all-completions STRING COLLECTION) with the list which includes the prefixes.

Is there a simpler way to do this? Should I be looking at company-mode instead?


texts: How to skip forward to first whitespace character?

texts:
What is the easiest way to skip forward to the first whitespace character after the current cursor?  I used to do it just by searching for a space (when I knew there was one there), but now that seems to behave like forward-whitespace (not sure when this behavior switched, maybe when I transitioned to emacs 24.  This is a function I need all the time when defining macros interactively.

Fwiw, forward-whitespace doesn't work for me because it skips to the last whitespace character in the first block of whitespace after the current cursor.


texts: What type of variable binding is setq creating?

texts:
What type of variable binding or variable or symbol is setq creating, when the variable hasn't been declared prior setq?
Given following source code:
;; -*- lexical-binding: t; -*-

(defun setq-x ()
  (setq x 10))

(defvar y 20)

(setq-x)

(message " variable values: x: %i, y %i\n special-var status: x: %s, y: %s"
         x
         y
         (special-variable-p 'x)
         (special-variable-p 'y))

The source code above outputs:
 variable values: x: 10, y 20
 special-var status: x: nil, y: t

I did not expect this output, and I could not find an explanation in the documentation[1].
Since setq is used so often in Elisp without prior declaration of a variable, I regard this question as somewhat important.
[1] mentioned documentation:
https://www.gnu.org/software/emacs/manual/html_node/elisp/Setting-Variables.html#index-setq
https://www.gnu.org/software/emacs/manual/html_node/elisp/Variable-Scoping.html
https://www.emacswiki.org/emacs/DynamicBindingVsLexicalBinding


texts: Why does my *vc-log* buffer start with "Summary:" in Emacs 24.4?

texts:
I just upgraded to Emacs 24.4 (from 24.3).  Now, whenever I run vc-next-action on a modified file, the *vc-log* buffer that comes up starts with the word "Summary:" in log-edit-header face, followed by a line of inverse video.

This wasn't happening in 24.3, but I can't find anything about it in NEWS.  What's going on?  I see this in both Git and Subversion working copies.


texts:
I wrote a function that pastes in the currently selected color from the palette to the buffer:

(defun palette-paste-in-current-color ()
  (interactive)
  (cua-paste (palette-current-rgb-to-kill-ring)))

I wrote a function that calls the palette from the current content of the kill ring (RGB content):

(defun palette-launch-from-kill-ring ()
  (interactive)
  (palette (concat "#" (substring-no-properties (car kill-ring)))))

I thought it would be handy to just move the point to an rgb color in a buffer, then use expand-region followed by cua-copy-region to automate the process. So I wrote:

(defun palette-launch-from-kill-ring ()
  (interactive)
  (er/expand-region)
  (cua-copy-region)
  (palette (concat "#" (substring-no-properties (car kill-ring)))))

But I get an error and I am puzzled on how to run these functions one after another successfully.

EDIT:

The error I get is (can't decipher what is going on here):

apply: Wrong number of arguments: #[(ad--addoit-function arg) "Ä        Å
!)" [ad-return-value rectangular-region-mode ad--addoit-function arg nil rrm/switch-to-multiple-cursors] 3], 1


texts:
I am using counsel-buffer-or-recentf in order to toggle in files under buffer and recentf. The selected line is not clear, which has blue background highlighting.

=> Is it possible to change the coloring of the highlight? or can I remove the highlights?


texts: Time-formatted output from org-table date- and time calculation?

texts:
I have an org-table for my timesheets. Part of it looks this:

| Start              | End                    | End - Start |
| <2020-03-05 10:00> | <2020-03-05 Thu 14:30> |      0.1875 |
#+TBLFM: $3=$2-$1

How can I get that "0.1875" to turn into "4:30"?

(Spac)emacs/calc/org-mode has undestood that they are dates (org-toggle-time-stamp-overlays works on them and the colours change). Perhaps this is the

  algorithm generally “does the right thing”

from Free-Form Dates <- Date Formats <- Display Modes <- Mode Settings <- Calc-manual
And the subtraction is correct (24 hours * 0.1875 = 4.5 hours)
But it gives me the duration as a decimal number of a 24 hour day, as per

  Subtracting two date forms computes the number of days between them (represented as a simple number)

from Date Forms <- Data Types <- Calc-manual

Options

"floor($3*24)
to get just the hours, and then separate out the minutes, get the result into the same cell, perhaps even with the formatting I want. Ugly, and seems unnecessary. The software already has some understanding of dates
time($2-$1) - I just happened to try this right before starting to write this post. floor had worked, so why not?

| Start              | End                    | time(End - Start) |
| <2020-03-05 10:00> | <2020-03-05 Thu 14:30> | 4@ 30' 0"         |

#+TBLFM: $3=time($2-$1)

That's more like it. I recognise this format. It's mentioned in HMS Forms <- Data Types <- Calc-manual

And time is one of the functions from the Index of Algebraic Functions

Now in HMS Forms, it says

  Display format for HMS forms is quite flexible. See HMS Formats

HMS Formats <- Display Modes <- Mode Settings <- Calc-manual

  The [(calc-hms-notation)] command controls the display of HMS (hours-minutes-seconds) forms. It prompts for a string which consists basically of an “hours” marker, optional punctuation, a “minutes” marker, more optional punctuation, and a “seconds” marker. Punctuation is zero or more spaces, commas, or semicolons. The hours marker is one or more non-punctuation characters. The minutes and seconds markers must be single non-punctuation characters.

But entering these seems to have no effect. I've tried
hms No change

h;m;s No change

hh, mm, ss which gives error "Bad hours-minutes-seconds format"

hh;mm;ss which also does, so maybe it's the double h

h;mm;ss this one too, so maybe it's the double anything

No changes at all, which makes me think I've messed up somewhere else. I've restarted Spacemacs as well, and that didn't help.

It seems to me that I should not use org-mode's Durations and time values, because

  Input duration values must be of the form ‘HH:MM[:SS]’

and I want time and date to be in the same cell. I sometimes work past midnight

Somewhat related:

Calculating with timestamps in org-mode tables

Org mode time sheet

Edit 8mar2020:

Table formula for dates delta is similar. I'd say this question is different in that I ask whether HH:MM is possible without an extra day-column, and without editing (spac)emacs' config.


texts: When creating an org-agenda-custom-commands command, how can I make the (agenda) portion only display certain tags?

texts:
I add custom org-agenda commands to the org-agenda-custom-commands like so

  (setq w-view
           `("W" "Work"
             (
              (agenda ""
                      (
                       (org-agenda-span 'day)
                       (org-deadline-warning-days 365)
                       ))
              (tags-todo "work"
                         ((org-agenda-overriding-header "All Work")
                          (org-agenda-files '("~/Dropbox/org/inbox.org"))
                          (org-agenda-sorting-strategy '(deadline-up priority-down tag-up))
                          ))
              (tags-todo "work"
                         ((org-agenda-overriding-header "Work Projects")
                          (org-agenda-files '("~/Dropbox/org/projects.org"))
                          (org-agenda-sorting-strategy '(deadline-up priority-down tag-up))
                          ))
              nil
              )
             )
           )
  (add-to-list 'org-agenda-custom-commands `,w-view)

I understand that items can start with "agenda," "tags-todo," or "tags," and possibly other things, though I'm not clear on what exactly as the documentation doesn't say.

I do know that an agenda item shows my TODO items that have deadlines or are scheduled, in order and with their timestamps. I also know that I can create custom headers, i.e. like I do for "All Work" or "Work Projects." I know that I can determine what TODO items are displayed under those custom headers because I start those sections with tags-todo.

What I don't understand is how I can make a custom section that starts with agenda only show TODO items of a certain tag.

I've tried the following:

          (agenda ""
                  ((tags-todo "work")
                   (org-agenda-span 'day)
                   (org-deadline-warning-days 365)
                   ))

Which didn't throw any errors but also shows all TODO items regardless of tags, i.e., didn't change anything.

When making a custom org-agenda-custom-commands view, and using the "agenda" custom header identifier, how can I make that custom agenda view only display certain tags?

I'm not sure what to call the "agenda" or "tags-todo" or "tags" custom header identifier, help in the vocabulary sense so I can edit and clarify this question would be appreciated.


texts:
I am managing my bibliography with John Kitchin's org-ref package. I want to create an @film entry type with a few custom fields. So in my init.el file, I have:

;; Create fields for Film type
(add-to-list 'bibtex-biblatex-field-alist
  '(("director" "Director(s) of a film, video or DVD title")
    ("producer" "Producer of the film title")
    ("distributor" "Distributor of a film title")))

;; Setup Film type
(add-to-list 'bibtex-biblatex-entry-alist
  '("Film" "Film, video or DVD"
    ("title" "year" "type")
    nil
    ("director" "producer" "distributor" "address")))

;; Use BibLaTeX to process your bibliographies
(bibtex-set-dialect 'biblatex)

Now the question remains as to how I should tell org-ref that "director" and "producer" should be treated as authors and "distributor" should be treated as a publisher, when producing the citation?

For the author aliases, the BibLaTeX Manual recommends something like this:

\DeclareLabelname{%
  \field{director}
  \field{producer}
}

But adding #+latex_header: \DeclareLabelname[film]{\field{director}\field{producer} to my org document does not have any effect?

Is there perhaps another bibtex.el variable I should customize?


texts: Abbrev-mode is not counting a number of expanding

texts:
When I use abbrev-mode in Emacs 27, it works very nicely.
However, the counting for the expanding word always shows :count 0 after restarting emacs like below:
("tt" "test" nil :count 0)
My configuration is like this:
(setq-default abbrev-mode t)
(setq save-abbrevs t)
Please let me know how to update or preserve the count numbers in the abbrev_defs file!!!
[FYI] 36.6 Abbrev Properties


texts: How to specify the (sub)directory for source and compiled files when evaluating Java codeblocks in org mode?

texts:
I use Org Mode with Java codeblocks.
When I evaluate a codeblock the source files and the compiled files (*.class) are saved in the same directory as the Org file with the codeblocks.

How can I change the directory, where the source and compiled files are saved?


texts: create org split agenda view, problems with differnt agendas in split windows

texts:
I have written this crappy code (i cant really code) to save a split orgmode agenda views with different agenda views.

(defun z/buffers-restore-agenda-split   ()
 (interactive)
 (org-agenda nil "a")
 (split-window-right)
 (org-agenda nil "ba")
 (split-window-below)
 (org-agenda nil "bb")
 )

the function does split the windows correctly yet all the views get the last option ("bb") instead of a different view in each window

any clue why this happens?


texts: Emacsclient not focusing if called with --eval argument from terminal

texts:
I wish to call man function in emacsclient when I typing "man smth" in terminal. When I open files from iterm via emacsclient - emacs gaining focus and when I kill buffer - terminal gaining focus back. But when I want not open file but evaluate "man ls" for example - its evaluating in emacs, but not switching to emacs and when I close man buffer its not switching back.

Here's my command to open man page from iterm in emacs:

emacsclient -c -e "(man \"ls\")" -a ""

Can anyone point me what am I doing wrong plz? Thx.


texts: Required color-theme file missing in Emacs 26

texts:
After upgrading my OS (Ubuntu, from 18.04 to 19.04), my favorite text editor was automatically upgraded from Emacs 25 to Emacs 26. I then encountered a familiar error message at start-up:

File is missing: Cannot open load file, No such file or directory, color-theme

The relevant portion of my configuration file, .emacs, is the
following:

(add-to-list 'custom-theme-load-path "~/.emacs.d/themes/")
(add-to-list 'load-path "/path/to/color-theme.el/file")
(require 'color-theme)
(eval-after-load "color-theme"
    '(progn
     (color-theme-initialize)
     (color-theme-subtle-hacker)))

This works fine with emacs 25 or earlier versions, under Ubuntu
18.04. Naturally, the relevant file, color-theme-subtle-hacker.el is
located in ~/.emacs.d/themes/.

I imagine that there are at least two possible solutions to this problem:

(i) There is a way to "tell" Emacs 26 where is the relevant
color-theme package. The problem could, in fact, be due to the
OS upgrade.

(ii) I could also force Ubuntu 19.04 to use Emacs 25. However, I would have
to install it manually, since every attempt at installing Emacs
currently leads to version 26.


texts:
I am using a %^T element in my org-capture-template. This prompts me this need calendar buffer, where I can pick a date.

I can move around by using SHIFT+<arrow>. It maps to calendar-forward-day. How can I change the time in this view?

Is there something similar like add one hour or set minutes to 00?


texts:
I'd like to fold each word in a header in org-mode. In other words, I'd like to toggle between this view:

* emacs is fun

and this view :

* e i f

and hopefully toggle each word like :

* e is f

or

* e i fun

How can I achieve this?


texts:
I observed that directory local variables, defined in .dir-locals.el, are set for files, dired-buffers, new buffers, but not for shell or eshell buffers (well, that is also the case for buffers generated with get-buffer-create or generate-new-buffer and surely a ton of other similar functions).

My question now is, how would I trigger the search and evaluation of .dir-locals.el, so I could do this in an around advice? Or can I somehow enable it for shell and shell-command?


texts: Fold all methods in a Python class with Evil

texts:
How can I fold all the methods in a Python class?  I use Evil and would prefer a pure Evil solution, if possible.

I'm looking for a quick way to take something like this:

class LongClassIDidNotWrite():

    def method1():
        junk...
        junk...
        junk...

    def method2():
        junk...
        junk...
        junk...

    def method3():
        junk...
        junk...
        junk...

and make it look like this:

class LongClassIDidNotWrite():

    def method1():
    def method2():
    def method3():

I don't care if it has a ... at the end of the line or has a pretty {{{}}} notation telling me the number of lines folded.  I just want it to fold!

I know I can press zc within a method to fold it.  If I try something like VGzc, it doesn't fold.  The fastest thing I've come up with is to record a macro qazc]]q and then replay it doing something like 100@a.

Looking at how Vim does it, posts say to :set foldmethod=indent.  To which Evil says,

  "State foldmethod=indent cannot be set as initial Evil state".

I've tried vimish-fold, along with evil-vimish-fold as well as origami.  I can't get them to fold the methods within a class like above.  They supposedly "just work".  But that's not what I'm experiencing.  Before I waste more time doing trial-and-error and scrounging, is there something I'm missing?  It seems like this problem would be solved already.


texts: Function matcher with font-lock-keywords anchored highlighter

texts:
I can highlight text like the following:

constant:'variable,variable'

with code like this which uses the anchored matcher form:

(font-lock-add-keywords
 nil
 '(("\\(constant\\):'" (1 font-lock-constant-face t)
    ("\\(variable\\)[,']" nil nil (1 font-lock-variable-name-face t))))
 'append)

Which works fine. The 'constant' and 'variable' parts are highlighted correctly.

However, it fails on text like this:

constant:'variable,variable' constant:'variable,variable' constant:''

The first 'constant' is correctly matched by the anchor, the first 2 'variable' are matched by the variable regexp, but then it rampages on to match the other 'variable's, so when the anchor regexp resumes it can't match the second 'constant.

I guess I need to make the 'variable' matcher give up after it matches a closing quote. So I tried this:

(defun my-variable-search (limit)
  (if (save-excursion
        (re-search-backward "variable'\'" 0 'go))
      nil
    (re-search-forward "\\(variable\\)[,']" limit 'go)))

(font-lock-add-keywords
 nil
 '(("\\(constant\\):'" (1 font-lock-constant-face t)
    (my-variable-search nil nil (1 font-lock-variable-name-face t))))
 'append)

But it doesn't work.

Am I completely off track or have I made a stupid mistake?


texts: Emacs doesn't let me exit without selecting a coding system

texts:
Sometimes to speed up of opening an emacs' eshell directly from terminal (in my case from MS DOS prompt), I do emacs -Q -f eshell. But when I try to exit emacs doesn't let it, unless I give some input to the below message in the mini-buffer.

select coding system (default utf-8):

This is really undesirable. I just like to exit and I don't care about the encoding. Is there a way to bypass this message?

Added 2:
In the * Warning * buffer I get

These default coding systems were tried to encode text
in the buffer ` *temp*':
  (iso-latin-1-dos (718 . 1575) (719 . 1606) (721 . 1583) (722 . 1604)
  (723 . 1582) (724 . 1608) (725 . 1575) (726 . 1607) (728 . 1575)
  (729 . 1585) (730 . 1575))
However, each of them encountered characters it couldn't encode:
  iso-latin-1-dos cannot encode these: ا ن د ل خ و ا ه ا ر ...

Click on a character (or switch to this window by `C-x o'
and select the characters by RET) to jump to the place it appears,
where `C-u C-x =' will give information about it.

Select one of the safe coding systems listed below,
or cancel the writing with C-g and edit the buffer
   to remove or modify the problematic characters,
or specify any other coding system (and risk losing
   the problematic characters).

  utf-8 gb18030 utf-7 utf-16 utf-16be-with-signature
  utf-16le-with-signature utf-16be utf-16le iso-2022-7bit utf-8-auto
  utf-8-with-signature utf-7-imap utf-8-emacs

It appear the buffer * temp * is the last entries of my previous eshells.

After a search, I found a post http://sourceforge.net/p/cedet/mailman/message/23702016/, by David Engster in which it is suggested that a bug is responsible for this.

I am not sure what to do.

Added 2: I should mention that if I go to eshell without the argument -Q this problem doesn't arise.


texts: org-mode capture template prompt directly to agenda without opening file

texts:
I defined a template like so

 ("g" "Godo"
          entry
          (file+headline "~/mega/org/gcal.org" "Tasks")
          "* TODO %^{description}%?\n %T %i\n %a")))

and when pressing C-c c g I am prompted for a descpription. But after putting it in and hitting return, I am still taken to the file gcal. how can I achieve that the text I enter in the minibuffer is just combined with the current date and put into the gcal file without putting me in the capture template buffer?


texts: Using org-mode babel, how do I quickly export some html soure block to a separate file?

texts:
I am taking notes on a course in org-mode. I am using HTML source-blocks to write down examples of html code. This serves me because I have text and code in one file and it will be easier to export it to a blog for example.
#+begin_src html
  #some html code
#+end_src

However, sometimes I want to test the code in a source block and would want to export it to a separate html file. Any tipps on how to achieve this quickly? Exporting via C-c C-e h o always exports the whole buffer or the subtree. But I want to export only the code in the source block.
Any tipps on how to do this?


texts: How to get keystrokes displayed in the echo area immediately?

texts:
How do I get keystrokes displayed in the echo area immediately?

For example: when I enter the key sequence C-u j, it will not display in the echo area immediately, but then I press key k, and I discover that I was making a typo beforehand.  So, I think it will helpful for a newbie like me when I hit some keys to call a command for the echo area to show them immediately.


texts: How to start a process with multiple arguments?

texts:
Instead running sudo su joe -s prime-run firefox in the shell I'd rather bind it to a key.
Yet, nothing happens on pressing M-n (while M-i works).
What am I doing wrong?
(setq exwm-input-global-keys
      `(
        ;; Working >> Run firefox
        ([?\M-i] . (lambda ()
                     (interactive)
                     (start-process "" nil "/usr/bin/firefox")))

        ;; Not working >> Run firefox on the GPU
        ([?\M-n] . (lambda ()
                     (interactive)
                     (start-process "" nil "/usr/bin/sudo su joe -s /usr/bin/prime-run /usr/bin/firefox")))
        )
      )


texts: Can Gnus nnimap split articles to other imap server?

texts:
At work we have a limited storage quota on the email server so I have set up Dovecot on my laptop as an email archive that I also access using IMAP.  Besides archiving I also store all email from mailing lists on the local server.

Recently I have been trying to rid myself of Thunderbird and use Emacs for all emailing and as part of that I have migrated my filter rules to nnmail-split-fancy rules.  However, so far I have not been able to get nnmail to successfully move email from my inbox (company IMAP) to my archive (local Dovecot IMAP), is this at all possible to do?

My configuration looks something like this:

(add-to-list
 'gnus-secondary-select-methods
 '(nnimap "me@company.com"
          ...))
(add-to-list
 'gnus-secondary-select-methods
 '(nnimap "me@company.com-archive"
          ...))

(setq
 nnimap-split-methods 'nnmail-split-fancy
 nnimap-split-download-body-default t
 nnmail-split-fancy
 '(|
   (: nnmail-split-fancy-with-parent)
   (list ".*linux-users.*"
         "me@company.com-archive:Mailing Lists.Linux Users")))

I also tried appending "nnimap+" to the destination and various other combinations but every time an email matches the rule Gnus will simply create a folder called me@company.com-archive:Mailing Lists.Linux Users on the company IMAP server and move the email there instead of going to my local server.

My complete Gnus configuration, except for machine local settings, is available here.


texts:
How can I get the first N elements of a list?

I know I can use subseq:

(subseq '("one" "two" "three" "four" "five") 0 2)

Yet when I use subseq, it produces one of the following results:

on the first call, the message "function 'subseq' from cl package called at runtime" or,
an error that "progn: Symbol’s function definition is void: subseq" when using vanilla emacs -Q.

I could overcome these by using (require 'cl-extras) or cl-subseq.  But given these hiccups, I expect there is a more direct way to get the first N elements.

Looking through documentation didn't turn up anything and the implementation of cl-subseq is non-trivial.  If a builtin doesn't exist, I imagine to implement from scratch would require something like "Get the car of each cdr".  Yet, this makes me think of loop... which is also a cl extension.

Thoughts?


texts:
I am using ein with emacs 25-3.
As some of the cells I am writing contain classes definitions, I would like to be able to collapse them to show only the first line.
I know output cells can be toggled on and off with C-c C-e But I need to the input one to collapse.

I have posted the suggestion as an issue in the ein project on github just now: link to issue.   I woder if there is a way to work around it.

edit:
I meanwhile added the code folding mode origami.
It folds all the cells and in combination with hydra I can get it to fold cells and classes and functions. I will update this questions after I work with it for a bit.


texts: Is there any rule by which the user can determine whether the package configuration requires :init or :config?


texts: Delete marked region with py-electric-backspace py-electric-delete

texts:
In my python-mode the backspace and delete keys gets remapped to py-electric-backspace, etc. This breaks the behaviour set by the variable delete-active-region.

Is there a way to unify the behaviour so that when I mark a region and press delete it will actually delete the region and if unmarked act as dedicated by py-electric-backspace?

A related question has been posted here, but not completely applicable.

EDIT:
This has been fixed in the latest python-mode package by Andreas (See comments below)


texts: Switch between term and shell keeping directory

texts:
I am a beginner user of emacs so please answer being aware of this.

I use dired to connect to a remote computer and navigate directories.

I sometimes want to go to a shell or terminal on the remote machine. If I type M-x term while in the dired buffer on the remote machine I get a terminal on my local machine not the directory I was viewing in dired.
However if I type M-x shell instead (I have to give my remote shell path first) then the shell opens in the same directory I was viewing in dired.

So is it possible to have M-x term open in the current dired directory and furthermore is it possible to switch from shell mode to terminal mode or vice versa while maintaining the current directory?
ALso can I set emacs to remember where the remote shell path is so I don't have to enter this?


texts: How to never have a major mode enabled automatically

texts:
looks like Emacs tries to be smart, switching to an annoying change-log-mode often when i am editing a changelog file. I would like to disable it, but i just find info about how to interactively disable a mode while editing a buffer, or how to enable a mode when a file matches a pattern.

I cannot find any info about how to disable a major mode totally and in any case. Ideally i would even remove it from my installation, as i will be never using it


texts: How to manipulate argument list in nadvice.el?

texts:
Following on from an answer to another question about the new advice system:

In old-style advice.el, it was possible to manipulate individual members of an advised function's argument list, without making any assertions regarding those members not so manipulated. For example, the following advice:

(defadvice ansi-term (around prompt-for-name last)
  (let ((name (read-from-minibuffer "Tag: ")))
    (and (not (string= name ""))
         (ad-set-arg 1 (concat "Term: " name)))
    ad-do-it))

allows the (optional) provision of a buffer-name argument to an ansi-term call, while ansi-term will still obtain its first argument by prompting according to its own interactive form.

(For later reference, ansi-term's signature is (PROGRAM &optional BUFFER-NAME), and its interactive form prompts for PROGRAM with several possible defaults, but does nothing regarding BUFFER-NAME.)

I'm not sure whether or not this is possible in nadvice.el. If it is, I'm not certain how it can be done. I've found a couple of ways to replace an advised function's argument list.

For example, from *info* (elisp) Advice combinators:

`:filter-args'
 Call FUNCTION first and use the result (which should be a list) as
 the new arguments to pass to the old function.  More specifically,
 the composition of the two functions behaves like:
      (lambda (&rest r) (apply OLDFUN (funcall FUNCTION r)))

Other combinators provide similar capabilities, and the common thread among them is that, while a function's argument list may be replaced, truncated, extended, et al, there's no apparent way for function advice to modify the argument at a given position in the list without asserting anything about the rest of it.

In the case under discussion, it appears impossible for the advice author to pass ansi-term only a buffer name, because it's not possible to construct a list which has a value in position 1 but nothing, not even nil, in position 0. In the general case, it appears impossible for the advice author to arbitrarily modify arguments beyond position 0.

This seems unfortunate in that, in order to produce a similar effect, it's necessary to copy-paste code: specifically, either I can copy ansi-term's interactive form and extend it to my taste, or I can copy ansi-term altogether and extend it likewise. In either case, I now must redefine part of the Emacs Lisp distribution in my init file, which strikes me as undesirable in terms of both durability and aesthetics.

My question, then, is: Can this sort of argument list mangling be done with nadvice.el? If so, how?


texts: flycheck cannot enable python-flake8 configuration file not found

texts:
I'm trying to set up flycheck to run flake8 on my python files. I'm using pipenv so I set up flycheck-python-flake8-executable for my buffer to point to the virtual environment version of flake8 and it seems to be detected. However it refuses to enable the checker. Running flycheck-verify-setup gives me

  python-flake8 (disabled)
    - may enable:         yes
    - executable:         Found at /Users/gmauer/.local/share/virtualenvs/project-name-qFaGhtMo/bin/flake8
    - configuration file: Not found

So I try to enable it with flycheck-disable-checker and...nothing, nothing output to messages, no errors, same verify-checker output.

I thought that maybe it has to do with the fact that it can't find a configuration file but I have a valid .flake8 file in both my user root and in my project so I have no clue why its not detecting it.

[flake8]
exclude = .git,__pycache__,docs/source/conf.py,old,build,dist,node_modules,instance

I can run it just fine from eshell.

What could be wrong? What else do I do to debug?


texts:
If I start emacs from the terminal, emacs will start up with a warning on the terminal:

Warning: Cannot convert string "-*-courier-medium-r-*-*-*-120-*-*-*-*-iso8859-*" to type FontStruct

I tried starting emacs with emacs -q. The warning was still there.

How to solve this problem? Thank you.

(My OS is Xubuntu 14.04.1. Emacs version is 24.4.1.)


texts:
Trying to write a yasnippet for a markdown code block I wrote the following:

#name: Code Block
#contributor: Rovanion Luckey <rovanion.luckey@gmail.com>
# --

\`\`\`${1:language}
${2:code}
\`\`\`

Since according to the documentation you have to escape the backquotes. Though when I try to call on the snippet in my markdown document I only get:

YASESCAPE96PROTECTGUARDYASESCAPE96PROTECTGUARDYASESCAPE96PROTECTGUARDlanguage
code
YASESCAPE96PROTECTGUARDYASESCAPE96PROTECTGUARDYASESCAPE96PROTECTGUARD

Worth mentioning is that neither

```${1:language}
${2:code}
```

works.


texts:
When setting up my emacs for a new work environment, I am unable to get the elpy configuration to correctly use python 3. I have installed all of the required packages in /usr/local/bin and have installed them using python3.

Right now, when I run elpy-config I am getting the following:

Virtualenv........: None
RPC Python........: 2.7.6 (/usr/bin/python)
Interactive Python: python (/usr/bin/python)
Emacs.............: 24.5.1
Elpy..............: 1.9.0
Jedi..............: 0.9.0
Rope..............: Not found (0.10.2 available)
Importmagic.......: 0.1.3
Autopep8..........: 0.1.3
Syntax checker....: Not found (pyflakes)

I would like to have RPC Python be ipython3 and the same for the interactive. For the purposes of this question, assume my .emacs file is blank.


texts: Is There a Way To Set "Lisp-Interaction-Mode" to be Default?

texts: I'm using Emacs in the terminal of Mac.  Each time I exist an .el file and reopen another, I have to set lisp-interaction-mode.  Is there some sort of command or item I can place in the .emacs file to make it so that this is the default every time I open a .el file?


texts:
I use dvisvgm to generate latex fragments. However, some of my equations seem to be cut off. One example is below

The svg file generated does not have the cutoff but the image as displayed in emacs does. I have tried rescaling the images (using org-format-latex-options) and also changing the org-format-latex-header, but have had no success so far. If you have any idea on what might be causing the discrepancy please comment back.


texts:
Is there a way in org-mode to setup

#+begin_quote
my quote here
#+end_quote

to be expanded in latex export as

\begin{quoting}
...
\end{quoting}

I want to use quoting latex package to style quote blocks.


texts: Add org-mode clocktable column that is the product of a constant and the Time column

texts:
Here's a snippet from an optimistic org-mode file

#+CONSTANTS: rate=100000.0

#+BEGIN: clocktable :maxlevel 2 :scope file :narrow 60! :header "#+NAME: billed #+attr_latex: :align l|r|r|r|r :environment longtable :font \\footnotesize\n"
#+NAME: billed #+attr_latex: :align l|r|r|r|r :environment longtable :font \footnotesize
| Headline                                                  | Time   |      |
|-----------------------------------------------------------+--------+------|
| *Total time*                                              | *0:07* |      |
|-----------------------------------------------------------+--------+------|
| <2016-08-04 Thu>                                          | 0:07   |      |
| \_  Doing things |        | 0:07 |
#+END:

* <2016-08-04 Thu>
** Doing things
:LOGBOOK:
CLOCK: [2016-08-04 Thu 19:23]--[2016-08-04 Thu 19:30] =>  0:07
:END:

I'd like to add a column that's the product of the rate constant and the Time column.

Adding something like

:function \"@2$3=$rate*@2$2\"

inside the header, or adding similar to a #+TBLFM before #+END has no effect. In the latter case the #+TBLFM line is removed after I doing

org-dblock-update


texts: Is it possible to achieve erlang formatting like this?

texts:
As I was going through learnyousomeerlang I came across code formatted like so:

if X > Y -> a()
 ; true  -> b()
end

Presently As close as I can get is:

if X > Y ->
    a()
        ;
->

I am assuming this is due to the electric > and electric ;. In Erlang.el. I'm just wondering If anyone happens to know of a useful criteria for the electric-semicolon and such that would make this possible.


texts: Where does my key bind so I can unbind it in major mode

texts:
I changed my key bindings with this lines in my .init.d:
(global-set-key "\C-i" 'previous-line)
It works normally, but when I change to markdown-mode, key rebinds to something else, how can I disable that binding and keep this original one.


texts:
I'd like to rebind C-c to eshell-interrupt-process, so I don't need to press C-c C-c. I tried the naive

(local-set-key (kbd "C-c") 'something)

And similar commands but when I press C-c emacs waits for me to finish the combo, instead of just executing something.

Why is this happening? How can I bind just C-c to some command?


texts:
I have a buffer in read-only mode.

Killing the buffer and reopening it does not do the job while restarting emacs does.

How to exit the read-only mode without restarting emacs?


texts: Why is renaming (rather than copying) the default way to create backup files?

texts:
The documentation on backup file creation, Copying vs. Renaming, makes it sound like copying is the more sensible choice.

file owner and group remain unchanged
hard links remain associated with the actual file rather than its backup

Given that, why does the default behavior prefer renaming in most cases?

backup-by-copying defaults to nil
backup-by-copying-when-linked defaults to nil
backup-by-copying-when-mismatch defaults to t


texts: Add caption to an image generated by a code block

texts:
Consider the following MWE

#+begin_src python :session :results file
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
fig=plt.figure(figsize=(3,2))
plt.plot([1,3,2])
fig.tight_layout()
plt.savefig('myfig.pdf')
'myfig.pdf' # return this to org-mode
#+end_src

#+RESULTS:
[[file:myfig.pdf]]

How can I add a caption (and maybe also name) to the generated results block that contain a figure?


texts: Does function evaluation depend on place where it is defined?

texts:
I get an error message from rtags module while trying to call rtags-taglist.

While edebugging it I didn't find any problem with this function, although of course debugger printed the same error as during regular invocation.
As next step, I copied the whole rtags-taglist defun to *scratch* and evaluated it there (C-x C-e). Problem DISAPPEARS then.

So I decided to delete all the *.elc files from the /usr/local/share/emacs/site-lisp/rtags/ directory, then restarted Emacs, then visited the rtags-tagslist definition, then re-evaluated it from its original location (rtags.el), but this DOES NOT solve the problem. Only copying the function definition elsewhere (*scratch*) helps.

How to explain it?

It's weird to me.

I'm running Emacs 24.5, with Spacemacs.


texts: opening brace alignment/indentation problem in LaTeX mode

texts:
I have an alignment/indentation problem in LaTeX mode. Every time I begin a line with an opening brace and I hit <TAB> or run an indentation command on the region, the brace becomes aligned with the previous opening brace, even if a closing brace has been inserted in between. For instance,

\begin{document}
{\foo}

becomes

\begin{document}
      {\foo}

Because of this, the document is increasingly shifted to the right. How can I get rid of this behavior? I use GNU Emacs 24.5.1. I have tried to open the LaTex file with emacs -q --no-site-file to make sure this is not due to a local configuration file, to no avail...


texts: automatic prettier for python code? (as in javascript)

texts:
https://github.com/prettier/prettier-emacs does formatting for javascript

wonder if there's an equivalent for python code?


texts: Magit: remote header not showing in magit-status

texts:
I seem to have inconsistent behavior with magit-insert-remote-header. On some repositories I get a remote header, which I can navigate to and use P-p to push commits to the remote, where other repositories I don't have a remote header, but can still push to remote using P-p.

I have deleted and re-added remotes using Magit, and doing this does not cause the header to appear.

I believe that the repos that do have headers have remotes that were not added using Magit, but I could be mistaken.

I have the following in my custom-set-variables:

'(magit-status-headers-hook
   (quote
    (magit-insert-repo-header magit-insert-remote-header magit-insert-head-header magit-insert-upstream-header magit-insert-tags-header)))

which gives me the "repo" and "head" headers (I don't use the other ones besides "remote").

Any guidance would be appreciated. I expect it's something simple I'm overlooking.


texts: How to insert a docstrip tag environment in AUCTeX

texts:
I am working on literate programming in LaTeX.  Actually, I am coding a lot of dtx files, which contain both the code and its documentation.

When working in Emacs, it uses AUCTeX and switches into TeXDoc-mode.

Quite often, I have to insert docstrip options or tags, which look like this:

%<*option>
...
%</option>

(That is: a percent sign in the first column and than the tag which is enclosed in less/greater brackets <>.  The opening tag begins with a asteriks *, the closing tag has a slash /.  Of course, the name of the tag (here: option) has to be spelled identically.)

I would love to have some kind of Emacs function, which inserts this special kind of enviroment.  Using the classical LaTeX-environment is not suited, as it inserts \begin and '\end`, which is not what I need.

I didn't find a hint in the manual.

Edit: I had a second question related to this theme.


texts: there is no info of author in git-timemachine

texts: git-timemachine is good to use, but how to show author (committer) along side with the commit message?This information sometime is important for me


texts: Emacs whitespace mode doesn't show ^M characters

texts:
Somebody in my team has checked in a file with MS-DOS line endings into the git repo. with vi's binary mode, vi -b hello.py, i can see lines ending with ctrl character - ^M.

In emacs, whitespace-mode, the same characters are shown with $ sign. I infer, emacs has changed ^M/$ chars uniformly to $ chars.

How can i restrict emacs from converting windows line feed into unix line feed and rather show the line feed chars - ^M in its original form and not as $?

I am trying to figure out, if git local repo can be configured to do this windows to unix line feed mapping, rather than emacs doing it.


texts: How to implement remove-key to completely undo the effect of define-key

texts:
A long time ago I implemented remove-key to completely undo the effect of define-key, but when I just tried that implementation, it did not work reliably. How would you implement remove-key so that for any given key this is true:

(let ((map (make-sparse-keymap)))
  (define-key map KEY 'bound)
  (remove-key map KEY)
  map)
=> (keymap)

It should also work for non-sparse keymaps. And when a sub-keymap is involved which becomes empty when the key is removed, then the sub-keymap should also be removed.

Here's the documentation - now I only need an implementation :-)

(defun remove-key (keymap key)
  "In KEYMAP, remove key sequence KEY.
Make the event KEY truely undefined in KEYMAP by removing the
respective element of KEYMAP (or a sub-keymap) as opposed to
merely setting it's binding to nil.

There are several ways in which a key can be \"undefined\":

   (keymap (65 . undefined) ; A
           (66))            ; B

As far as key lookup is concerned A isn't undefined at all, it is
bound to the command `undefined' (which doesn't do anything but
make some noise).  This can be used to override lower-precedence
keymaps.

B's binding is nil which doesn't constitute a definition but does
take precedence over a default binding or a binding in the parent
keymap.  On the other hand, a binding of nil does _not_ override
lower-precedence keymaps; thus, if the local map gives a binding
of nil, Emacs uses the binding from the global map.

All other events are truly undefined in KEYMAP.

Note that in a full keymap all characters without modifiers are
always bound to something, the closest these events can get to
being undefined is being bound to nil like B above."
  ...)

Why do I want that? It has already been mentioned in the above doc-string, but here it is again, quoting (elisp)Format of Keymaps (emphasis mine).

  When the binding is nil, it doesn't constitute a definition but it
  does take precedence over a default binding or a binding in the parent
  keymap.  On the other hand, a binding of nil does not override
  lower-precedence keymaps; thus, if the local map gives a binding of
  nil, Emacs uses the binding from the global map.

(define-key map KEY nil) does not remove the entry for KEY, it just sets the binding to nil, which "doesn't constitute a definition", but which never-the-less can have an effect.


texts: Does `provide` conflict with `use-package`?

texts:
I just install use-package yesterday and still learning it. I notice use-package is not working in my environment:

Here is my init file:

(require 'package)
(dolist (url '(("melpa" . "https://melpa.org/packages/")
               ("melpa-stable" . "http://stable.melpa.org/packages/")))
  (add-to-list 'package-archives url t))
(dolist (path '("~/.emacs.d/elpa" "~/.emacs.d/plugins/" "~/.emacs.d/lisp/"))
  (add-to-list 'load-path path))
(setq package-enable-at-startup nil)
(package-initialize)
(eval-when-compile (require 'use-package))
(require 'init-treemacs)

Here is my init-treemacs file in .emacs.d/lisp/

(use-package treemacs-mode
  :ensure t
  :init (bind-key "C-x M-d" treemacs)
  :custom (treemacs-width 25))
(provide 'init-treemacs)

When I start Emacs, treemacs looks like not be loaded.

C-x M-d does not work
I start treemacs manually, and treemacs-width is not 25

Do I miss something? I have reinstalled use-package, compiled every file again, added & removed ensure. Nothing changed.

Emacs 26.1 installed by brewcask, use-package 2.4


texts: How to browse shared Os X machine with emacs?

texts: I have two OS X machines that are "sharing" each other right now.  I want to use emacs rather than finder to browse one machine from the other.  How do I do this?


texts: A way to insert a predefined text into Magit's commit message window?

texts:
We have a convention that every commit message begins with an issue number.

I'd like to be able to programmatically insert the issue number part (computed by a separate function) into the commit window of Magit, when it first opens (that is, on pressing C C).

How do I best do it? Where to look?

UPDATE: Here's what I'm currently using.

(defun my-extract-branch-tag (branch-name)
  (let ((TICKET-PATTERN "\\(?:[[:alpha:]]+-\\)?\\([[:alpha:]]+-[[:digit:]]+\\)-.*"))
    (when (string-match-p TICKET-PATTERN branch-name)
       (s-upcase (replace-regexp-in-string TICKET-PATTERN "[\\1] " branch-name)))))

(defun my-git-commit-insert-branch ()
  (insert (my-extract-branch-tag (magit-get-current-branch))))

(add-hook 'git-commit-setup-hook 'my-git-commit-insert-branch)

For a branch name like <username>-foo-123-<explanatory part> it produces [FOO-123] in the first line of the commit message, to allow easy ticket auto-linking in Jira.


texts: Limit font-lock highliting to first N chars of line

texts:
I write regex for font-lock and I know that the date should appear in first 40 chars of line.

How can I limit search beyond some limit?

I tried to add ^.\\{0,40\\}XXX but Emacs regex .  is greedy and regex requires non-trivial rewriting to workaround greediness.

UPDATE I'm using font-lock-add-keywords

UPDATE @Stefan I have regex that skip optional date part, the only time part is required. With prefix .\\{0,40\\} date part is ignored (not highlighted). I can't use [^-] or [^-[:digit:]] because it is for log files and I don't know prefix in advance.

My goal is to limit regex trying to parse long lines.

UPDATE 3 My regex:

(defvar log4-hi-time-keywords
  '(("^.\\{0,40\\}\\(\\(:?[0-9]\\{2\\}?[0-9]\\{2\\}.[0-9]\\{2\\}.[0-9]\\{2\\}.\\|\\<\\)[0-9]?[0-9]:[0-9][0-9]:[0-9][0-9]\\>\\(:?\\.[0-9]\\{3\\}\\)?\\)" 1 'log4-hi-time-face))
  "Highlight regex for partial ISO date.")

(font-lock-add-keywords nil log4-hi-time-keywords)

With addition of ^.\\{0,40\\} only time part of 2020-02-23 13:39:03.215 is highlighted.

I hope regex isn't that scary.


texts:
It's kind of weird how un-ergonomically placed the parenthesis keys are.
 I'd like a function that smartly brackets my stuff for me based on context:

If the mark is active, the region should be enclosed by ()
If the mark is not active and the cursor is in the middle of a symbol, it should enclose the region between the cursor and the next whitespace: foo|bar bla -> foo(|bar) bla.
Consecutive calls should result in cycling the bracket type, i.e. (x) -> [x] -> {x} -> ('x') -> ("x") -> ...

This would be awesome. Does there exist a package/function that does something similar already?


texts: Regexp for matching quoted strings that may have control characters in them

texts:
I am trying to use a regexp to match strings, e.g. a pattern that matches these kinds of quoted strings:

"test" or 'test' or 'test with "quote"' or "test with 'quote'"

This pattern matches all those,

"\\(\"\\|'\\)[^\\1]+?\\1"

but, it fails on "test\n" (and other control characters like \t and \r). I don't understand why \n (a newline) is so special it doesn't match [^\\1] which I thought was a character that doesn't match the opening quote. Is this expected?

If I replace [^\\1] with . then it works on all the strings, including the one with \n in it. I guess it is ok because +? makes it nongreedy so it seems to not over match.

Note, this question originated from How to highlight in different colors for variables inside `fstring` on python-mode.


texts: how do I evaluate elisp in a certain buffer from batch mode?

texts:
I want to evaluate some elisp with batch mode, but it only works in a certain (type-of) buffer.  Specifically

emacsclient --eval "(emms-playlist-mode-play-smart)"

This command only works on an emms-playlist-mode buffer, so I'd like it to locate one in the current emacs server and execute there.