texts: Is there a standard mode for .ini files?

texts: After looking for a mode for .ini files, I found ini-mode via MELPA, but upon installing it in Emacs 26, there was a message about it being an obsolete mode. What are the alternatives?  In my limited testing, conf-mode seems to work for .ini-style files too, but I'm wondering whether there are other solutions that are specifically about .ini files. In terms of functionality, I'm primarily looking for syntax highlighting and indentation.


texts: How can I use Flycheck on Perl code that installs its dependencies with Carton?

texts:
Perl module dependency manager Carton installs dependencies into a subdirectory of the project directory, and expects perl to be run under carton exec to set the necessary environment variables to locate the modules.  Flycheck runs plain perl, and consequently fails to find the correct modules, reporting an error for the missing module and masking any other problems.

How do I tell Flycheck where to look for these modules?


texts: Is it possible to get a summary of DONE and TODO's in Orgmode

texts: I am aware of the [0/2] checkbox summary in parent heading, but how could one get the same going for [(total TODO)/(total DONE)] ?


texts: Cannot create org-babel matlab source block with vector input arguments

texts:
I want to create a re-usable matlab org-babel source block vectsb (say), which takes two vectors from a call statement, performs some operations with them, and returns the result in the call statement. A MWE is as follows
#+NAME: vectsb
#+begin_src matlab :var a=[0], b=[0] :session
a+b
#+end_src

#+CALL: vectsb(a=[1,2,3],b=[3,2,1])

#+RESULTS:
| 1040 | 650 |

I am getting this type of errors in the input arguments
a=[1 (, 2) (, 3)];
       |
Error: Invalid expression. When calling a function or indexing a variable, use
parentheses. Otherwise, check for mismatched delimiters.

No matter how much I read the org-babel manual I can't figure out what I am doing wrong. Partly because there are few examples for Matlab.


texts:
I'm reading GNU Emacs Manual to learn how to use Emacs in its full power. I now I'm trying to make use of keyboard macros. It's fairly easy, but I cannot understand why the first defined macro repeats infinitely, while all subsequent macros are executed only once (on pressing F4).

Is it normal behavior? I like when I press F4 and the macro is executed once. I don't see why the first defined macro should repeat indefinitely.

Example:

F3 boo F4

Now, if I press F4 I get:

  booboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboobooboob

Now if I redefine it again, I will get:

  booboo

What's going on?

I think it has something to do with Flyspell. I use Flyspell always. It's active in text mode and also in programming modes, but via flyspell-prog-mode. I think that Flyspell is involved here because of this part of my *Messages* buffer:

Defining kbd macro...
Keyboard macro defined
Error in post-command-hook (flyspell-post-command-hook): (error "Variable binding depth exceeds max-specpdl-size")
After 0 kbd macro iterations: self-insert-command: Variable binding depth exceeds max-specpdl-size
Defining kbd macro...
Keyboard macro defined

Result of C-u M-x emacs-version:

  GNU Emacs 24.4.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.3) of 2014-10-21 on bitzer.hoetzel.info


texts: Exactly what are those auto-complete sources?

texts:
I've been looking for years for a documentation on those (in bold) auto-complete sources:

ac-source-words-in-buffer
ac-source-abbrev
ac-source-dictionary
ac-source-emacs-lisp-features
ac-source-features
ac-source-filename
ac-source-files-in-current-dir
ac-source-functions
ac-source-variables
ac-source-symbols
ac-source-words-in-all-buffer
ac-source-words-in-buffer
ac-source-words-in-same-mode-buffers

Apparently, those in italic pertain to C (in which case I'm wondering why they're not suffixed as such) can somebody confirm this?


texts:
I have started programming in C++ recently and have been testing using classes.
What I have noticed is that if I declare a variable before my methods like:

class Test {
    int value;
public:
    int getValue() const;
};

then the public: is not colorized. But if I don't write the int value; at all, then the public: is colored blue, making it stand out more.

This isn't just an error with public:, its a general rule error because having the following:

class Test {
private:
    int value;
public:
    int getValue() const;
};

will colorized private: but not public:. (Here the line int value; could still be removed and public: would still not be colored differently).

Is there a fix for this that I can put in my $HOME/.emacs?


texts: Test whether all elements/symbols of a list are the same (eq)

texts:
Project:

(1) Push every new this-command onto a list containing any previously pushed this-command.

(2) Limit the list to a variable length (e.g., 3 or 5), and chop off the oldest.

(3) Compare whether all elements of the list are eq.

  (defvar this-command-list nil)

(defvar maximum-elements 3)

(defun pre-command-hook-fn ()
  (push this-command this-command-list)
  (if (> (length this-command-list) maximum-elements)
    (setq this-command-list (delq (last this-command-list) this-command-list)))
  (TEST IF ALL ELEMENTS of `this-command-list' ARE THE SAME))

(add-hook 'pre-command-hook 'pre-command-hook-fn)

Background (aka why):  I am instituting a concept similar to the deplacement-command list used by flyspell -- i.e., if this-command is the same as last-command and it is also a memq of a list of certain deplacement commands, then don't do a costly function.  The difference here is that I want to compare a variable number of previous commands with the current command -- e.g., if I move the cursor (consecutively) 3 or 5 times to the left, then skip the costly function that would ordinarily run every command loop.

EDIT:  The following is a working solution based on the answer by @phils below.  I thought it important to correct the mistake above which used delq instead of nbutlast.

(require 'cl)

(defvar this-command-list nil)

(defvar maximum-elements 3)

(defun pre-command-hook-fn ()
  (push this-command this-command-list)
  (when (> (length this-command-list) maximum-elements)
    (setq this-command-list (nbutlast this-command-list)))
  (message "test:  %s" (eq (length (cl-remove-duplicates this-command-list)) 1)))

(add-hook 'pre-command-hook 'pre-command-hook-fn)


texts:
I believe Emacs lists have nil at their end.
That said, I was trying to test examples.
Can anyone tell the difference between a and b?

(setq a '(foo))
(setq b '(foo nil))

;; Returns nil and (nil), respectively.
(cdr a)
(cdr b)


texts: AucTeX: Can not include selected text into LaTeX environment

texts:
In earlier versions of emacs (<23, I believe), when a region ( e.g., 'some text') was selected in AucTeX, and C-e was entered to include the text an environment, the following was obtained:

\begin{center}
some text
\end{center}

However, in Emacs 24, it is not possible to use C-e if a region has been selected. Rather, I have to unselect the region and then type C-e. If the point is on the text, the environment is inserted after the text with C-e:

some text
\begin{center}

\end{center}

and the cursor is within the environment.

Is it possible to get the old behaviour back?


texts: When working on elisp where to show intermediate values?

texts:
I've only recently started diving deeper into elisp.  I've been using message a lot in the past, much like println or print when in other languages.  The trouble I have is that I'm writing elisp to operate on another file in another buffer, and I intend to eventually bind an interactive function which I'd then use when in similar buffers.
The problem is then I'm dealing with three buffers in emacs: target buffer, elisp buffer, and the mini-buffer where message output goes.  The mini-buffer is way to small sometimes.  And I'm suspecting there are better ways of doing this kind of work.
Is there more of an idiomatic way of developing elisp for new interactive functions?


texts: How does emacs flash its icon on the windows taskbar?

texts:
Sometimes when I run a process if there is an error during the process the emacs icon on the windows taskbar lights up, so if I'm in an other app I can see something happened there.

I'd like to use this indication in my elisp programs too. Is there a lisp call which makes the emacs icon light up on the taskbar?


texts:
Cycling through indentation levels in python.el 1 can be achieved by pressing <tab> repeatedly, which is bound to indent-for-tab-command.

Now, consider:

(defun malb/my-indent (&optional arg)
    (interactive "P")
    (indent-for-tab-command arg))
(bind-key "C-<tab>" #'malb/my-indent)

Now, pressing C-<tab> repeatedly does not lead to cycling through indentation levels. On the other hand,

(bind-key "C-<tab>" #'indent-for-tab-command)

does lead to the desired outcome. Hence, somehow, calling indent-for-tab-command from another function behaves differently from calling it directly. Can anyone explain why that is?


texts: Unable to tweak theme settings unless I start a new session

texts:
I have this code in my init.el file, mainly to apply the theme correctly when running emacs server:

    ;; This will make sure the theme loads well in emacs daemon
    (setq myGraphicModeHash (make-hash-table :test 'equal :size 2))
    (puthash "gui" t myGraphicModeHash)
    (puthash "term" t myGraphicModeHash)
    (defun emacsclient-setup-theme-function (frame)
      (let ((gui (gethash "gui" myGraphicModeHash))
            (ter (gethash "term" myGraphicModeHash)))
        (progn
          (select-frame frame)
          (when (or gui ter)
            (progn
              ;; setup the smart-mode-line and its theme
              (setq sml/no-confirm-load-theme t)
              (sml/setup)
              (sml/apply-theme 'dark)
              (load-theme 'material t)
              (if (display-graphic-p)
                  (puthash "gui" nil myGraphicModeHash)
                (puthash "term" nil myGraphicModeHash))))
          (when (not (and gui ter))
            (remove-hook 'after-make-frame-functions 'emacsclient-setup-theme-function)))))
    (if (daemonp)
        (add-hook 'after-make-frame-functions 'emacsclient-setup-theme-function)
      (progn
        (setq sml/no-confirm-load-theme t)
        (sml/setup)
        (load-theme 'material t)
        ))

I also have this code to tweak some of material theme face fonts:

;; Material theme
(use-package material-theme
  :ensure t
  :defer t
  :config
  (set-face-attribute
   'font-lock-comment-face  nil :foreground "#69B7F0" :background "#00629D" :bold t)
  (set-face-attribute
   'font-lock-constant-face nil :foreground "#69B7F0" :background "#00629D" :bold t))

However, the changes to lock_comment and lock_constant are not being applied unless I start a new frame. Any pointers on why that is and how to fix it?


texts: how to add date and time into spacemacs' mode line

texts:
I usually use Spacemacs in maximized window, thus the date and time presented in mode line is a must.

I understand that spacemacs uses powerline mode to mimic vim, the manuals of both spacemacs and powerline does not tell how to add new section to display additional info (in this case it is date and time).

I have attempted to comprehend the nyan cat code in color layer, but my elisp skill did not satisfy.


texts:
I want to run tmux in emacs. I checked that it works in term, but default colors are awfully hard to read:

How can they be changed to a sensible setting from .emacs file?


texts: origami (folding) package: create parser for Ruby

texts:
I need to create a parser for Ruby so I can use the origami folding package. To make matters more complex, I use enh-ruby-mode, so I 'd like to build the parser for that, if it makes a difference.

The package has the following instructions:

  It should be fairly easy to write a parser. An origami parser is a
  function that takes a 'create function' and returns a function taking
  the string to be parsed. The returned function should return a list of
  fold nodes. Fold nodes are created using the passed-in create
  function. Best to use an example:

 (defun my-amazing-parser (create)
   (lambda (content)
     (list (funcall create beginning-of-the-fold-node-point-position ; inclusive
                           end-of-the-fold-node-point-position ; exclusive
                           offset  ; this allows you to show some of the start of the folded text
                           child-nodes))))

The origami package has a parsers file that has the built-in examples, and they also support regular expressions.

Unfortunately, I am a little too weak with elisp yet to understand it (and it looks like he uses some libraries with functions like ->> and I don't know how to go and find out what they are or where they came from).

My first guess would be something like this:

 (defun origami-ruby-parser (create)
   (lambda (content)
     (list (funcall create (enh-ruby-beginning-of-block) ; inclusive
                           (enh-ruby-end-of-block) ; exclusive
                           10  ; this allows you to show some of the start of the folded text
                           child-nodes))))

I don't know what child-nodes is supposed to be.

And from there, the question will be "can I create more complex matching rules using if/else/etc ?"


texts:
Is it possible to make this kind of an inline image link:

[[path/to/the/image/of/a/cat][fluffy]]

appear as an inline image in org-mode, and if you hover over it, you can see in the tooltip the string "fluffy", hopefully along with the image link "path/to/the/image/of/a/cat"? If so, how?


texts: How can I represent a 4 spaces indent width as 2 spaces?

texts:
For clarity: I mean indents as represented by individual spaces, not tab characters.

I'm working with a friend on a javascript project, and while I'm an 80col zealot, he wants to have 4 space indent. It's not the end of the world, but it bothers the heck out of my eyes.

I know about the .dir-locals.el trick, so I'll just stick the tab width in there, but I was wondering if there was a display hook or extension that would print any block identation as 2 spaces? For example, show this block

function greet(name) {
    return `Hello, ${name}`
}

as this one

function greet(name) {
  return `Hello, ${name}`
}

while actually writing 4 spaces into the file on disk. We already use prettier, so I can chuck in anything without having to worry what comes out on the other end, but I'd prefer to have a solution that just changes the display of the buffer in emacs. I don't really want to hassle with changing the real file contents every time I open a file.


texts: The difference between (setq shell t) and (shell . t)

texts:
Upon configuring babel, encounter such syntax

(require 'ob-ipython)
(org-babel-do-load-languages
 'org-babel-load-languages
 '((ipython . t)
   (python . t)
   (shell . t)
   ;; other languages..
   ))

What's the difference between (setq shell t) and (shell . t)


texts: Stuck at input emacs gdb debugging C program /* enter doesn't end text input */

texts:
Hello I am novice programmer and I am trying to debug a simple C program, using getline (from the K&R book at the beginning) - input ends on newline.

I have a problem with gdb on Emacs. When I debug from the shell the program works normally. When it reaches the input line and asks for input I type my input, press enter and proceed with debugging steps. However when I debug with the command M-x gdb (run with default settings) the program reaches the input line and asks for input.  I type my input and then cannot proceed debugging: RET doesn't get me out of the input stage and the program seems to wait for more input.

Update: works fine with M-x gud-gdb


texts: How to make a shell command totally silent (preventing it to split window or to open a new frame/window etc)

texts:
Is it possible to run a shell command silently (in background)? When I use async-shell-command, emacs split the windows. I would like that an specific shell command to be totally in background (without any visual effect).

As an explicit example, I have the following code (borrowed from https://emacs.stackexchange.com/a/7932). It opens the pdf version of the tex-file I working on. When running it, it splits the window, I would like to prevent it from this behavior in this particular situation.

 (defun my-view-pdf ()
  (interactive)
  (async-shell-command
    (concat "SumatraPDF " (file-name-base (buffer-file-name)) ".pdf")))


texts: Editing helm-bibtex citations in markdown

texts:
Helm-bibtex can insert one or multiple (with C-space) citation in some markdown document. I have, however, not found a way to edit these citations afterwards using helm-bibtex.
If I call helm-bibtex inside citation [@first2019<point>] I get result [@first2019[@second2020]]. I would like to get [@first2019; @second2020].
Therefore, I would kindly ask if there is a non-manual way to edit (add, remove and re-order) the bibliography items in the markdown document using helm-bibtex?


texts: sorting paragraphs of a document by paragraph numbers (not lexicographically)

texts:
I have a document whose paragraphs start with a number like this:

101 kjwdujd dkjcjiekrd wekdhehwrd kwedhiehrc wekdhchjedc kjdchhedch .

99 dsjcoiedc wdhiwedc wedhiuwhediuhewdkdeh wedghiuwghediughedc wejgdugwed

5 kdjewde3 diwedeoi.

I would like to sort the paragraphs according to these numbers, so ideally the ordering should be 5, then 99 then 101. But given the fact that the function sort-paragraphs sorts the paragraphs lexicographically, the sorting would be 101 then 5 then 9.

Is there a way to sort the paragraphs by the paragraph numbers?


texts: Autocompletion of filename doesn't work in a shell in a buffer, when the current working directory is moved

texts:
In emacs, I press M-x shell to create a shell in a buffer.

In the shell, I can use autocomplete file names with respect to the current working directory.

If outside the shell e.g. in Nautilus, I move the current directory somewhere else, then back in the shell, the autocompletion of file names will not be working correctly, still with respect to the old pathname of the current working directory.

I tried to refresh the buffer of the shell by M-x revert-buffer, but it didn't work because the buffer didn't open a file but a shell.

How can I solve the problem?

Thanks.


texts: Is it possible to selectively disable syntax highlighting rules?

texts:
The context :

GNU Emacs 26.1
working on Debian 10.3
currently editing YAML files (Ansible code)

Here's how my code looks like :

As you can see, the syntax highlighting is puzzled by the odd number of single quotes in it's difficult... and applies color to everything until it reaches the next single "single quote".

Is there a way to instruct the syntax highlighting logic that "single single quotes" are ok in lines starting with - name: and refrain it from colouring everything until the next "single single quote" ?

NB : this is a purely cosmetics question, everything works fine, no error message, just the display pictured above.

EDIT: Thank you @Lindydancer and @wasamasa. The solutions / workarounds you suggest are way beyond my Emacs skills, so I think I'll have to live with this cosmetic issue. Not able to pick my "favorite" answer either, sorry.

BTW, while working on different topics, I tried Spacemacs and realized it can highlight my YAML snippet without being puzzled by the single quotes :

May this help those investigating, and others searching for an alternative.


texts: Is there an Emacs mode convenient for writing poetry?

texts:
I've tried simple searches on Google and MELPA with keywords like "emacs poetry mode" or "emacs verse mode" but haven't found anything specifically built for the purpose.

The manual walks through some common extensions to text-mode but they're designed for text-plus-markup.  I'm looking for text-plus-distinctive-formatting.

Org has #+BEGIN_VERSE / #+END_VERSE markup, which preserves whitespace upon export.  That's about as far as you can get from what I'm looking for.

I'm looking for a mode that knows a few conventions for indentation, capitalization, and punctuation.  Bonus points if it's good about respecting isolated breaks from those conventions.


texts: In Python mode (python.el), I am in the habit of hitting C-j to return and indent properly. However, when I am in an inferior python buffer, this command only inserts a newline and does not indent. Is there any way to get the inferior-python-mode to work more like python-mode in this respect, or maybe even set up auto-indent the way it normally works in ipython? I have read through the documentation for inferior-python-mode, but can't find anything useful. I love using Emacs for Python, but there are a few pain points, and I am having trouble finding good documentation. Thanks in advance for any advice!


texts: org-mode how to trace back invalid-duration-format

texts: I might be having the same problem as Upgrading to org-mode 9.1.6 error: org-duration-to-minutes: Invalid duration format: "val" . I really am lost. I also get Invalid duration format: "+0:30" . And I just can't figure out which entry is causing the trouble. There is no :effort: entry in the file that is causing the trouble. If I exclude that file from my agenda files I can view an agenda (of course, with all the information missing from that one file). There is also no +0 something that might be causing that. I do not use AM or PM. And I fear I might have to comment all the lines and try for each line whether it's causing that trouble. And I really would like to be able to just see my calendar for tomorrow. Is there any way to search faster than this manual search?


texts: How can I access a file at an (HTTP / HTTPS) URL?

texts:
If I have a URL to a file (for example, this gist), what's the easiest way to fetch that file from Emacs and edit a copy of it? Is there a better option than M-! curl -n [insert URL here] RET?

I'd consider an answer "better" if it didn't rely on an external facility, for instance. Also if it used the remote name of the file as the local file.

I could certainly script up a solution to this myself but it seems like a pretty normal thing to do—is there existing functionality to do this within Emacs? Is there a pre-existing package?


texts:
I'm trying to use emacs for C development.  From here, I understand that in order to see the definitions of functions, I need to use something called etags.  My code is:

#include <stdlib.h>
#include <stdio.h>

int main()
{

  int i = 0;
  printf("i = ", i);

  return 0;
};

When I try to M-. the definition of printf, I see:

No definitions found for: printf

So, I try making an ETAGS file, with:

M-! RET etags main.c RET

And I see I now have a file in the directory called TAGS.  However, this didn't change anything.  When I M-. the function, I still see no definitions for it.

I can confirm that it works internally. That is, if I change my file to:

#include <stdlib.h>
#include <stdio.h>

int zero() {
  return 0;
};

int main()
{

  int i = 0;
  printf("i = ", i);

  i = zero();

  return 0;
};

And place my cursor on the line that calls zero(), and then M-. it takes me to the internal definition of zero().

My question is:

What do I need to do to see the definitions of dependencies?


texts: Magit fail git pre-commit hook with No such file or directory

texts:
I have a git pre-commit hook to run the unittest locally on my GNU/Linux manchine. The content of my pre-commit file is

#!/bin/bash

source activate project && python manage.py test && pylint project

And my .git/config has

[core]
    repositoryformatversion = 0
    filemode = true
    bare = false
    logallrefupdates = true
    hooksPath = /path/to/project/hooks

git commit runs without problem from the command line.

$ git --version
git version 2.14.1
$ git commit -am "Some message"
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
............................................................................................
----------------------------------------------------------------------
Ran 92 tests in 12.873s

OK
Destroying test database for alias 'default'...

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

[395 c7d2b5c] Some message
 1 file changed, 7 insertions(+), 6 deletions(-)

but Magit fails with

  1 git … commit --
/path/to/project/hooks/pre-commit: line 3: activate: No such file or directory

I'm using conda as a virtual environment manager and source activate project is their recommendation.


texts: Customizing a default indentation style for C++

texts:
I use the default style linux (snippet from here)

;; set indentation style linux for c++
(setq c-default-style "linux"
          c-basic-offset 4)

But I can't get it to work with the style setting which sets zero indent for namespaces (from this question)

(defconst my-cc-style
  '("cc-mode"
    (c-offsets-alist . ((innamespace . [0])))))

(c-add-style "my-cc-mode" my-cc-style)

Once I choose my-cc-style with C-c . RET my-cc-mode RET, I get the strange brace indent back which the first setting removes, i.e. like this:

virtual string_type do_falsename() const
    {

Is there a way to keep everything from the default style, and change only the namespace indentation?

Edit: there are a multiple possible solutions to be found here: https://stackoverflow.com/questions/2619853/emacs-override-indentation/22711444#22711444


texts: How to set major mode for a file in .dir-locals.el?

texts:
I would like to set the major mode for a file as you would using file-local variables

Local Variables:
mode: text
End:

but in .dir-locals.el in order not to “pollute” the file in question.  Is this possible?


texts:
I am trying to install a newer version (2.3.1) of Tramp than is currently running with my Emacs. When I run ./configure in tramp ala the instructions here, I get the error

 checking for 24.5.1... no
 configure: error: no not found

My understanding is that somehow the script is able to see the version of my emacs (I confirmed this is the correct version) but is not able to find the Emacs folder/binary - not sure if that is exactly it as the configure script is quite large and complicated. What steps should I take to fix this?


texts: Org and EIN (IPython): No output for print

texts:
I am using EIN in Org blocks, as explained on the GitHub page for EIN. So I use ein-python as the language for Org blocks (instead of python).

All seems to work well (for example displaying data from arrays, or displaying images), except when trying to print in the buffer: there is no output in the block results. However, it works with python as the block language.

The following minimal example shows the problem:

#+begin_src python :session localhost :results output
print("Hello")
#+end_src

#+RESULTS:
: Hello

#+NAME: ca60b6cf-8304-4c47-b458-559dea7d9ab0
#+begin_src ein-python :session localhost :results output
print("Hello")
#+end_src

#+RESULTS: ca60b6cf-8304-4c47-b458-559dea7d9ab0

Above, Hello is not displayed the block results in the case of ein-python.

What causes this problem?


texts: Minor mode for editing ansible playbooks

texts:
I have recently started using ansible, and yaml-mode seemed the logical choice for editing playbooks. However, the indentation does not quite work correctly. For example, I might start a task definition like so:

- name: install packages

Adding the next line, it needs to be indented as follows:

- name: install packages
  apt: name=emacs24 state=present

However, what yaml-mode wants to do is:

- name: install packages
    apt: name=emacs24 state=present

If I tab again:

- name: install packages
apt: name=emacs24 state=present

In other words, in order to get the correct indentation, I need to manually enter the correct number of spaces instead of using the tab key. Is there a mode where I can get the correct behavior, or a way to configure yaml-mode to do what I want? Thank you!


texts: Reminds to clock out or just clock out when there has a clock running

texts: Sometimes when we use "clock in" command in org mode and forget to clock out before exit emacs. When we open emacs again and try to "clock in" with the same entry. There always popup with something for us to choose. Does there exists some command to reminds us to clock out when we exits emacs or just choose "clock out" when we exit emacs?


texts:
I have a feeling this must be a stupid simple problem however I just can't seem to figure out what I'm doing wrong.
I'm using Doom emacs and trying to use noweb with org mode source code blocks to begin more literate programming.
For some reason using C-c C-c on the following:
#+BEGIN_SRC C :noweb-ref give-five
static int giveMeFive(void) {
    return 5;
}
#+END_SRC

#+BEGIN_SRC C :tangle my_c.c :noweb yes
#include <stdio.h>
<<give-five>>

int main() {
    printf("%d \n", giveMeFive());
return 0;
}
#+END_SRC

Returns:
/tmp/babel-0w53dG/C-src-zO1Y13.c: In function ‘main’:
/tmp/babel-0w53dG/C-src-zO1Y13.c:12:21: warning: implicit declaration of function ‘giveMeFive’ [-Wimplicit-function-declaration]
   12 |     printf("%d \n", giveMeFive());
      |                     ^~~~~~~~~~
/usr/bin/ld: /tmp/cctC6beq.o: in function `main':
C-src-zO1Y13.c:(.text+0xa): undefined reference to `giveMeFive'
collect2: error: ld returned 1 exit status
zsh:1: no such file or directory: /tmp/babel-0w53dG/C-bin-RgZiYw

I've tried also using the #+NAME: give-five and that doesn't seem to work either.
Note that when I try just expanding with C-c C-v C-v I get this:
#include <stdio.h>

int main() {
    printf("%d \n", giveMeFive());
return 0;
}

So it seems like it's not even seeing my noweb-ref.


texts:
Scheme syntax seems very lambda-expression-friendly. I can do this

(define blah
   (lambda (n) (* n n)))

But this isn't possible in elisp. I can do this

(defun simple (x)
  ((lambda (n) (* n n)) x))

but of course not this

(defun simple
   (lambda (n) (* n n)))

or this

defun simple ()
       (lambda (n) (* n n)))

Hence, elisp seems a step removed from the Scheme world of "purer" lambda expressions . . . or am I, the beginner, missing something here . . . or is this not a big deal, i.e., there's nothing gained with the Scheme way of doing lambda.


texts: How to downscale linum font size (and avoid left margin gap)?

texts:
I need your help cause I couldn't figure it out. My ideal linum format has 5 digits at least. I'd really like to scale the linum font size down with respect to the text, say by 1/3. This is great cause it avoids an excessively wide linum column (especially in a split view of 2 frames).

However, if I fix the linum height to be 80 for instance, emacs adds a gap between the left margin and the fringe, which defeats the whole idea of scaling it down.

In linum-mode the left margin is fixed, so manually setting left-margin-width doesn't help.

After many tries I came to the conclusion that it cannot be done with my poor level of understanding of lisp and how emacs handles the display. Below is an example.

Is it possible to have different linum and text font size, but avoiding that gap?

@Stefan: Thanks! emacs 24.5 / Debian Stretch. I am not incline to update emacs for now if possible, but I will try nlinum-mode (although I read linum should be more efficient).

@Stefan: sorry my bad: "[nlinum] should usually be about as fast or faster than linum.el". That sounds great, thanks! I am slightly concerned about a problem found with the deamon “ERROR: Invalid face: linum”. But I'll definitely give it a try - I wasn't aware you were directly involved in dev this, well thanks twice then.


texts:
I am used to Emacs under Windows 10 and trying to switch to Ubuntu.

My Windows 10 Emacs font is M-x describe-font:

    name (opened by): -outline-Courier New-normal-normal-normal-mono-13-*-*-*-c-*-iso8859-1
       full name: Courier New-10.0
            size: 13
          height: 16
 baseline-offset:  0
relative-compose:  0
  default-ascent: 12
          ascent: 12
         descent:  4
   average-width:  8
     space-width:  8
       max-width: 10

And the result is:

The default Emacs font in Ubuntu is more beautiful but less readable for me (I have astigmatism):

So to find the same font as in Windows, I use this setting in .emacs file:

(set-face-font 'default "-Mono-Courier New-normal-normal-normal-*-14-*-*-*-m-0-iso10646-1")

I like the font which is for me more easy to read but colours contrasts are too low. Why?

For colours I use:

(set-foreground-color "wheat")
(set-background-color "#273149")
(set-cursor-color "white")

And web-mode: http://web-mode.org/

(require 'web-mode)
(add-to-list 'auto-mode-alist '("\\.php\\'" . web-mode))

How to find the same font style and colourisation I am used to on Windows?


texts: How can I configure the tab width for TCL files

texts:
I set all tab-width parameters and indent parameters to 2, but Emacs always uses 8 for the tab space when I press the TAB key at the beginning of a line, if i opened one bracket.

How can i set the tab for one bracket to 2 instead of 8?


texts: Different scroll margins at top and bottom of window?

texts:
Q: is there a way to set different scroll margins at the top and bottom of a window?

The variable scroll-margin (defined in the C source code) sets how many lines of text that Emacs displays, at a minimum, at the top and bottom of a window:

  Number of lines of margin at the top and bottom of a window.
  Recenter the window whenever point gets within this many lines
  of the top or bottom of the window.

I'd like to use scroll-margin for the bottom of the window, but don't want it at the top (e.g., a positive value at the bottom, but 0 at the top).  Is there a way to do so?


texts:
Im on Org-mode 9.3.6 with Emacs 26 and upon pressing C-c cfor capture templates, I get

  org-capture-select-template: Symbol’s function definition is void:
  org-mks

the stacktrace says

Debugger entered--Lisp error: (void-function org-mks)
  org-mks((("n" "Notes" entry (file "~/mega/org/notes.org") "* %?\nEntered on %U \n %i") ("t" "Todo" entry (file+headline "~/mega/org/gtd.org" "Tasks") "* TODO %?\n %U \n%i") ("g" "Godo" entry (file "~/mega/org/gcal.org") "* TODO %^{Description} %^t%?\n %i" :prepend t :immediate-finish t) ("w" "Writing log" table-line (file "~/mega/org//workrecord.org") "|%U|%A||%?|" :prepend t :kill-buffer t)) "Select a capture template\n=========================" "Template key: " (("C" "Customize org-capture-templates") ("q" "Abort")))
  org-capture-select-template(nil)
  org-capture(nil)
  funcall-interactively(org-capture nil)
  #<subr call-interactively>(org-capture nil nil)
  apply(#<subr call-interactively> org-capture (nil nil))
  call-interactively@ido-cr+-record-current-command(#<subr call-interactively> org-capture nil nil)
  apply(call-interactively@ido-cr+-record-current-command #<subr call-interactively> (org-capture nil nil))
  call-interactively(org-capture nil nil)
  command-execute(org-capture)

can someone tell me whats going on please?


texts:
Org tables are great! But sometimes, for non-trivial cases, the formulas get a little unwieldy. E.g.:

#+TBLFM: @III+1$3..@IIII-1$>='(let ((l (-non-nil (mapcar* (lambda (w v) (when (equal w $2) (string-to-number v))) (list @II+1$2..@III-1$2) (list @II+1..@III-1))))) (/ (-sum l) (float (length l))));E%.1f

(There might be a denser Calc syntax for the above, but that's beside the point.)

Editing it as it is all cramped in one line is not great. There is also no way to document the formula or its parts.

Is there a way to split the formula into multiple lines?

If not, is there a way to define an Emacs Lisp function within the same file, so that it is evaluated automatically when the .org file is opened?


texts: Windmove-mode: S-up and S-down becomes text selection instead of switching windows

texts:
I enabled windmove by running m-x  windmove-default-keybindings.

S-left and S-right work as expected when two windows are side by side.

However when  a frame is splitted vertically, I cannot use S-up/S-down to switch between top and bottom window.  Instead they become text selection (much like ctrl-space)

How can I fix this key bindings? Why windmove-default-keybindings cannot set them?

Emacs version: GNU Emacs 24.5.1


texts: I am trying to use aggressive-indent, which I find great, but when I am writing Python code it doesn't seem to work (although general it works fine). I may miss something in the usage of aggressive-indent, making this my fault, but I can't see why. Can someone see what is the problem?


texts: Is there a more convenient way to find out what keys do in org-agenda than looking it up or just pressing them?

texts: Sometimes just pressing keys until one does what I want works, but this feels rather unelegant. Is there an easier way of finding out what keys do what?


texts: Problem " is undefined" appearing when typing Greek stress ( ' )

texts:
I started using Emacs and I wrote a text in Greek. The problem is that the stress that is used upon some letters (ό, ύ, ί, ύ) doesn't work!

It is usually inserted by pressing the ; (I mean by pressing the key next to L) and then the letter upon which will be inserted. That's standard for a Greek keyboard. When I press the ; it says:

<dead-acute> is undefined.

C-h c ; says the same thing.

What can I do to be able to use this key?

It works in other applications, such as a browser. I use Ubuntu 14.04 and I installed its emacs package (Emacs 24.3.1).


texts: ESC < does not work when using ggtags to navigate source files

texts:
I have been using ESC-< or Alt-< to jump to the beginning of the file. After I added ggtags for source navigation, normally it works. But after I press Alt-. to find the declaration/definition of some method/class/variable,
 pressing ESC-< or Alt-< will instead navigate me back to the previous point from which I pressed Alt-. to navigate to the method or class.

I can still use Alt-g g 1 to go to the beginning of the file. But is there a way to still use ESC-< to go the beginning and assign different binding for ggtags to return to previous position?

Sujan


texts: How to customize a magit popup, conditionally on the state of the repository?

texts:
In response to a question about adding an action to magit's push menu, I've written an Emacs Lisp command to implement the extension, and I've learned that I can extend the push menu by calling magit-define-popup-action.  However, not every repository supports the new action.  I've defined another Emacs Lisp function that will tell me, in a particular repository, whether the action is supported.  I want to define a new popup action only when the action is supported.

Is there a hook or other trick I can use to define the new popup action only on those repositories where the action is supported?  Or some other conditional code I can arrange for so that the menu knows, in a way sensitive to a particular repository, whether the action is enabled?  I know for example that P p and P u change their descriptions depending on settings in the git configuration, but I don't see how that is done.

Ideally if the action is not supported, there is no change of setting that can make it supported, and I'd prefer not to have the item on the menu.  But I'd settle for a way to give a description saying the action is unavailable.  And bonus points if I can "gray it out."


texts: How to extend the org koma letter script for cv/resume generation

texts:
I'm quite happy writing a letter in org mode using the koma[0] script for org mode[1]. I create a new header and body, hit C-c C-e k(for koma). Done.
However I don't know where to start in order to write my cv/resume in org mode[2]. There's an overwhelming amount of moderncv examples or even komavariant of moderncv though I wouldn't even know where to start, yet if koma even is the right choice.
Many thanks for giving me some direction on how to achieve this[3] using code below
* Applications
  :properties:
  :EXPORT_AUTHOR: Duffy Duck
  :EXPORT_EMAIL: duffy@duck.com
  :EXPORT_FROM_ADDRESS: Av. Foo, 1234 Acmetown
  :end:
** Acme company
    :export_to_address: Acme company
*** Coverletter
    :properties:
    :export_date: 18.12.2019
    :export_opening: Dear employer
    :end:

    Must create art.

*** Cv                                             :NotWorkingThus:noexport:
    :properties:
    :Title: My dream job
    :photo: smile.png
    :end:
**** Employement
***** One job
      :PROPERTIES:
      :FROM:     <2014-09-01>
      :TO:       <2017-12-07>
      :LOCATION: a city, a country
      :EMPLOYER: The employer
      :END:
   Some job details
***** Other job
      :PROPERTIES:
      :FROM:     <2013-09-01>
      :TO:       <2014-08-07>
      :LOCATION: my city, your country
      :EMPLOYER: The other employer
      :END:
   Some other job details
**** Languages
   - *Elbish*  Fluent
   - *Ancient greek*   Intermediate

[0] https://orgmode.org/worg/exporters/koma-letter-export.html
[1]
[2]
[3]


texts:
Here are my settings:

Windows 10 64bit
GNU Emacs 25.2.1 (x86_64-w64-mingw32) of 2017-04-24

I want to keep the HOME environment variable to by user folder C:/User/chanyoungs for other programs but it seems like emacs needs the HOME to be at the emacs root folder which is C:/User/chanyoungs/Documents/Programming/emacs/. So my solution is to set the system environment variable as my user folder and have a .emacs file redirecting the environments in emacs as below:

  (setq user-init-file "C:/Users/chanyoungs/Documents/Programming/emacs/.emacs.d/init.el")
  (setq user-emacs-directory "C:/Users/chanyoungs/Documents/Programming/emacs/.emacs.d/")
  (setq default-directory "C:/Users/chanyoungs/Documents/Programming/")
  (setenv "HOME" "C:/Users/chanyoungs/Documents/Programming/emacs/")
  (load user-init-file)

Then when I run emacs, it seems like init.el is ran but everything gets messed up. I found out that emacs thinks HOME is C:Users/chanyoungs/Documents/Programming/emacs/Documents/Programming/emacs/Documents/Programming/emacs/

I also did some tests to find out that I think basically emacs is unable to access any further than C:/Users/ i.e. it cannot access C:/Users/chanyoungs which is why it is unable to set HOME environment correctly.

So I tried placing the whole emacs folder in C:/ and changed the .emacs file to point everything to C:/ and this works.

The problem with this is I can no longer open any files in my documents which is a problem. If I keep the emacs folder in documents folder and set the Windows system environment HOME as the emacs folder then this does solve the emacs problem. It seems like emacs is able to access document folders if it's already in the document folder if that makes sense. But ideally, I want to keep the system HOME as my user root folder for other programs.

The strangest thing to all this is that it worked perfectly fine 2 days ago when I first set it up this way but now it's causing all these problems even though I didn't change any emacs settings since.

Any suggestions would be much appreciated.
Thanks


texts: Open edit-server files from emacsclient in a specific frame

texts:
Is there a way to designate a specific frame in which files opened with emacsclient will appear?

I have one monitor that is dedicated to a fullscreen Emacs frame.  I do most of my editing in that monitor, but from time to time I will open a second frame on another monitor temporarily.  I want to ensure that every time I open a file using emacsclient, it gets sent to my fullscreen frame and doesn't end up on any other frames that might be open.

Edit:

The ideal workflow would be that my initial emacs frame gets tagged as the recipient of all emacsclient requests, and the rest is automatic.  I always use the initial frame as my primary emacs frame, and other frames come and go as needed.


texts:
Is there a way to get a face value defined in theme without enabling it?
Something like:
(face-theme-background 'org-block-end-line 'my-mega-theme)


texts: Refile Selected Text to Bottom of Header (Org-Mode)

texts: Is there a way to send the currently selected text/region to the end (or beginning; doesn't matter) of another header? This is similar to org-refile, which sends one header to another, but instead it's with just selected text.


texts: I recently started having an issue. I am unsure as to how long it has existed, but it must have occurred during the past week. Whenever I type Shift-c, Emacs does not interpret it as the character C, but rather the Control command. This acts only in the outline minor mode (regular outline mode is unaffected). I am unsure if this is a component of the mode, or a bug somewhere


texts: Can emacs control other programs windows?

texts:
I am using start-process to start other programs as part of my workflow. For example starting a browser to display the HTML file I am working on, or Visual Studio to debug the EXE I just compiled.

As part of the workflow I switch back to Emacs, continue my work. I do some more editing/compiling, and then have to switch back to this external program.

Does Emacs provide easy ways to manipulate those external programs beyond creating them? Can I programmatically switch to those windows using alt-tab, resize and move them?

I am asking specifically for Windows but it would be good to know about other OSes as well


texts: How to toggle input methods with just ctrl-shift?

texts:
I would like to toggle input method in emacs with OS key binding, i.e. ctrl-shift, so it behaves like a normal desktop application. In other words I want to rebind C-\ to just C-S without any extra keys.

My keypoints are:

I am on Linux
I want all key bindings to work regardless of current language, including evil-ones.
Switching languages should be done on key release (C-S-% should not switch language)

I tried to write XKB-interceptor on C, which is listens XkbActionMessages
and sends it back to emacs. It works, but due to XKB Bug 865 it switches
languages on key press, not release. So it messes with C-S-x key bindings.
There is a patch to workaround this bug, but it not covers XkbActionMessages
message. Extending that patch is too much for me.

Maybe there is easier way to accomplish my goal?


texts: specifying pyvenv in projects .dir-locals.el

texts:
I'm trying to use .dir-locals.el within porjects to specify the Python virtualenv that is activated on a per project basis using pyvenv.  I've read the examples at Directory Variables - GNU Emacs Manual and have tried

((python-mode . ((pyvenv-workon "~/.virtualenvs/default")
         (subdirs . nil))))

With this I get the following error...

File local-variables error: (wrong-type-argument stringp (~/virtualenvs/default)

...and it does  not activate this virtual environment, instead its activating anaconda3 which is a nuisance because I thought I'd purged my system of Anaconda (in favour of using virtualenvwrapper).

I have the following in ~/.emacs.d/settings/python-settings.el (which is called from ~/.emacs.d/init.el)

;; elpy configuration
(elpy-enable)
(pyvenv-activate "~/.virtualenvs/dskit")

;; Set ipython as the default interpreter
(setq elpy-rpc-python-command "python3")
(setq python-shell-interpreter "ipython"
      python-shell-interpreter-args "-i --simple-prompt")

...and as I say I've purged my system of anaconda so I'm not sure how or why its being picked up as a virtual environment.  Is there anyway to get debugging information out of Emacs pyvenv module when its loading to find out what its doing co I can work out whats going on?


texts: Generating tables with headers from code block

texts:
I would like to generate tables that have headers from code blocks. Something like this:

#+BEGIN_SRC emacs-lisp :results value table :table-header | First | Second |
  (identity '((a b) (c d)))
#+END_SRC

#+RESULTS:
| First | Second |
|-------+--------|
| a     | b      |
| c     | d      |

Unfortunately something like :table-header | First | Second | does not exist.  Or rather I am hoping that I am overlooking something. (Here I am using (identity ...) as a placeholder for code which actually calculates a value.)

This workaround doesn't quite do it for me:

#+BEGIN_SRC emacs-lisp :results value table
  (cons (list "First" "Second")
        (identity '((a b) (c d))))
#+END_SRC

#+RESULTS:
| First | Second |
| a     | b      |
| c     | d      |

I have to modify the content of the code block and the resulting header is not actually a header row, its a row like any other.

Related to this (but not 100% the same, above I would like to avoid having to put table setup instructions inside the code block, below that is required), is there a special element that causes the insertion of a separator? Something like:

#+BEGIN_SRC emacs-lisp :results value table
  (nconc (identity '((a b) (c d)))  ; calculated value A
         (list 'linebreak)          ; explicitly inserted linebreak
         (identity '((A B) (C D)))) ; calculated value B
#+END_SRC

#+RESULTS:
| a | b |
| c | d |
|---+---|
| A | B |
| B | D |


texts: Customize vc-mode appearance in mode-line

texts:
I use vc-mode to show information about the current VC state in my mode line, like this:

(setq mode-line-format '(… (vc-mode vc-mode) …))

However, I find the default format of vc-mode pretty verbose.  Notably, it includes the name of the current VC backend, which is not particularly interesting to me—I usually know which VCS the current buffer as, and I don’t really use any VCS other than Git anyway.

How can I customize the appearance of vc-mode?  Ideally, I’d hide the name of the backend, and show just the name of the current branch (or probably something similar to git describe).

Alternatively, if vc-mode can’t be customized, can I somehow get the current branch name from VC, for use in a custom (:eval …) construct?


texts: make `delete-duplicate-lines` ignore blank lines and certain words

texts:
I'm editing a text in org-mode, several lines are repeated since they where part of different files from the same topic.

I want to use delete-duplicate-lines to delete the repeated lines, however, the command removes the blank lines too, which is something I don't want (otherwise I wouldn't have paragraphs!). I want to ignore certain words that exists alone in lines, for instance, "Resume", it is repeated a lot of times in the text, but I want to keep it since is required.


texts:
When I make a plain list like this:

- Pizza making
  This is an elaborate process that
  involves many years of training.

Usually I have to manually press TAB on every new line.
Can this be automated so that org automatically inserts a tab for me if I press return once, and doesn't insert a tab if I press return twice?

[EDIT] Solution:
Pressing C-j gets the job done.


texts: Is there a way to copy the table presented in "column view" as raw text?


texts:
In org-mode agenda, it is very easy to add notes to entries with org-agenda-add-notes (conveniently bound to z by default). However, these notes are filed into a drawer along state change notes where they are anything but accessible.

Now, what I'd like to have is a simple and short way to see all notes attached to a headline from the agenda view. This way, I could e.g. take down why an item is in a WAITING state (i.e., what it is I'm waiting for) without having to include much information into the headline itself and without cluttering the entry's body.

Since adding notes is so easy, it strikes me as odd that it should be complicated to view those notes. I looked for functions named anything with org and note but found nothing of use (exept of course org-agenda-add-notes). Is there a simple way to access those notes I don't see?


texts: Interrupt ELisp interpreter from outside Emacs?

texts: Sometimes Lisp hangs due to an infinite loop, making the whole of Emacs unresponsive, so it can't process any input, C-g included.  So, I was hoping for there to be a way to maybe send it an emergency call from the outside, which would interrupt the Lisp interpreter, but would not kill Emacs altogether.  I've experimented with sending some signals by means of kill -s <signal>, but Emacs seems to quit no matter what signal it is.


texts: Append some text to multiple files in a directory

texts:
I want to append some text to multiple files in a directory. So, I opened the directory in dired buffer and selected the files.
After this, is there any shortcut/ command to append some text to these files? There is a command append-to-file but that does not seem to serve my purpose.
Is there any other better way of doing this?


texts:
Does anyone see what's wrong in my attempt to run notmuch in emacs?

My attempt to run notmuch

helm-M-x notmuch: Cannot open load file: Not a directory, notmuch

My .spacemacs

(autoload 'notmuch "notmuch" "notmuch mail" t)

Notmuch installed and running

notmuch 0.28.2

GNU Emacs 26.1


texts: Sort ido results by recentness even when filtered

texts:
I have ido-use-virtual-buffers set to t, so when I M-x ido-switch-buffer, I initially see a list of files with the most recent files at the top.

However, as soon as I type anything to filter the list of matching buffers, the view switches to a different sort order.

Is there a way to retain the sorting by recentness even when the list is filtered in this way?


texts: How to include hyperlinks to PDF files when exporting LaTeX from org-mode?

texts: I am writing an org-mode file with links like [[./files/article.pdf]]. If I export this to HTML, it works as expected, creating a blue underlined text hyperlink to the file. But if I export to PDF via LaTeX instead, I get a full-sized image of the first page of the PDF embedded in my document. How to get what I want instead?


texts: Display Δ in the *Shell Command Output* Buffer

texts:
I have a shell command I'm running from Emacs that has a Δ character in its output. How can I configure the *Shell Command Output* buffer to display UTF-8 by default?
edit: There could also be something else weird going on. It displays Î8 Î¼s  when it should be Δ15 μs


texts: How do I search&replace selected instances (in particular those occurring in strings, not in variable names – but using an equivalent of 'query-replace is safer and still fine, there should not be too many hits) of lexibank with lexikudang in all files below a certain directory, keeping capitalization – that is, i.e. also replacing Lexibank with Lexikudang and LEXIBANK with LEXIKUDANG?


texts:
Is there an elisp refactoring tool that can rename local variables and function arguments? I would like to be able to turn:

(defun my-func (s r)
  ...
  (use s .. r))

into:

(defun my-func (string replacement)
  ...
  (use string .. replacement))

using a method that knows how to find variable references. I'm okay if it is not super-hygenic.


texts:
How can I put a cursor (with multiple-cursors) in the beginning of every even line in emacs?
Can I use the regular expression .*\n.*\n?


texts:
Windows 10 (64 bit), Emacs 26.1

Here Windows console.
Result of build my project:

gradlew assemble

here result:

as you can see text BUILD SUCCESSFUL is on green color.

Nice.

Now same on Emacs's shell (M-x shell):

Is it possible also to green color text BUILD SUCCESSFUL in Emacs's shell?


texts:
Is there a way to add and view bookmarks in pdf-tools?
Or else How could I go about adding this feature?

I'm not actually sure if this is even a feature of pdfs.
All I know is I can do this with document viewer app on ubuntu.


texts: Is it possible to have different color values for a font-lock face in a string?

texts:
My font-lock-warning-face has a red color. Which works well in almost all circumstances, it is very pronounced.
The problem is, my font-lock-string-face has orange color. So warnings inside strings are hardly visible, because orange is similar to red. For example, it is hard to notice a regexp problem around \.
Is it possible to have a different foreground color in font-lock-warning-face, if the warning is inside a string?
Look at this screen shot, here the \ has a different color, which is hardly noticable. I'd like to use a very different warning color (maybe a red background color) in this case (I don't want to change my string color, neither my global warning color).


texts:
I upgraded to recently released Magit 2. There is a command magit-log-buffer-file. However, it logs file without --follow option, which makes it quite pointless for me (in our source code nearly everything has been moved around recently because of switch to Maven source layout). And I see no way of customizing options for logging anywhere.

Is it possible to log individual files following renames?


texts: python process failed to load environment variables in OSX

texts:
In Emacs 25 GUI,
1. Shell process loads environment variables,
2. Python process, started by run-python, doesn't load environment variables.

Run Emacs terminal mode in iTem2: Both shell and python process load environment variables.


texts:
How do I most conveniently fontify/colorize parts of my mode-line.
Specifically I want the vc branch named to have one color for master and another for other branches.


texts:
Usually there are many .el files in the folders with the name lisp in the installation directory of Emacs.
At start-up, Emacs doesn't load all these files, in consequence a command like M-x calendar-print-day-of-year in only accessible after loading calendar.el or doing M-x calendar.

Is it possible to load all .el files (found at lisp subdirectories) at Emacs' start-up?

The motivation is that there are situations where it would be desirable that that all commands to be at disposal.


texts: Automatically add golang package names that are used but not imported to import statement

texts:
Is there a way or tool in Emacs, specifically by use of go-mode, to automatically add the lines of code to the import statement, while writing code that uses those packages? Let us assume those packages is got by go get or in some other way at a time before, they are somewhere in the src dir or they are just built-in go packages.

Like, in following go program, two built-in packages are used, os and fmt; however only one of them are imported, os. While typing the first line in the main, that uses fmt package, is it possible some tool, existence is in question here, can add the package name to to imports.

package main

import (
    "os"
)

func getHome() {
    return os.Getenv("HOME")
}

func main() {
    fmt.Println("this is my go playground.")

    h := os.Getenv("HOME")
    g := os.Getenv("GOPATH")
    p := os.Getenv("PATH")

    getHome()

}


texts: Change reftex-cite-format based on file type

texts:
I'm currently trying to transition my personal research writing from straight LaTeX to Rmarkdown to allow me to do better reproducible research, and I've run into one little snag.

Currently I have this in my init.el:

(eval-after-load 'reftex-vars
  '(progn
     ;; (also some other reftex-related customizations)
     (setq reftex-cite-format
           '((?\C-m . "\\cite[]{%l}")
             (?f . "\\footcite[][]{%l}")
             (?a . "\\autocite[]{%l}")
             (?t . "\\textcite[]{%l}")
             (?p . "\\parencite[]{%l}")
             (?o . "\\citepr[]{%l}")
             (?n . "\\nocite{%l}")))))

I know I can add lines for Rmd-style citations ([@%l]), but I would like to be able to have the list of potential citation types be context-sensitive. Is there a way to customize reftex-cite-format based on the buffer I'm currently editing, so that I can see the LaTeX-style cites in .tex files, and the Rmd-style cites in .Rmd files?


texts: Translate ae to ä on non-German keyboard

texts:
If for some reason I am stuck to a keyboard with English layout and I often have to enter text in German - can emacs translate ae to ä (or ue to ü) for me?

I do have a not-working solution like this:

(setq abbrev-file-name "~/.emacs.d/abbrev_defs"
  save-abbrevs t) ;; save abbrevs when file is saved and emacs quits

(if (file-exists-p abbrev-file-name)
(quietly-read-abbrev-file))

(add-hook 'post-self-insert-hook 'expand-abbrev)

where in my abbrev_defs I have

(define-abbrev-table 'global-abbrev-table
  '(
    ("ue" "ü" nil 0)
    ("ae" "ä" nil 0)
    ("sz" "ß" nil 0)))

However this only works at the beginning of a word.

Is there a solution for this available?


texts:
I have a bit of a slow pinky. As my other fingers get faster and
faster at typing, my pinky just can't keep up. This frequently leads me to type sentences whose first word starts with two uppercase
letters. Here's a short example.

THere's nothing in there. DEfinitely not a body.

Usually what I do is hit M-b M-c (assuming I spot it immediately),
but I'm getting a little tired of that.

How can I have Emacs fix this automatically for me?

That is, I'd like Emacs to detect when I type a word that starts with
two uppercase letters followed by at least one lowercase letter, and
fix that automatically.


texts:
So I am trying to set a html preamble on my org-publish, and I am using the following code:

(setq org-publish-project-alist
      '(("org-notes"
         :base-directory "~/Projects/blog/"
         :base-extendion "org"
         :publishing-directory "~/Public/"
         :recursive t
         :makeindex t
         :html-preamble "This is just a test"
         :publishing-function org-html-publish-to-html)
        ("org-static"
         :base-directory "~/org/"
         :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
         :publishing-directory "~/Public/"
         :recursive t
         :publishing-function org-publish-attachment)
        ("org" :components ("org-notes" "org-static"))))

However, nothing shows up. Can anybody help me with this?


texts: Is there a command `describe-command', similar to command `describe-function'?

texts:
I use C-h f heavily, but this is all functions in Emacs. I'm often only interested in interactive functions, i.e. commands.

Is there an equivalent for commands? Ideally I'd like ido completion too.


texts: Calculating weighted average in orgmode table

texts:
In the following table

| Item   | Weight | Grade |
|--------+--------+-------|
| Quizes |    .15 |     3 |
| Exam 1 |     .3 |     5 |
| Exam 2 |     .5 |     4 |
|--------+--------+-------|
| Total  |        |       |

What formula can I use to calculate a weighted average (.15*3+.3*5+.5*4) and print it in @5$3?

The best I have so far is #+TBLFM: @5$3=@2$3*@2$2+@3$2*@3$3+@4$2*@4$3, but there has to be a better way of doing this.


texts:
I'm looking for a way to return to the parent hydra after using certain commands. In this example

(defhydra hydra-a (:color teal)
  "a"
  ("b" (progn
         (hydra-b/body)
         (hydra-push '(hydra-a/body)))
   "visit hydra-b")
  ("q" hydra-pop "exit"))

(defhydra hydra-b (:color teal)
  "b"
  ("i" forward-line :exit nil)
  ("q" hydra-pop "exit"))

I need some kind of keyword instead of exit for this line ("i" forward-line :exit nil). If I use :exit t the parent hydra is also closed.


texts: Modification so 'org-match-sparse-tree' with 'org-show-context-detail' set to minimal always shows entry

texts:
I modified org-show-context-detail to minimal.
Which for org-match-sparse-tree means 'show current headline, and entry below if needed' (if needed means the entry will only be shown if point is within the entry).
I would like to modify my config so that the entry is always shown, also in those cases where the 'point' (tag in my case) is not within the entry, but within the headline.
Is this possible?


texts: in org-mode, how to insert timestamp with today's date?

texts:
In a Lisp function, how do I instruct org to automatically insert a timestamp with today's date?

I found the function org-insert-time-stamp, but I don't know how to provide an argument for it that will return today's date.

The documentation for the function says:

(org-insert-time-stamp TIME &optional WITH-HM INACTIVE PRE POST EXTRA)

...but I don't see where to find documentation about what TIME &optional WITH-HM INACTIVE PRE POST EXTRA means or how to specify these in a function.

And here's the function I'm trying to write:

(defun org-today-heading-and-clock-in ()
  "Insert a new heading with today's date, and then clock in."
  (interactive)
  (org-insert-subheading)
  (org-insert-time-stamp (today))
  (org-clock-in))


texts: Enabling asy-mode coloring inside a latex block

texts:
I have started using Asymptote for making diagrams in \LaTeX. Asymptote comes with its own Emacs mode for editing .asy files in which
we typically write Asymptote code.

However, I often write a lot of asymptote code inline inside my Latex buffer.

For instance,

\documentclass{article}
\usepackage[inline]{asymptote}
\begin{document}
Save this code as \verb=test.tex= and compile it with:
\begin{verbatim}
latex test
asy test-*.asy
latex test
\end{verbatim}
\begin{figure}[h]
  \centering
  \begin{asy}
    size(350);

    real a=3;
    real b=4;
    real c=hypot(a,b);

    transform ta=shift(c,c)*rotate(-aCos(a/c))*scale(a/c)*shift(-c);
    transform tb=shift(0,c)*rotate(aCos(b/c))*scale(b/c);

    picture Pythagorean(int n) {
      picture pic;
      fill(pic,scale(c)*unitsquare,1/(n+1)*green+n/(n+1)*brown);
      if(n == 0) return pic;
      picture branch=Pythagorean(--n);
      add(pic,ta*branch);
      add(pic,tb*branch);
      return pic;
    }

    add(Pythagorean(12));
  \end{asy}
\end{figure}
The above code block should be high-lighted with fontlock of \verb=asy-mode=.
\end{document}

generate this tree from the example list on the website.

How can I enable/activate the asymptote mode syntax highlighting (or more generally the full blown asy-mode itself) when the cursor (point) is within the code-block that starts and ends with \begin{asy}....\end{asy}

More generally, how do I activate a given syntax highlighting of mode X between 2 (pre-decided) tokens when we are within working in an Emacs buffer which has major mode Y


texts:
I tag projects with :agenda: tag and use for various agenda reviews, the top level task then having the various project stages (READY, ACTIVE, etc.)
In my weekly review process I want to review the tasks in each of my active projects (or all really) and revise as necessary. Is working directly in the .org file really the only option or can people recommend an agenda custom view that lists project/task hierarchy and the subtasks under projects? I expect there is an easy config but I haven't seen an example nor figured out a suitable config.


texts: How to save a yasnippet placeholder's final value in an Elisp variable?

texts:
In its more recent versions, shell-script mode tailors its behavior in response to the sh-shell variable's value, which indicates the shell variant (zsh, bash, etc.) that the script is for.

I've written this simple snippet (for shell-script mode) that uses the value of sh-shell:

# -*- mode: snippet -*-
# name: shebang
# key: shebang
# --
#!/usr/bin/env ${1:`(symbol-name sh-shell)`}
# -*- mode: shell-script ; sh-shell: $1 -*-

After one types shebang<TAB>, and assuming that sh-shell is set to bash, the following text is inserted

#!/usr/bin/env bash
# -*- mode: shell-script ; sh-shell: bash -*-

...with the cursor positioned at the beginning of the first bash.

At this point one has the option to type the name of a different shell, which would replace both occurrences of bash.

Is there a way to modify the snippet so that, once the value of the $1 field is finalized, this value is stored in sh-shell?  In this way the snippet would serve, in addition to inserting some text, as a way to re-set sh-shell to a new value.

I know that I can always run M-x normal-mode after updating the $1 field, to have Emacs read the new buffer mode settings from the -*- ... -*- line, but it'd be nice to get the same end-result automatically once the snippet is finalized.


texts: Choosing files and directories from widgets

texts:
I'm looking for the most convenient way to set up a Customize options page to enter a set of directories and then select one of those directories and one file in the selected directory (if possible, without spelling out the implied extension).

I'd like a constrained file picker, presumably using a pop-up or in the minibuffer, or autocompletion within the text field but the directory and file data types in my widgets give basic text fields instead; this means a lot of copying and pasting.

Is there a convenient way to choose between non-constant values and/or to modify widgets on the fly beyond widget-value-set (I would need to populate a list of files when the selected directory changes)? Can packages like ido, helm, icicles etc. be configured to provide autocompletion in Customize widgets?


texts: How to always kill dired buffer when deleting a folder?

texts:
If I'm in dired and have a subfolder with another dired buffer (a common situation when navigating up/down directory) and want to delete a folder, I hit Dx to mark for deletion, then execute.

Emacs then asks if I want to trash the folder. I confirm, then it asks if I want to kill the dired buffer of the folder as well.

I can't think of a situation where I'd like to trash the folder but keep the buffer. Is there a way to always trash the buffer when trashing the folder?


texts: How to get two space indentation for JS/JSX?

texts:
Expected behavior (demonstrated in vim): http://zc.d.pr/1a7b1/2p5XiuwX

I expect hitting Enter should indent the pointer at the correct level with two spaces in, matching the surrounding syntax, without reflowing/reformatting any previous lines.

Actual behavior, after manually switching to web-mode, since it still seems to default to javascript-mode: http://zc.d.pr/V73w/2yuh0MsX

Really struggling to figure this out (I'm a vim expat giving emacs a whirl). I found these two articles:

http://codewinds.com/blog/2015-04-02-emacs-flycheck-eslint-jsx.html
http://www.cyrusinnovation.com/initial-emacs-setup-for-reactreactnative/

But still have had no luck. You can find my emacs config here: https://github.com/neezer/.emacs.d/blob/master/config.org#webmode (been tweaking the config so it doesn't match exactly what's in those articles).


texts: How to Set Visit File Keystroke to Ask Root Password If Needed in Dired Mode

texts:
Trying here to accelerate root file editing via dired mode.

That way thought in somehow adjust visit file keystroke f, as default, to either ask for root password or to enter it as root automatically.

Would be a way to /sudo::/directory, but binded to visit, in a way that wouldn't be necessary to type /sudo:: everytime before dired command, when necessary. Is desired only enter f in given root user directory and minibuffer automatically asks for password.

Any ideas on how could that be done?


texts: Insert Org-id Link at Point via Outline Path Completion

texts:
Currently to insert internal org-mode org-id links, I navigate to a heading or pull it up in agenda view (C-a s heading test search RET), store the link with C-l (org-store-link), going back to where I want to insert the link, then insert the link with C-c C-l (org-insert-link).

Instead, I would prefer to map a key that allows me to insert a link at
the current point using tab completion similar to org-refile (C-c C-w). The intended result would be an org-id internal link in the form:

[[id:d7534b2f-c221-4dea-8566-d5ce3e4e1b78][Example Link]]

Looking through org-id.el, it seems like org-id-get-with-outline-path-completion was designed for this purpose. I tried:

(global-set-key "\C-ci" (lambda () (interactive) (org-id-get-with-outline-path-completion)))

but it didn't work as intended.

I have the following in my init.el file:

;; Use global IDs
(require 'org-id)
(setq org-id-link-to-org-use-id t)

;; Update ID file .org-id-locations on startup
(org-id-update-id-locations)

;; Refile options
(setq org-refile-targets (quote ((nil :maxlevel . 9) (org-agenda-files :maxlevel . 9))))
(setq org-refile-use-outline-path 'file)
(setq org-outline-path-complete-in-steps t)
(setq org-refile-allow-creating-parent-nodes t)


texts:
Example:

How do I make faces combine correctly? I am not opposed to providing a separate set of instructions for each combination (per theme), but do not know how to do that.


texts: Magit: How to show differences within lines

texts:
I have a file, I make some changes.
Here how SmartGit shows differences.

As you can see it shows where the difference is within the line. It changes background to red color in concrete position. And it's very good. I don't need to spend time to find differences. I immediately see where is the difference.

Now what it looks like in Magit:

As you can see Magit says that the difference was in WHOLE line. It's not showing where the difference is within the line. So I need to find where is the difference manually. I need to do this every time. It's not very comparable.
Suppose I have differences in 20 lines. I need to spend a lot of time to find what actually changed. It's not very good.

Can magit show differences at the actual column where the change is? As in SmartGit.


texts:
I need a function that can determine whether an org-time-stamp in a table equals the current date.

Example:

#+NAME: test
| date             | breakfast |
|------------------+-----------|
| <2015-11-06 Fri> | eggs      |
| <2015-11-07 Sat> | oatmel    |

I can get the timestamp from last line in above table with org-table-get-remote-range. For example:

(substring-no-properties (org-table-get-remote-range "test" "@<$1"))

Returns:

<2015-11-07 Sat>

How can I convert that string to a number so that I can compare it with something like:

(format-time-string "%Y%m%d" (current-time))?


texts: Got problem 'Wrong number of arguments: setq, 3' when trying to open file

texts:
I am using Aquamacs 3.3  GNU Emacs 25.1.1, and I got the error message 'Wrong number of arguments: setq, 3' every time when I trying to open a file the first time.

How could I solve this problem?

Thank you.


texts: How to make emacs respect non-exe executables on windows?

texts:
I've installed flake8 for flycheck to use to check my python syntax. I installed flake8 in cygwin, using the python interpreter shipped with cygwin, which results in a flake8 file in C:\cygwin64\bin. The problem is, emacs seems to only respect exe files so if I (executable-find "flake8") it yields nil. I had the same problem when I enabled anaconda-mode, since cygwin has python2.7.exe and python in C:\cygwin64\bin. I solved this by copy python2.7.exe to python.exe, but the flake8 problem can't be solved this way.

I vim /usr/bin/flake8d, turns out it's really flake.py with python code inside to run with python.

tl;dr: Generally the question is: How to make emacs aware of "excutables" that would normally run by python flake8.py, node eslint.js? (When I used eslint with flycheck for js-file syntax check, it just works, maybe there's the solution?)

Thanks in advance.


texts:
I've a hard time to make Gnus working properly. I got the following error :

  Debugger entered--Lisp error: (void-function nnir-search-engine)

Any idea what is wrong? I precise that I've no problem sending some mails, so the SMTP side is fine.

I can provide the full backtrace error if needed. Thanks.

My config:

I've the following in ~/.gnus.el :

(require 'nnir)
;; I added this require just in case but does not change anything

(setq gnus-select-method
      '(nnimap "gmail"
           (nnimap-address "imap.gmail.com")
           (nnimap-server-port 993)
           (nnimap-stream ssl)))
               (nnir-search-engine imap)
               (nnimap-authinfo-file "~/.authinfo")))

My .profile :

export EMAIL="my_mail@gmail.com"
export NAME="Rico"
export SMTPSERVER="smtp.gmail.com"

My .authinfo :

machine SMTP.gmail.com login my_mail@gmail.com port 465 password my_pwd


texts: Specifically, I want to sync an Rnoweb (Rnw) source with a PDF opened in either Skim or Evince using polymode. Note that I have no problem weaving or exporting Rnw files and viewing PDFs with Skim. Thanks.


texts: Why can't multiple-cursors type in org-mode files?

texts:
I use multiple cursors and I use org-mode extensively though the two together does not work.

This buffer is in fundamental-mode

this is the first line
this is the second line

I'm going to put point amd mark around these two lines and invoke mc/edit-ends-of-lines by hitting it's bound key and type "with an ending"

Now the buffer looks like this

This buffer is in fundamental-mode

this is the first line with an ending
this is the second line with an ending

Now i'm going to put the buffer in org-mode. It now looks like this:

this is the first line
this is the second line

I'm going to put point amd mark around these two lines and invoke mc/edit-ends-of-lines by hitting it's bound key and type "with an ending"

this is the first line
this is the second line with an ending

the cursor appears at the end of both lines, and new characters only appear on the last of the cursors. The Multiple Cursors github page is fairly clear that opening issues/asking them to fix it for me is not desired (which is completely fine, and I greatly respect that).

Is this expected to work, or is there some known issue around this that i should be googling for?

here are the relevant snippest from my init.el file, the whole of which can be found here: https://github.com/thearthur/arthur-s-emacs-config/blob/master/init.el#L370

(use-package multiple-cursors
  :ensure t
  :config
  (global-set-key (kbd "C-S-c C-S-c") 'mc/edit-lines)
  (global-set-key (kbd "C-S-w C-S-w") 'mc/mark-all-dwim)
  (global-set-key (kbd "C-S-e C-S-e") 'mc/edit-ends-of-lines)
  (global-set-key (kbd "C->") 'mc/mark-next-like-this)
  (global-set-key (kbd "C-<") 'mc/mark-previous-like-this)
  (global-set-key (kbd "C-c C-<") 'mc/mark-all-like-this))

...

(use-package org
  :ensure t
  :commands org-mode
  :config
  (defun org-summary-todo (n-done n-not-done)
    "Switch entry to DONE when all subentries are done, to TODO otherwise."
    (let (org-log-done org-log-states)   ; turn off logging
      (org-todo (if (= n-not-done 0) "DONE" "TODO"))))
  (define-key org-mode-map (kbd "C-c SPC") 'ace-jump-mode)
  (setq org-agenda-files (list "~/ownCloud/org/log.org.gpg"))
  ;; make source code in org-mode files look pretty
  (setq org-src-fontify-natively t)
  (add-hook 'org-after-todo-statistics-hook 'org-summary-todo)
  (add-hook 'org-mode-hook 'org-indent-home)
  (setq org-hide-leading-stars t)
  (setq org-startup-truncated nil)
  (setq org-log-done 'time)
  (setq org-tags-column (- 4 (window-width)))
  (add-hook 'org-mode-hook 'flyspell-mode)
  (add-hook 'org-mode-hook #'maybe-git-auto-commit-mode)
  (require 'org-crypt)
  (org-crypt-use-before-save-magic)
  (setq org-tags-exclude-from-inheritance (quote ("crypt")))
  ;; GPG key to use for encryption
  ;; Either the Key ID or set to nil to use symmetric encryption.
  (setq org-crypt-key "A20F3E34E472C3BB")
  (define-key org-mode-map (kbd "C-M-s-d") 'org-decrypt-entry))

...

(use-package org-bullets
  :ensure t
  :config (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))))


texts: Why is `git` running incredibly slow with `tramp` and `ssh` and `eshell`

texts:
Commands like ls, cd, etc. run perfectly fine using tramp, but as soon as I run a command such as git status, the speed is unbearably slow, and I always receive these messages in the *messages* buffer:
Tramp: Opening connection for work using ssh...
Tramp: Sending command ‘exec ssh -q    -e none work’
Tramp: Waiting for prompts from remote shell...done
Tramp: Found remote shell prompt on ‘work’
Tramp: Opening connection for work using ssh...done

So it's like reopening an ssh connection each time I run git? That doesn't make any sense to me. This is what my ssh config looks like:
Host *
     ControlMaster auto
     ControlPath ~/.ssh/sockets/%r@%h-%p
     ControlPersist 600

Host work
     HostName <ip>
     IdentityFile <key>
     User root
     Port 22


texts: Why does emacs on a remote computing cluster behave differently depending on how the cluster is accessed?

texts:
I use SSH to work on a Linux computer cluster, emacs is my preferred text editor there.

My local computer is a Windows 10 machine. If I use PuTTY to access the cluster remotely, when I run emacs, it behaves as I'm used to it behaving on a cluster: it starts immediately, and CTRL+- lets you undo things.

I also have a Windows Subsystem for Linux (WSL) version of Ubuntu installed on the same machine, 18.04 LTS. When I SSH into the same cluster and open emacs, it behaves differently: it takes about 4 seconds to start up, and CTRL+SHIFT+- lets you undo things.

It was my impression that when I'm running emacs on a remote system, it is the remote system's emacs executable that runs, and it configures itself with various files also from the remote computer, not from my local machine. But clearly some of my local settings are bleeding over into the remote emacs, since it runs differently depending on whether I access the cluster via PuTTY or SSH-via-Linux-subsystem.

Any advice on what it is on my local machine that affects the remote running of emacs?

Whatever it is, I don't think that it is specific to the cluster, since this behavior is repeatable on two different clusters (emacs 23.1.1, Linux 2.6.32-696.20.1.el6.x86_64; the other emacs 24.3.1, Linux 3.10.0-514.16.1.el7.x86_64) and on the Google Cloud Platform (emacs 24.3.1, Linux 3.10.0-957.27.2.el7.x86_64). The behavior is the same whether or not emacs is installed on the local WSL kernel. Presumably it's still something to do with WSL, though, but I don't know enough about how emacs works to be able to troubleshoot at that end. So any help about what to look for would be greatly appreciated.


texts:
I have been using eclipse for a little while now and I did find some shortcuts highly useful, in particular the ability to move a rectangular selection of lines up and down using Alt+Up/Down. I have been looking around for this functionality in emacs. So far I have found the following script:

(defun move-text-internal (arg)
   (cond
    ((and mark-active transient-mark-mode)
     (if (> (point) (mark))
            (exchange-point-and-mark))
     (let ((column (current-column))
              (text (delete-and-extract-region (point) (mark))))
       (forward-line arg)
       (move-to-column column t)
       (set-mark (point))
       (insert text)
       (exchange-point-and-mark)
       (setq deactivate-mark nil)))
    (t
     (beginning-of-line)
     (when (or (> arg 0) (not (bobp)))
       (forward-line)
       (when (or (< arg 0) (not (eobp)))
            (transpose-lines arg))
       (forward-line -1)))))

(defun move-text-down (arg)
   "Move region (transient-mark-mode active) or current line
  arg lines down."
   (interactive "*p")
   (move-text-internal arg))

(defun move-text-up (arg)
   "Move region (transient-mark-mode active) or current line
  arg lines up."
   (interactive "*p")
   (move-text-internal (- arg)))

(global-set-key [\M-up] 'move-text-up)
(global-set-key [\M-down] 'move-text-down)

This does work except for the fact that this moves the selection. I would rather move all lines (including trailing newline) included in the selection instead. Is there a way to realize this as well?


texts:
When Dired sorts files by name, it sorts in alphabetical order. That's fine with letters; however, when the file names start with numbers, it would be better to sort in numerical value.

Example:

This is how dired sorts my files:

10
11
12
13
...
1
21
22
23
...
2
31

I want 1 2 3 4 … 9 10 11 …


texts: Can you intercept a function and return your own value using advice?

texts:
Is it possible to use advice to not only run your function first, but also prevent the advised function from running at all?

For example, say a command ordinarily calls read-from-minibuffer to get a return value:

(defun get-name ()
  (read-from-minibuffer "Enter your name: "))

Let's say, in this example, my name never canges. Entering it manually is time-consuming. Can I use the advice system to intercept the call to read-from-minibuffer and return my own value?

For example, something like:

(defun return-my-name (&rest args)
  "Jack")

(defun quick-get-name ()
  ;; Add the intercepting advice, call the function, then remove the advice.
  (advice-add 'read-from-minibuffer :intercept 'return-my-name)
  (get-name)
  (advice-remove 'read-from-minibuffer 'return-my-name))

The key behaviour I need is to be able to fall back on the original function depending on the input. For example, I might want to intercept the command if the prompt is asking for a name, but not if it is asking for some other information, like age:

(defun return-my-name (prompt &rest args)
  (if (eq prompt "Enter your name: ")
      "Jack"
    (read-from-minibuffer prompt))

Anyone know if the advice system is capable of this? Can it be done some other way, for example using aliases?


texts:
I often work with Tmux and I really like the ability to have multiple windows where each window has a custom set of panes. This allows me to quickly switch between layouts without losing anything.
So far in Emacs I know how to navigate buffers, switch from one buffer to another, close a buffer, open a new buffer, split the window and access a list of buffers. What I haven't been able to do is to have multiple custom setups and be able to quickly switch between them. Like so:

How would one go about achieving this?


texts: How to get org2blog to use .authinfo.gpg

texts:
I have .authinfo.gpg set up and working as the authentication mechanism for ERC (with multiple IRC servers) and Gnus (with multiple IMAP servers) using the following in my config:

(require 'auth-source)

(setq
 auth-sources '(default
                 "secrets:session"
                 "secrets:Login"
                 "~/.authinfo.gpg"
                 "~/.authinfo"
                 "~/.netrc"
                 )
 epa-file-cache-passphrase-for-symmetric-encryption t)

My .authinfo.gpg includes entries like this (sanitized, naturally, and trimmed to just WordPress blog samples):

machine example.com login JohnDoe password "password" port http
machine example2.com login JohnDoeJr password "password2" port http

My org2blog config is:

(use-package org2blog
  :defer t
  :ensure t
  :config
  (require 'org2blog-autoloads)
  ;;  (org2blog/wp-use-sourcecode-shortcode ‘t)
  (setq
   org2blog/wp-confirm-post t
   org2blog/wp-blog-alist
   '(
     ("example1"
      :url "http://www.example.com/xmlrpc.php"
      :username ,(car (auth-source-user-and-password "example.com"))
      :password ,(cadr (auth-source-user-and-password "example.com"))
      :default-title "Hello, World!"
      :default-categories ("Uncategorized")
      )
     ("example2"
      :url "http://www.example2.com/xmlrpc.php"
      :username ,(car (auth-source-user-and-password "example2.com"))
      :password ,(cadr (auth-source-user-and-password "example2.com"))
      :default-title "Hello, World!"
      :default-categories ("Uncategorized")
      ))))

Using the above when logging into either, I get

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

I've tried variations on the above but can't seem get get it to use .authinfo.gpg. The above error message is returned or I am prompted for my password.

I've used the following references to help me but so far to no avail:

http://vxlabs.com/2014/05/25/emacs-24-with-prelude-org2blog-and-wordpress/
http://thewanderingcoder.com/2015/02/publishing-from-org-mode-to-wordpress/
https://github.com/punchagan/org2blog

I'm running:

GNU Emacs 24.4.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.8) of
2015-03-03 on lm-lvm-tpt430
Org-mode version 8.2.10    (8.2.10-35-g19a7d6-elpaplus @
/home/username/.emacs.d/elpa/org-plus-contrib-20150316/)
org2blog 20150114.2301 from Melpa


texts: Is there a simple way to use all org-files referenced in a main file for the org-mode clock table

texts:
I'm using org-mode to keep track of the time I spend on various projects. I have one main org file and two more for two large projects I'm working on. All three are listed in org-agenda-files. I created a clock table in the main org file and set

:scope agenda-with-archives

in the clocktable header to summarise the time spent. This all works fine.

However, I also have a few smaller projects that also have time tracked in their own org file (located in the subdirectory that contains everything about those projects), and I'd like to track time in those as well.

Of course I could add those files to org-agenda-files, but that would mean updating my .emacs every time I start a new small project. Not the end of the world of course, but since I already have a link to the small-project-org-files in the main org file (see example below), I'd like to set the :scope to something like

:scope agenda-with-archives linked-org-files

Ideally (although I'm not using that yet) including archive files of those smaller projects would be great to (something like :scope linked-org-files-with-archives).

Here is an example of how my main org file is structured:

* Small project 1
  See file:~/Projects/Project 1/notes_project_1.org for more details.
* Small project 2
  See file:~/Projects/Project 2/notes_project_2.org.
** DONE Some small task I can do quickly
   CLOCK: [2014-12-05 vr 12:19]--[2014-12-05 vr 12:40] =>  0:21
   Some info on the small task.

Any idea on how to achieve this?


texts: pop up buffer / window when using python-shell-send-buffer

texts:
I like using python-shell-send-buffer, but I am annoyed of looking for the command's buffer.

So I'm looking for a function, that recognizes whether the buffer is already displayed. Since I use two windows on one frame, when coding in python, it would be nice if the function also checks if there are already two windows on the current frame. If not, it has to split the frame horizontally. Additionally I want the buffers to be automatically positioned, as I'm used to have my source code on the left side and the python shell with the output on the right side.


texts:
I wanted to add ~/.emacs.d/custom-info/ to Info directories, where I’d link some locally installed programs’ documentation (like AsynK.io).

(add-to-list 'Info-default-directory-list
  (expand-file-name "./custom-info/" user-emacs-directory))

The directory is added, as expected:

Info-default-directory-list
("/home/m/.emacs.d/custom-info/" "/usr/share/info/" "/usr/share/info/")

However, there’s no AsynK entry in C-h i, while:

% cat ~/.emacs.d/custom-info/asynk.info| grep -A2 'START-INFO-DIR-ENTRY'
START-INFO-DIR-ENTRY
* ASynk: (asynk).               Contacts synchronization.
END-INFO-DIR-ENTRY
%

What am I doing wrong?


texts: Is it there any good package for Emacs to do bug/issue tracking locally?

texts: Does anyone know any good Emacs package or solution for local bug/issue tracking?


texts: How to find (and list) abbreviations in a buffer?

texts:
I am using Emacs to write a long thesis in LaTeX. I have no regrets, so far (about the Emacs/LaTeX combination, that is). One of the last things I need to do before I can submit the darn thing is to compile a list of abbreviations. Of course, I should have kept tabs on the abbrevs I have used, but I haven't.

Now, is there some way to employ the power of Emacs to find abbreviations, ideally even to have them displayed in a separate buffer?

Obviously, this is a good use-case for regular expressions. Abbreviations could be defined as at least three consecutive upper case letters delimited by whitespace. My regex skills are very limited, though. I tried to search (isearch.el) for \b[A-Z]{2,4}\b, but all I got was Failing regexp Isearch.

What am I doing wrong? Maybe someone has already written a useful script for this purpose. (Couldn't find anything on (M)ELPA.)


texts: swap files created when I open a new frame

texts:
When I use C-x 5 2, it opens a new frame showing the same file that I'm already editing. So, every time I open a new frame, I get an unwanted need to "swap" to another file. Is there a way to get around this?
Thanks.


texts:
On startup I can see the fonts and color scheme before my own are loaded in.

Is it possible to drawing the interface until a certain moment when settings are loaded?

Incase it's important: Linux, GTK3 UI, 26.2 (latest at time of writing)


texts: How to make emacs automatically kill buffer after invoking delete-file command?

texts: Whenever I delete a file that I no longer need in emacs using delete-file command, the buffer associated with the file is still open in emacs. Is there a way I can change this behaviour so that whenever I delete a file, the buffer associated with it is also automatically deleted.


texts: Default Inline Image Background in Org Mode

texts:
When an image has a transparent background, Emacs of course respects that.

Unfortunately, this can lead to issues with display:

Is there a way to display a specific color (e.g. white) behind the image? There appears to be some support for it in ImageMagick images.

The specific stuff I'm working with right now can have the background color set, however I have to add an extra few lines to every single figure in order to do that, which is less than ideal. I would like to get it to where inline images displayed in org-mode have the background color set by default.

(Note: this isn't org-babel specific, it just happens to be how I'm getting these images right now)


texts:
Suppose I have

(setq a 1 b 2)

How can I elegantly swap the values of a and b without using a temporary variable?


texts: Hide table border lines in org mode tables?

texts:
Is it possible to configure an org-mode table so that all border lines of the table are hidden when exported (e.g. to .tex, pdf and HTML)?

I found a similar question in Emacs.SE but wasn't sure whether it's about the same thing.
The question asks about font-lock, which I am not familiar with (yet). But I am interested in
consistently and completely hiding the borderlines of a table in the output as you could do in MS Word.


texts: Importing table of contents from another org file?

texts:
Specific Use Case: I have two files, index.org and blog.org. I would like to include the table of contents of blog.org in index.org.

The "obvious solution" to me is to use org-babel to inject html upon export (probably with JQuery+NodeJS). However, this seems kind-of hacky to me. Is there a better, more idiomatic solution?


texts: How can I enter a list in a cell of an org-mode table?

texts: Can I enter an org-mode list in a cell of an org-mode table?


texts: How can I turn off clickable links in markdown mode?

texts:
I would like markdown-mode to treat URLs as normal text, so that I can click on them to place the cursor inside them rather than loading the page in a browser.

I tried toggling goto-address-mode, which didn't help, and I tried removing http and https from the list of Markdown Uri Types.  I tried a few other things that in retrospect don't make much sense; I looked through all the variables that began with markdown- and couldn't find any that applied.
Is there a way to do this?


texts:
I give this new interface the benefit of a doubt, but I'm close to just removing this version and going back to something earlier and more friendly.

There appears to be no way, at least not on the surface to push your changes to new branch, i.e. Say, you've checked out branch A, created branch B from it and now you want to push your branch B while at the same time creating a branch with the same name in remote repository.  Something you'd typically achieve by running:

git push -u origin B

There is no way that I can see in the pop-up buffer to accomplish this. When I use -u in combination with o - I am prompted for another branch = useless. When I combine this with m - instead of creating new branch, Magit tries to push the local branch tracking A - this is completely useless behavior. t and T pushes tags, so in this case is useless too.

There's also no option to just push, which was one of the reasons to use Magit instead of just typing this on the command line...

To prevent further attempts to mark this as a duplicate: this question is not about pushing to the remote branch tracked by local branch (possible by pressing P u) this is about creating a branch in remote repository named after local branch and pushing into it (all at once), something that can be achieved by typing:

git push -u origin B


texts: Fullscreen emacs and narrow column of text

texts:
I edit markdown text in Emacs fullscreen. Naturally in fullscreen the text flows wider, from left edge of the display to the right, thereby necessitating more eye movements. I want to narrow down the entire text display to, say, 80 characters and position it in centre of the fullscreen Emacs. The emacs buffer should look as if there is unused empty space to the left and right of this centered narrow column of text that is being edited.

What is the simplest way to achieve this? (I could split into 3 buffers, but that's not simpler).


texts: Break a long string in a concatenation of shorter ones

texts:
Is there a predefined way to split

"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."

in something like

"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore " +
"et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut " +
"aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum " +
"dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui " +
"officia deserunt mollit anim id est laborum."

I'm looking for a mode-aware word wrapping: I mean, the wrapping should take into account that the line is a string and the filled paragraph should made by a syntactically correct concatenation of strings.


texts: How to open helm-imenu in existing buffer

texts:
I'm using golden-ratio to automagically resize my buffers when I switch from one to another.

Say I have 2 buffers, my window is split vertically and active buffer is the one on the right. While activating helm-imenu, I would like to open results in an existing buffer on the left side (because those have a higher height than the ones below/above the active one).

I know of C-t, but I have to use it N times before it places helm-imenu buffer where I want.