texts: What is the problem with this yank function in elisp in emacs?

texts:
Idea I will like to construct a simple emacs function that copies the  yy  functionality in vim.
The function should yank a visual-line into kill ring without deleting the line.

Function
Here is the function I came up with.

(defun vim-line-yank-func()
    (interactive)
    (beginning-of-visual-line)
    (mark-end-of-sentence 1)
    (end-of-visual-line)
    (copy-region-as-kill (mark) (point))
)

Let us run this program on some data. Consider the following text with original line breaks (► is position of the mark "\n" = newline mark).

Pellentesque dapibus suscipit ligula. ► Donec posuere augue in quam.  Etiam \n
vel tortor sodales tellus ultricies commodo.  Suspendisse potenti. \n
Aenean in sem ac leo mollis blandit.

The expected answer is

Pellentesque dapibus suscipit ligula.  Donec posuere augue in quam.  Etiam

but the answer I keep getting is the following:

 Donec posuere augue in quam.  Etiam

I am befuddled as to why this is happening. When I run these commands in succession things seem to work fine.
Thank you for your help!


texts:
I am trying to set up some keybindings for working with scheme. I have these two mode hooks which contain the bindings I want:

(add-hook 'scheme-mode-hook
          (lambda ()
            (local-set-key (kbd "C-j") 'scheme-send-last-sexp)))

(add-hook 'scheme-mode-hook
          (lambda ()
            (local-set-key (kbd "C-c C-j") 'scheme-send-region)))

The problem is that I also have these hooks defined which I use for elisp:

(eval-after-load "paredit"
  #'(define-key paredit-mode-map (kbd "C-j") 'eval-last-sexp))

(eval-after-load "paredit"
  #'(define-key paredit-mode-map (kbd "C-c C-j") 'eval-region))

My question is: how can I modify eval-after-load to set up my scheme key bindings only when in Scheme mode?


texts: Auto-indent without creating indentation in empty lines

texts:
Is there a way to use auto-indentation in Emacs without creating indentation on empty lines?

For an example from C, if I have

if (true)
{
   printf("word");
}

and then insert a newline after the opening brace

if (true)
{
>>>
   printf("word");
}

then a new line is created and if auto-indention is enabled then extra space is also added, here represented by the symbol >.

However, when I commit this code using a VCS, I DO NOT want the extra space from the empty line to be included, but I DO want the newline.

Is there an auto-indentation system for Emacs which will only add extra space to the buffer if I type a character after creating a newline? Or else is there a different scheme that could accomplish my goal of avoiding adding spaces on empty lines?


texts:
After running M-x magit-status Emacs provided me this suggestion in the mini-buffer:

You can run the command ‘magit-status’ with M-x m-stat RET

Is this a built-in feature of emacs? If not, does anyone know which package provide it? Or is this all limited to magit?


texts: OSX - turn off command key in terminal emacs

texts: I'm trying to disable the command key when running emacs from the terminal. Whenever I mistakenly press CMD-V instead of ALT-V, the text from my Mac clipboard gets copied into the buffer. From related questions, I've tried adding setq mac-command-modifier 'none or 'meta and setq ns-command-modifier 'none to my .emacs file. There is no effect. How can I disable the command key in emacs? If I can't disable it, can I rebind CMD-V to do nothing?


texts: I want to copy images from Emacs to macOS clipboard. I have tried selecting them and yanking, which hasn't worked. Google also didn't have a solution.


texts: How to automatically sign commits with magit?

texts: I'm interested on having each of my commits signed with my GPG key. Since I use magit for interfacing with git, I was wondering if telling magit to sign each commit was possible (or some workaround to achieve this was feasible, at least).


texts: Centering within comment blocks or ASCII art

texts:
I have C comments like this:
/******************************************************************************
 *                   Includes                                                 *
 ******************************************************************************/

I want to be able to center within the *'s like this:
/******************************************************************************
 *                                  Includes                                  *
 ******************************************************************************/

I've been unable to do this. If I try M-x narrow-to-region and use M-x center-line, it deletes all the spaces on the right hand side instead of preserving them. Using M-x picture-mode does not improve matters. I tried moving to the fill column using M-x move-to-column hoping it would fill in the spaces, but it stops at the current length in both picture and non-picture mode.


texts: Previous indentation is discarded on newline

texts:
Let's say I have the following code:

void foo(){
    ~
}

I have marked point with ~.
When I press enter the electric indentation works as normal but it doesn't keep the indentation for the previous line.

void foo(){
// no indentation on this line
    ~
}

How can I set my .emacs file to keep the indentation? Expected result:

void foo(){
--->
--->~
}

Any help is appreciated.
Using emacs 26.1


texts: How to indent lists but not headings in org-mode?

texts:
As the question says: I would like to indent the lists using org-indent-mode (or any other option) but not the headings. The org-indent-mode produces

* heading 1
  * heading 2
  - xxxxxxxxxxxxxxxxx
    xxxxxxxx
    - xxxxxxxxxxxxxxx
      xxxxxxx

I would like to have

* heading 1
** heading 2
- xxxxxxxxxxxxxxxxx
  xxxxxxxx
  - xxxxxxxxxxxxxxx
    xxxxxxx


texts: Sensible stack-like quit-restore behavior in side-window?

texts:
How can I get sensible stack-like behavior from a bottom side-window? I've configured both Ag and Help to display their buffers using display-buffer-in-side-window. I like to maintain a window configuration like

+-----------+    +-----------+
|           |    |           |
|           |    |     A     | <- main workspace
|     A     | OR |           |
|           |    +-----------+
|           |    |     B     | <- search/compilation/help
+-----------+    +-----------+

where A is my main work area, and B is acts as a drawer for things like search results, compilation errors, and Help buffers. In most cases, I'd like hitting q in B to bury the buffer and delete the window. If B was displaying something else prior, I'd like q to bury the current buffer and reveal the previous buffer. Once I've q'd out of all the buffers that were displayed in B since it popped up, I'd like the window to be deleted. The buffer in A should not be part of this buffer stack.

For instance, say I start with my_code.rb in A. I run a search and Ag pops up B to display the results. Hitting q buries the Ag buffer and deletes B, leaving me with a clean view.

But say instead of q'ing out of the search results, I ran a help command like describe-variable. A *Help* buffer supplants the search results in B. Hitting q buries *Help* and the search results are visible again. I hit q again, expecting it to bury the search results and delete B, but instead it displays my_code.rb in B, leaving me with an unwanted split view.

It sounds like the quit-restore window-parameter controls this, but I'm not sure how to manage it. I inspected its value using at various points during the above flow, and found the following:

search results displayed in B:

(window
window
#<window A on my_code.rb>
#<buffer *ag search text:my-search-term dir:~/my/path/*>)

help buffer displayed in B:

(other
(#<buffer *ag search text:my-search-term dir:~/my/path/*> 225
 #<marker (moves after insertion) at 225 in *ag search text:my-search-term dir:~/my/path/*> 12)
#<window 72 on *ag search text:my-search-term dir:~/my/path/*>
#<buffer *Help*>)

search results again displayed in B after quitting the Help buffer:

nil

So it seems that quitting the Help buffer is causing the quit-restore window parameter to be discarded wholesale?

For reference, this is my display-buffer-alist configuration:

(setq
 display-buffer-alist
 `((,(rx bos
         (or (and "*ag " (1+ not-newline) "*")
             "*Help*")
         eos)
     (display-buffer-reuse-window
      display-buffer-in-side-window)
     (side . bottom))))


texts: I am using projectile in a project with many externals (hg subrepositories). Each subrepository is treated as a separate project by Projectile. Is there any way to configure Projectile to automatically include subrepos to the main project? Or can/must this be done manually?


texts: How can I disable an individual snippet when in shell-script-mode?

texts: I'm a fairly extensive user of YAsnippet but there is an annoying niggle when I'm working on shell scripts. The default prog-mode snippets includes "fi" which expands to FIXME. This would be fie but it fires every time I close a if<->fi statement in BASH. How can I disable this one snippet when I'm in shell-script-mode?


texts:
I use org-mode since 2012. I recently adopted the org-mode clocking
work time capabilities and thus have created the following org-capture-template:

(setq org-capture-templates '("j" "Journal" entry (file (concat
  org-directory "/journal.org")) "* %?\n%u\n" :clock-in t :clock-resume t))

(define-key global-map "\C-cr" 'org-capture)

When I start working on something (eg. Project A), I press C-c r j and the timer starts. When I finish, I press C-c C-c. In this simple scenario, everything works fine.

However, there are occasions where I get interrupted during Project A,
without time for any key press. For example, the phone rings and I discuss an urgent issue for 10 minutes. Before I return to what I was doing before the phone call, I want to keep log of the phone call.

|  time | event                        |
|-------+------------------------------|
| 10:00 | Clock-in                     |
| 10:15 | Interrupt                    |
| 10:25 | RETI (return from interrupt) |
|-------+------------------------------|

It is now 10:25 and the corresponding entry in journal.org is:

* Project A
  :LOGBOOK:
  CLOCK: [2016-09-27 Tue 10:00]
  :END:
  [2016-09-27 Tue]

Which is the best/recommended/straightforward way to achieve the following result?

* Phone call
  :LOGBOOK:
  CLOCK: [2016-09-27 Tue 10:15]--[2016-09-27 Tue 10:25] =>  0:10
  :END:
 [2016-09-27 Tue]

* Project A
  :LOGBOOK:
  CLOCK: [2016-09-27 Tue 10:25]
  CLOCK: [2016-09-27 Tue 10:00]--[2016-09-27 Tue 10:15] =>  0:15
  :END:
 [2016-09-27 Tue]

What is shown here is:
a) The phone call has been clocked from 10:15 - 10:25
b) The Project A has been clocked from 10:00 - 10:15
c) The Project A clock has resumed from 10:25


texts: lines are mixed up when running emacs remotely

texts:
When I ssh onto a remote server, and then open emacs on that server, and attempt to edit, I often experience many issues with the display.

For example, when I move my cursor around the file using C-l or C-v, lines often get mixed up and display improperly. If I have multiple files open, moving around in one file causes lines to move around. This is a completely graphical issue and if i background and resume emacs, everything goes back to normal.

I've attached two screenshots, showing emacs before I hit C-l a couple of times, and showing the window after I hit C-l a couple of times. As you can see, the code afterwards is displayed improperly, and the bounday between the two files is also screwed up.

What is the cause of this, and how can it be fixed?


texts: How to save an eww buffer as an html file with all formatting preserved?

texts:
I would like to save an eww buffer as an html buffer with text formatting, hyperlinks, etc preserved. If I do C-x C-w, it saves only the raw text visible in the buffer.

Here is my use case: I use the below helper function to clean up a web page to show only the information relevant to me.

(defun modi/eww-keep-lines (regexp)
  "Show only the lines matching regexp in the web page.
Call `eww-reload' to undo the filtering."
  (interactive (list (read-from-minibuffer
                      "Keep only lines matching regexp: ")))
  (let ((inhibit-read-only t)) ; ignore read-only status of eww buffers
    (save-excursion
      (goto-char (point-min))
      (keep-lines regexp))))

Hyperlinks and text properties are preserved in the eww buffer after calling the above function.

I would like to save the filtered eww buffer I get after calling the above function as an html file.


texts:
Please maintain a community wiki answer which describes email lists, wikis, blogs, irc channels, forums, or other communities in which GNU Emacs is the primary topic.

In order to be listed, a community must be 'open', meaning that anyone can participate.

Exceptions to that rule can, should, and have been made.  Employ judgement.  For example: of course Sacha's blog and Xah's site belong on this list.


texts: How do I disable Swiper while defining a keyboard macro?

texts: I don't like the swiper behavior when interactively defining a macro, it is slow and seems to cause other problems. How can I revert bound keys to isearch-forward and isearch-backward when defining macros, but use swiper for all other use cases?


texts: Cloze items inside code block in org-drill

texts:
The title pretty much speaks for itself. Using the usual cloze syntax, e.g.
#+BEGIN_SRC haskell
absurd :: Void -> [a]
#+END_SRC

Does not work, as [a] is visible during the drill session.


texts: Is there a common way to open "svn-status" or "magit" depending on current buffers system?

texts:
before I sit down and reinvent the wheel for me:

I'm working with svn and git in different projects. Is there already an existing way to start svn-status or magit, depending on the vcs that is used for the file in the current buffer? Maybe some of the vc-* commands?

Thanks,
Markus


texts:
I'm getting this error whenever I try to open Emacs:
Debugger entered--Lisp error: (file-missing "Cannot open load file" "No such file or directory" "counsel")
  require(counsel)
  ivy-rich-set-display-transformer(backup)
  ivy-rich-mode(1)
  (condition-case err (ivy-rich-mode 1) ((debug error) (funcall use-package--warning13 :init err)))
  (progn (condition-case err (ivy-rich-mode 1) ((debug error) (funcall use-package--warning13 :init err))) (if (not (require 'ivy-rich nil t)) (display-warning 'use-package (format "Cannot load %s" 'ivy-rich) :error)))
  (lambda nil (progn (condition-case err (ivy-rich-mode 1) ((debug error) (funcall use-package--warning13 :init err))) (if (not (require 'ivy-rich nil t)) (display-warning 'use-package (format "Cannot load %s" 'ivy-rich) :error))))()
  eval-after-load(ivy (lambda nil (progn (condition-case err (ivy-rich-mode 1) ((debug error) (funcall use-package--warning13 :init err))) (if (not (require 'ivy-rich nil t)) (display-warning 'use-package (format "Cannot load %s" 'ivy-rich) :error)))))
  (condition-case err (eval-after-load 'ivy #'(lambda nil (progn (condition-case err (ivy-rich-mode 1) ((debug error) (funcall use-package--warning13 :init err))) (if (not (require ... nil t)) (display-warning 'use-package (format "Cannot load %s" ...) :error))))) ((debug error) (funcall use-package--warning13 :catch err)))
  eval-buffer(#<buffer  *load*> nil "/home/apoorv/.emacs.d/init.el" nil t)  ; Reading at buffer position 10649
  load-with-code-conversion("/home/apoorv/.emacs.d/init.el" "/home/apoorv/.emacs.d/init.el" t t)
  load("/home/apoorv/.emacs.d/init" noerror nomessage)
  startup--load-user-init-file(#f(compiled-function () #<bytecode 0x1579fa7368c5>) #f(compiled-function () #<bytecode 0x1579fa731b9d>) t)
  command-line()
  normal-top-level()

I have my configuration as a org document, this the block that installs counsel,
  (use-package counsel
    :init
    :bind (("M-x" . counsel-M-x)
           ("C-x b" . counsel-ibuffer)
           ("C-x C-f" . counsel-find-file)
           ("C-M-j" . 'counsel-switch-buffer)
           :map minibuffer-local-map
           ("C-r" . 'counsel-minibuffer-history))
    :custom
    (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)
    :config
    (counsel-mode 1)
    (setq ivy-initial-inputs-alist nil))  ;; Don't start searches with ^

I also tried installing counsel manually by M-x package-install but it didn't help either.


texts: How to open a file using eval that works with '--alternative-editor'

texts:
The following command works to open a file in an existing emacs instance:

emacsclient --eval \
"(progn (find-file \\"/a/b.txt\\") (goto-line 1) (forward-char 2) (recenter))" \
--no-wait \
--alternate-editor=emacs

However when there is no emacs instance running it creates a buffer called b.txt").

Is there a way this can be made to work in both cases?


texts: Why in diredp-dired-recent-files show folder in title?

texts:
Emacs 26.1
Dired+

I'm in folder d:/temp/test and use command "diredp-dired-recent-files"

here steps:

And here result:

As you can see the frame's title is correct:

Recently visited files

Nice.

But why it show folder D/temp/test ?

I think it must be hide.


texts: Insert the value of a variable into the buffer I'm editing

texts:
I asked How can I script emacs to install packages from list? and got this answer.

(setq package-selected-packages
      '(async
        epl
        evil
        goto-chg
        helm
        helm-ag
        helm-core
        helm-descbinds
        helm-projectile
        pkg-info
        popup
        projectile
        undo-tree))
(package-install-selected-packages)

When I inspect the value of the variable package-activated-list in my installation the output is (evil goto-chg undo-tree goto-chg helm-ag helm helm-core async popup async helm-descbinds helm helm-core async popup async helm-projectile
 projectile pkg-info epl helm helm-core async popup async popup projectile pkg-info epl undo-tree)

How could I insert the literal output of package-activated-list into the buffer, after the quote. ie generate the script

(setq package-selected-packages
      '
      ;;<<list of  `package-activated-list` goes here >>
      )
(package-install-selected-packages)

It would be better with duplicates removed and sorted, but those are secondary issues.


texts: Accented letters in source blocks in org-mode

texts:
I am having issues getting org-babel to export accented letters properly. This happens only in source blocks. For

#+BEGIN_SRC java
// Testing characters á, é, í, ó, ú, ç, ã
public void test(){}
#+END_SRC

The resulting export will exclude these characters. If I use them outside of source blocks everything works as expected.

Any help here is appreciated!

EDIT
This only happens in the PDF export. The generated text file contains \usepackage[utf8]{inputenc} which should work.


texts: org-babel captions on results don't export to LaTeX?

texts:
I hope the following complete minimal example is self-explanatory. It contains my question. It should run without error messages in org-babel. I looked at the six related suggested questions on the site and did not see a satisfactory answer.

#+CAPTION: The caption for this org-babel code block exports to /LaTeX/
#+name: elisp-prelude
#+BEGIN_SRC emacs-lisp :results output :exports both
  (princ (concat (format "Emacs version: %s\n" (emacs-version))
                 (format "org version: %s\n" (org-version))))
#+END_SRC

#+CAPTION: But this caption for the results won't export to /LaTeX/
#+LABEL: res:elisp-prelude
#+RESULTS: elisp-prelude
: Emacs version: GNU Emacs 25.1.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F1911))
:  of 2016-09-17
: org version: 9.0.6

The results are computed correctly each time I export to /LaTeX/, but the
caption for the results does not export.
What can I do to make the caption for the results display in the exported /LaTeX/?

EDIT: I tried adding a #+NAME header to the #+RESULTS block, both before and after the #+LABEL, but the results are the same: no export.


texts: Recommended way to overwrite built-in function (org-bbdb-format-vevent)

texts:
I'm using the icalendar export built into org-mode to export my agenda to an ical file. I also use org-bbdb to insert birthdays (anniversaries) into the agenda. Using the variable org-icalendar-include-bbdb-anniversaries,  these anniversaries are exported to the ical file, which is great.

The problem is that the format of these birthday entries is not customizable. I traced back the formatting of the org-bbdb entries to the ical entries to the function org-bbdb-format-vevent, defined in org-bbdb.el. Can I overwrite or modify this function without patching org-bbdb.el? If so, what's the recommended way to do that?


texts: Require a file in the current directory without setting load-path

texts:
I have test code that wants to require some utility code in the same directory.  I would prefer to not update the load-path, as most of the time, I do not want me or any other user who has checked out this code to be looking in this directory.

It seemed that (require 'utils "./utils.el") should work, but this gives me an error:

file-remote-p: Cannot open load file: No such file or directory, ./utils.el

Is there a better way than something like

(let ((load-path (append (list (file-name-directory (buffer-file-name))))
                         load-path)))
    (require 'utils))

I also cannot specify an absolute path, as the path may be different when other users check out the repository.


texts:
How can I move focus from currently focused frame to a neighboring frame-- e.g. right next frame-- via a keyboard shortcut? I'd like to cycle through frames in "z" direction. If I had frames a to h like below on my desktop

  a   b  c
d  e  f

g       h

I'd like to move in the order of a, b, c, d, e, f, g, h, then go back to a and repeat.


texts: Emacs org mode: How to use "or" in org-agenda-custom-command

texts:
I have tried to code my org-agenda-custom-commands to show only todo's which are either priority A or priority B. However, I am only able to do this indirectly, by filtering out todo's that are NOT priority C. Why doesn't the or-function | in my code below work the way I want? (alternative 2 and 3).

(setq org-agenda-custom-commands '(
  ("d" "Daily "(
    (tags-todo "+TODO=\"TODO\" -PRIORITY=\"C\" "  ( ; works
    (org-agenda-sorting-strategy '(priority-down))
    ))
  (tags-todo "+TODO=\"TODO\" +PRIORITY={\"B\"|\"A\"} "  ( ; works NOT
    (org-agenda-sorting-strategy '(priority-down))
    ))
  (tags-todo "+TODO=\"TODo\"  {+PRIORITY=\"B\"}|{+PRIORITY=\"A\"} "  ( ; works NOT
    (org-agenda-sorting-strategy '(priority-down))
    ))
  ))
))

Alternative 2 and 3 using the or-function | results in showing A, B and C, not only priority A and B, as was my intention.

What is wrong with my usage of the "|" function? How can I use | to show both priority A and B?


texts: Defining a macro that exists only in one .el file

texts:
Is there a way to define a macro in an emacs-lisp file in such a way that the macro would not be visible anywhere else once the file is read and evaluated?

Kind of like a temporary macro that goes out of scope at the end of a file?


texts: How would one fake kerning adjustments in propertized text?

texts:
I've successfully managed adjusting the displayed size of spaces and raising/lowering propertized text by making use of the display property, however I cannot find anything that would allow me to fake kerning adjustments.  In other words, I have two letters and would like to make the second one intrude into the first one's bounding box, in typography this would be done with negative kerning.  Is there a way to achieve this effect with the Emacs display engine?

edit: I'll give a demonstration of what I want to achieve:

(defun my-insert-tex ()
  (insert
   (propertize (concat "T" (propertize "e" 'display '(raise -0.24)) "X")
               'font-lock-face '(:family "Serif"))))

The preceding function inserts the string "TeX" with the "e" lowered by 0.5ex which are roughly 24% of the font height.  This approximates the typesetting of the TeX logo, however to make it perfect I'd need something like a negative margin around the "e" to move it closer to the "T".


texts: Do buffers have the notion of a "parent"?

texts:
Often times, when I'm done a task, I'd like to close out of all buffers I was using for it. However, I usually don't, because I think it'd be a pain.

What I'd like is to be able to kill all buffers spawned from a particular one -- usually, when I begin a task, there is a buffer I open first, and I'd like to be able to kill all buffers spawned from that one -- all buffers opened with C-x C-f or whatever while I was initially in that buffer, or recursively. Does this exist?


texts:
When I use, gotham-theme, it says that you can get the 256 colors by (setq gotham-tty-extended-palette t) but I do not feel any difference between activating one and the other with only 16 colors; I think that I have activated the 256 color because with list-colors-display and list-faces-display I have many colors,

It seems that with lush theme is more colorful

So my question is: it is well activated gotham theme with 256 colors, and how can I make my code more colorful?


texts:
I have a deadline that is 12/12/2019+15d+1m. How would I get it in Emacs? This should be straightforward but have not found it. The right answer is 01/27.

UPDATE:

The question is not about combining two dates shifts. I'm fine with an answer to:

  Could you please show me the exact steps to get get 12/12/2019+15d,
  and then 12/27/2019+1m?


texts: Helm Grep within a first results set / multi line search

texts:
I would like to use helm to search for two terms which may well be on different lines.

Is there a way to grep for the first term then further grep within the resulting fileset the second term?

eg

Func(
   "hello"
);

I would like to grep/search for all files containing "Func" and then "hello".

I know I can save the results set to a hgrep buffer but I cant fathom how to then use that buffer's match fileset to narrow the search for the second term.


texts: Emacs "context" plugin for switching between different tasks in one project without loosing concentration

texts:
PyCharm (and other JetBrains products) has wonderful feature — "contexts".

You can configure task server (e.g Github Issue Tracker, Redmine, Trello, etc or use built-in one). When you switch task this feature saved open tabs with files, branches, tasks and everything related to current task and than you can easily turn back to this "context".

Is there anything similar for Emacs (I'm about context plugin)?


texts: What's the difference between C-u C-u C-u  and C-u 64 ?

texts: In org-mode, C-u C-u C-u Tab expands all trees. When I wanted to check what it's bound to, I wasn't able to do that using C-h k as it quickly told me what C-u is bound to. From experiments, I know that pressing C-u n times sets the prefix argument to 4^n. So why doesn't C-u 6 4 Tab do the same thing as C-u C-u C-u Tab?


texts: How to ignore case when switching buffers?

texts:
I want to open a buffer called Echo.md and switch-buffer (C-x b) does not auto-complete it when I type echo because of the case. But find-file  does auto-complete from lower-case to upper-case. The documentation for either function does not mention case.

How can Emacs ignore case when switching buffers?


texts: Calculate emacs org property from another property

texts:
I have an Emacs Org file with list of tasks with a set of properties each one.  Say I have three properties called ESTIMATED, SPENT and REMAINING, which account for the number of hours that I estimated the task will take to be done (ESTIMATED), the number of hours I already worked on it (SPENT) and the hours left from the original estimate (REMAINING).  Obviously (and assuming we do not re-estimate the time it will take), for each task REMAINING = ESTIMATED - SPENT

I use a lot Column view to update status, work spent and so on.  Is it possible to set up the property REMAINING so that when I change in Column View the value of the property SPENT, the property REMAINING gets automatically recalculated?


texts: I am thinking to write a physics book in org-mode. Although there are many open-source science books written in LaTeX to figure out its work-flow (and its source) I couldn't find any science book written in org-mode. It is better alternative writing than in LaTeX for science books?


texts:
When I have something todo regarding to a URL, I often just capture the URL, e.g. like this:

** TODO [[http://example.org/foo/bar]]

But this leads to the problem, that I get empty headings when I org-publish my org files.

Am I doing something wrong? I understand that a link in a heading is a problem since the headings itself are links, on the other hand just leaving them out is not a very good solution. Is there a workaround? The URL as unlinked text would be a viable solution for me.


texts: Setting up the **second** leader key for Xah-Fly-Keys

texts:
Inspired by this post, I tried to set up a second leader key for my Xah-Fly-Keys for major mode commands (as suggested in the post). But I couldn't find how I can set up the second leader key for Xah-Fly-Keys. I also ask this question in Xah-Fly-Keys Reddit forum but didn't get any answer. Does anyone know how?

In case you wonder why I'm trying to that: The purpose is using a single key binding for similar actions in different major-modes. For example, running a unit of code (e.g. a source block in org-mode, a cell in matlab-mode and etc) with e.g.  + RET (note that  is the "second leader key" suggested by the post I mentioned). I propose a solution in Reddit forum, but with using the control key (rather a new leader key).


texts: How to display agenda start day / end day in the header-line?

texts:
I'm trying to display the org-starting-day in the header line using the code below. It's working when I first display the agenda but it is not updated when I navigate forward / backward in the agenda. I guess I need some eval but I'm not sure how to do it.
(add-hook 'org-agenda-mode-hook
  #'(lambda ()
      (setq header-line-format
            (format-time-string "%e %B %Y" org-starting-day))))

Here is the result with a slightly modified code:


texts: How to make CEDET auto-completion more detailed?

texts:
I currently have a very basic setup for CEDET:

(add-to-list 'load-path "~/.emacs.d/popup")
(require 'popup)

(add-to-list 'load-path "~/.emacs.d/auto-complete")
(require 'auto-complete)
(require 'auto-complete-config)
(ac-config-default)
(define-key ac-mode-map (kbd "C-SPC") 'auto-complete)

(semantic-mode 1)
(defun my:add-semantic-to-autocomplete()
  (add-to-list 'ac-sources 'ac-source-semantic)
)
(add-hook 'c-mode-common-hook 'my:add-semantic-to-autocomplete)
(global-ede-mode 1)

It's working but the output for C++ is far less than desired. For example, take the following class:

class Rectangle {
   int width;
   int height;
public:
   void set_values (int,int);
   int area (void);
};

The output from the auto-completion popup is:

set_values m
width      m
area       m
height     m

If I wait a second over each entry it will provide the method signature or property type. But I want to know this information immediately.

The following will display something more useful but it doesn't appear in a popup: semantic-ia-show-variants. The format is also difficult to read for large classes when glancing at auto-completion.

What I would like is an Eclipse-esque popup with nicely formatted variants. I found a screenshot of CEDET providing this kind of behavior here:
http://alexott.net/en/writings/emacs-devenv/EmacsCedet.html

Example:

But I can't figure out how to make it do this.

How can I configure CEDET to give me some real meaty completions?

UPDATE:

From what I understand from the following links:
http://sourceforge.net/p/cedet/mailman/message/30023381
https://stackoverflow.com/questions/12957786/autocompletion-from-the-keyboard-in-emacs-cedet-semantic?answertab=active#tab-top

It seems as though there is a discrepancy between the available information and the current release. Another possibility that I'm considering is that there is a discrepancy between the latest development HEAD and the version bundled with Emacs.

I believe that older versions had an auto-completion popup built-in as something called "senator" which is where the "-menu" functions came from; this would also explain why the popup screenshots I've found are both old and have a distinctly different visual style. The old menu functionality from what I can tell has been removed and that the recommended method is to combine CEDET with auto-complete, which is what I'm doing.

The information is provided by semantic-ia-complete-symbol (thanks djangoliv) but semantic-ia-complete-symbol-menu, part of senator, is no more. So the question now is how to get this information linked in with auto-complete.


texts:
I recently switched to mu4e for my mails which is awesome. I changed the date format in the headers view so that it became longer. Unfortunately I cannot see the complete date now because the column width is to small.
How can I change this? How can I change the width of all columns?
Documentation doesn't mention the column width.


texts:
As the title says, I have an orgmode file I have been using with ess and exporting to TeX which has been going very well. However, I need to now export to html for reasons out of my control, and was wondering if there is a clean way to obtain an Rmd file from the org file.
Note that this is not the same as obtaining a markdown file.
To clarify the workflow as requested from the comments. The situation is as follows:

I have a set of orgmode files which were used to analyze data (via ess)
Typically I would export these to hugo-markdown for html output downstream (with ox-hugo, e.g. this file) and polymode-org-mode for TeX which works great

However, now I do need to edit the files in an .Rmd setting (hiding code chunks and adding some more analysis). Currently one approach is to export to markdown and then copy out what I need, but that seems inefficient. Similarly, the idea of manually messing with my html files is also not appealing.
The current issue is that orgmode export isn't clean enough to work as an Rmd file (though the pandoc-orgmode one is close).
The workflow I'm looking for is then:

Load an R-session and work in an orgmode file
Tangle (??) to an .Rmd so other people can muck around

I'm not really interested in the inverse route, since I don't really mind working in Rmd either (and I can connect to the same R-session), I'd just rather not hand-convert my existing files.
Note that in the current setup, the orgmode file has a lot of extra LATEX_HEADER options, since I was mostly just exporting to TeX. These options also mess with the output when working with the standard exporters.


texts: C-c C-x f (org-footnote-action) cannot create a new footnote

texts:
I am used to create new footnotes in Emacs Org Mode with the key binding C-c C-x f.

But now there are shown several options in the echo area, when I use this key binding, although the cursor is not on a footnote reference or definition. and I did not use a prefix argument.
And I didn't change any variables or configurations (intentional).


texts: What is causing `delete-trailing-whitespace`?

texts:
In some buffers (e.g. diff buffers) the trailing whitespace is essential to the format and must be preserved. What is causing Emacs to invoke delete-trailing-whitespace whenever I save the buffer?

The before-save-hook contains only (time-stamp), which doesn't alter trailing white space.
The variables write-contents-functions, write-file-functions, local-write-file-hooks all have the value nil.
The active minor modes are, according to describe-mode:

Async-Bytecomp-Package Auto-Composition
Auto-Compression Auto-Encryption Auto-Revert Column-Number
Diff-Auto-Refine File-Name-Shadow Font-Lock Global-Eldoc
Global-Font-Lock Global-Git-Commit Line-Number Magit-Auto-Revert
Midnight Mouse-Wheel Projectile Projectile-Global Shell-Dirtrack
Tool-Bar Tooltip Transient-Mark

None of those have any obvious behaviour to remove trailing whitespace on save.
This unwanted behaviour still happens even when I manually set fundamental mode in the buffer.

The backtrace when the delete-trailing-whitespace function gets called looks like:

* delete-trailing-whitespace()
* run-hook-with-args-until-success(delete-trailing-whitespace)
* basic-save-buffer(t)

I haven't asked for delete-trailing-whitespace, it's not in any relevant hooks that I can find, yet run-hook-with-args-until-success is being told to run it. Why?


texts: org-mode clock-in in column view doesn't work on first clock-in?

texts:
I like working in column view, as it shows me properties in columns.

I set clock-logging to go into the log drawer.

However, I've discovered that I can't clock in tasks unless a log-drawer already exists. It just says 'e' buffer is read only.

However, if I go out of column view, clock in once, the log-drawer is created and then go back into column view, then clocking in works.

Is this fix-able? If not, is there a way to always create a log-drawer whenever I mark a task as a 'TODO' task?


texts: In Emacs, how do you force using a fallback font?

texts:
Font and encoding (in a broad sense, internationalization) are causing problems in many software scenarios, like web browser and editor.

The Unicode U+201C and U+201D are double quotation marks. These two marks are covered by most (if not all) fonts. There are no different code points of double quotation mark for different languages.

What I want to achieve in Emacs is the following. Set the default font to English monospace font (Font A) and use other fonts for characters in certain Unicode range. For example, use Font B for Han characters and Font C for Cyrillic characters.

In my ~/.emacs, I have the following Elisp code.

(set-face-attribute 'default nil :family "Lucida Sans Typewriter" :height 120)

(set-fontset-font "fontset-default" '(#x2000 . #x206f)   ; doesn't work
          "Microsoft YaHei" nil 'prepend)

(set-fontset-font "fontset-default" 'han                 ; works
          "Microsoft YaHei" nil 'prepend)

(set-fontset-font "fontset-default" 'cjk-misc            ; works
          "Microsoft YaHei" nil 'prepend)

(set-fontset-font "fontset-default" 'cyrillic            ; works
          "Consolas" nil 'prepend)

All calls to set-fontset-font work fine except the first that tries to use Microsoft YaHei for General Punctuation section in Unicode. I have also tried changing the order of these set-fontset-font calls, but to no avail.

The reason why it doesn't work, I suspect, is that Emacs only use fallback fonts only if the default font doesn't have the glyphs for the corresponding code points. Since the double quotation marks exist in many languages and thus many fonts have the glyphs for them. Consolas, Lucida Console, Courier, etc. all have the glyphs for them.

Is there any way in Emacs to force to use the specified fonts even if the default font has the glyphs for them?

When coding HTML for Firefox, I have encountered similar situation. I can easily walk around by using the lang="zh" attribute in the body or html tag to tell the browser the document is in Chinese. Is there an Emacs counterpart?

My environment is Emacs 25.1.1 on Windows 7 (en-US).


texts: How to open .org files with visual-line-mode automatically turned on?

texts:
How to open .org and .txt files with visual-line-mode automatically turned on?

Also, is there a way to configure cursor-movement so that cursor moves as if the visual line where a logical line?  line-move-visual is not effecting Spacemacs evil mode keybindings: k (line up), j (line down).

I am running Emacs 25.2.1, with Spacemacs, evil mode, org-mode on Linux.

UPDATE 1

From .spacemacs file, after adding visual-line-mode

(defun dotspacemacs/user-config ()
  "Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration.
This is the place where most of your configurations should be done. Unless it is
explicitly specified that a variable should be set before a package is loaded,
you should place your code here."
  )
(add-hook 'org-mode-hook #'visual-line-mode)
(add-hook 'text-mode-hook #'visual-line-mode)

(setq org-use-speed-commands t)

;; Do not write anything past this comment. This is where Emacs will
;; auto-generate custom variable definitions.
(custom-set-variables

With emacs open to a txt file:

SPC h d k k

k runs the command evil-previous-line (found in evil-motion-state-map), which is
an interactive compiled Lisp function in ‘evil-commands.el’.

It is bound to <up>, k.

SPC h d v line-move-visual

line-move-visual is a variable defined in ‘simple.el’.
Its value is t

UPDATE 2

Tobias's advices code worked great; j and k move cursor as if the visual line where a logical line.

Then I installed org-drill.
And org-drill worked fine until I restarted Emacs, then Emacs said:

Spacemacs encountered an error while loading your '~/.spacemaces' file.
Pick your editing style for recovery:
  vim
  emacs
  hybrid

When I completed the recovery, org-drill was missing from M-x, so I reinstall org-drill.
Then restarting Emacs encountered the same error.
So I removed Tobias's advices code from my .spacemacs file, and now Emacs and org-drill work fine.

UPDATE 3

I placed the new eval-after-load advices code in ~/.spacemacs.
And Emacs started without errors.
But long lines of text in .org file did not wrap at all.

So then I restored the previous advices code in ~/.spacemacs.
And started Emacs from the terminal: emacs --debug-init.
There where error messages.
How to copy them to clipboard?  Screen shot of error messages:


texts: Spacemacs layer where package order matters

texts:
I'm trying to make a 'speedbar' layer that uses projectile-speedbar. The problem is projectile-speedbar won't compile unless sr-speedbar has already been compiled. Since spacemakes compiles the packages in alphabetical order, it tries to compile projectile-speedbar first and I get an error.

I have a packages.el for my layer in .emacs.d/private/speedbar:

(defvar speedbar-packages '(sr-speedbar projectile-speedbar))

(defun speedbar/init-sr-speedbar ()
  (use-package sr-speedbar))

(defun speedbar/init-projectile-speedbar ()
  (use-package projectile-speedbar
    :config (spacemacs/set-leader-keys
              "ft" 'projectile-speedbar-toggle)))

Is it possible to set this layer up so the sr-speedbar dependency is compiled first?


texts: Not able to filter Global list of TODO items

texts:
I have been using:
(defun org-todo-list-current-file (&optional arg)
 ;;  "Like `org-todo-list', but using only the current buffer's file."
  (interactive "P")
  (let ((org-agenda-files (list (buffer-file-name (current-buffer)))))
    (if (null (car org-agenda-files))
        (error "%s is not visiting a file" (buffer-name (current-buffer)))
      (org-todo-list arg))))

(global-set-key (kbd "<f7>") 'org-todo-list-current-file)

to create a Global list of TODO items, as a shortcut key to C-c a < t .
I then used to be able to do

Press ‘N r’ (e.g. ‘0 r’)

To filter by a particular TODO type.
However, for some reason, this stopped working recently. Maybe due to an upgrade of emacs. Also pressing r to refresh a list has stopped working.
However, if I use C-c a < t to create the same Global list of TODO items, then N - r and r do work.
I have been trying to figure out a solution to this and have not come up with anything.
Any help much appreciated.


texts: Org-babel: Set root dir for tangled files

texts:
I have started using org-babel for a larger project, and have found the readthedocs to be a great resource.  I have been using tangling to generate code from documentation, however setting the export filename using :tangle is gettting cumbersome, since for each block I need to set all of the relative paths and whatnot.

I know that setting the :dir header argument allows you to choose what directory code blocks will be executed in, but it does not set the tangle directory.  Ideally I would like to have something like this:

#+STARTUP: showall
#+PROPERTY: header-args :dir "/home/user/project/path1/path2/path3"

* Test

** myfile.h
:PROPERTIES:
:header-args: :tangle filename1.cpp :no-expand t
:END:
#+BEGIN_SRC C++

#+END_SRC
** myotherfile.cpp
:PROPERTIES:
:header-args: :tangle filename2.cpp :no-expand t
:END:
#+BEGIN_SRC C++

#+END_SRC

Rather than:

#+STARTUP: showall

* Test

** myfile.h
:PROPERTIES:
:header-args: :tangle ../../path2/path3 :no-expand t
:END:
#+BEGIN_SRC C++

#+END_SRC
** myotherfile.cpp
:PROPERTIES:
:header-args: :tangle ../../filename2.cpp :no-expand t
:END:
#+BEGIN_SRC C++

#+END_SRC

Imagine how frustrating this could get if another person takes over the project, or one needs to change the directory layout?  I have poked around various sources but haven't found a way to do this. This question is related, but doesn't solve my issue


texts: How to ignore emtpy lines on the bottom of the buffer?

texts:
When I jump to bottom part of the buffer using vi I does not show any empty lines.

On emacs when I got to bottom of the buffer I see empty lines even there is no new lines exist.

Is is possible to accomplish same behavior of vim on emacs?


texts:
I have a scimax based configuration and my source block fontification is broken. I suspect it has to do with the release of Org-mode 9.3 which I am currently using. Thats why I am trying to roll-back the org version.

How can I install org-plus-contrib (or even just org 9.2) ?

Thanks in advance


texts: Function to wrap html snippet in a div/span element in web-mode

texts:
I have a html snippet like this:

jasmine

cinthia

How to wrap the ul element (after selection) inside a div element in web-mode like this,

jasmine

cinthia

I use web-mode for html files.


texts:
Is there a command that will jump cursor to other iteration of the variable or function name under the cursor?

I suppose it wouldn't matter if the text is specifically a variable or function, but just another iteration of the same text.

For example, if I have foobar under my cursor can I jump to the next foobar in the file?


texts: How to get back to minibuffer during an interactive search?

texts:
This might be a trivial issue, but here goes:

I like to search (C-s or M-C-s for regexp search) often, and I want to be able to search in the buffer I'm in - jumping up and down (C-r, C-s) between the results found, but I also want an easy way to get back to the minibuffer to edit the search and start over again.

What's the easiest way to do this without having to use the mouse to click the minibuffer and edit the search query term?  Ideally, I'd have some key-combination that takes me back to the minibuffer to edit the search, and then the standard C-s to start the search results again.

Right now, I'm doing:

Trigger search: C-s or M-C-s.
Type query, C-s and jump through results.  Notice that I should search for something similar but different (ie- I need to edit my current search term).
C-f to get out of searching (just so I can go back to searching again).
C-s to search again, M-p to pull the last result, edit and C-s again.

I'd love a way to short-circuit steps 3 & 4.  All in an effort to not use the mouse.


texts:
I have Latex code embedded in my org file.

*** Equations
\begin{equation}
h(x) = \theta_0 + \theta_1 x
\end{equation}

When I run C-c C-x C-l while my cursor is on the code, I get an empty box rendered on my file. Why is the code not rendering correctly?

EDIT 1: I have dvipng installed, and I have set org-latex-create-formula-image-program to dvipng.

(setq org-latex-create-formula-image-program 'dvipng)

I am using org mode version 8.2.10.

EDIT 2: I installed imagemagick and set org-latex-create-formula-image-program to it. No luck. When I run C-c C-x C-l, the command bar displays two messages in quick succession.

Creating image...1
PDF file /tmp/orgtex8421NqG.pdf wasn't produced


texts: org-mode is it possible to assign 10 hours of work (todo) for today?

texts:
When planning, it is easy for me to overschedule things.
I'll do this and do this and do that..
But then end up with doing fewer things than I have planned.
Is there a way for me assign each task estimated time (eg, I need 2 hours to do task 1, 1 hour for task 2) and see If I have overscheduled work for today?


texts:
I have a large plantuml sequence diagram in blah.iuml.  I would like to include it in my org-mode file so that it gets regenerated and included each time I export the org file to html.  I don't want to maintain the file separately, and not just insert it into the org file.  I'd hoped that something like this would work

#+begin_src plantuml :file blah.png
#+include "./blah.iuml"
#+end_src

I can see that it is trying to run plantuml on a file that contains

@startuml
#-include "./blah.iuml"

That is, the include is not doing an actual include when inside a #+begin_src.

Is there a way I can tell org-mode: "run plantuml on this file and pop the result into the generated html"?


texts:
I'm using skewer-mode and can't use the skewer-repl, which is unfortunate.
I get a prompt

  js>

then I can enter anything, nothing is happening...
js-REPL:run and Shell-Compile are running as major modes in the skewer-repl.
I'm using Emacs 24.5 on Mac OSX
Any idea how I can make it working? Thanks


texts: Wanderlust -- how to grep the contents of thousands of emails

texts:
Q:  How can I grep thousands of emails within Wanderlust while avoiding the dreaded error of "Too many arguments" or finding zero matches (when there should be one or more)?

Wanderlust (and related elmo libraries) support searching the contents of emails by using grep:  http://wanderlust.github.io/wl-docs/wl.html#grep .  This works well for a small number of emails in the directory to be searched, but does not work when there are thousands of files in the directory -- i.e., zero results are returned even though there should have been one or more hits.


texts: What is the best way to reload git stashed changes you've popped while file is open in buffer?

texts:
When I'm viewing a file and then pop a stash which modifies that file in the working tree using git stash pop in either bash or eshell, what is the best way to immediately see those changes in the buffer visiting that file?

Usually I end up using C-x C-f or M-x revert-buffer but that's a bit slow. It would be nice to find a mode that automatically updates buffers when the files they visit change on disk.

I've heard of git-modes for viewing diffs or conflicts, but haven't found much for stashing/popping or cherry-picking.


texts:
I use spacemacs only for an org-mode todo file. I recently re-installed spacemacs and emacs and noticed a behavior change.

Let's say I have a file like:

* TODO Header
    - List item 1
    - List item 2

In inline mode, if I do Alt+Ret,Ret it used to be context specific. If I was on a header, then it would insert a new header at the same level; if I was on a list item line then it would insert a new list item. Now, no matter what line I am on it inserts a new header.


texts: Can't get rid of scratch buffer at startup for Emacs 26.3

texts:
I am using GNU Emacs 26.3 (build 1, x86_64-w64-mingw32) of 2019-08-29.
In my .emacs I specifically asked not to show the startup screen or buffer *scratch*:
(custom-set-variables
 '(inhibit-startup-screen t)
 '(initial-buffer-choice nil))

However, whenever I open a file with emacs (or runemacs), the window is split in half, showing both the *scratch* buffer and the file I opened. How do I get rid of showing the *scratch* buffer when I start Emacs?


texts: completion and goto-function in matlab-mode

texts:
I've been working with matlab-mode and matlab-shell for the last few days, and I'm really digging it so far.
The only two things I can't get to work properly are completion - neither in shell, nor in .m files - and jumping to function definitions, and I would really appreciate some help with these.
when I hit TAB in shell, my text turns into
>> emacsdocomplete('EEG.(cond')

and when I hit RETURN I get (the appropriate):
emacs_completions_output =
 java.lang.String[]:
   'cond'
   'condeig'

but it's not integrated into the shell properly, i.e. I can't choose which of the above I want, I have to re-type the command along with the chosen completion.
In .m files I just get nothing except for the word completion for words already in the buffer - which I've configured myself.
I've read somewhere that the completion is meant to be related to CEDET somehow but I couldn't make out much more (I'm working on Doom Emacs, and I seen to have CEDET installed, and can run matlab-cedet-setup, which does nothing as far as I can tell).
As to function definitions - I don't even know where to start.. I've read that ctags now supports matlab, but I don't know where (if) the actual .m files for the built-in functions reside in the install dir.
Ideally I'd love to be able to stand on a function name and be able to get the "help funcName" output in another buffer or something (this works from the shell).
Thanks a lot!


texts:
I use C-Tab and C-Shift-Tab to navigate buffer as I would do in a browser. Unfortunately, in magit-mode (which I call using magit-status), the key is bound to some diff expansion. The means that I can't switch buffers the ways I would like to as soon as one buffer is in magit-mode. I tried removing the binding using

(define-key magit-mode-map
    (kbd "C-<Tab>") nil)

However, this does not seem to have any effect. Any ideas on how to fix this?

Edit:

Regarding my settings: I have a .emacs.d/buffers.el which has a line defining the key binding: (global-set-key [C-tab] 'next-buffer).

I am using use-package to load magit:

(use-package magit
  :ensure t
  :config
  (define-key magit-mode-map (kbd "C-<Tab>") nil)
  (with-eval-after-load 'magit-mode
    (define-key magit-mode-map (kbd "<C-Tab>") nil))
  (setq magit-display-buffer-function
        (lambda (buffer)
          (display-buffer buffer '(display-buffer-same-window)))))

I added the suggestion by Konstantin Morenko, but C-Tab still does not work properly.


texts: How to ignore files starting with `flycheck_` on `find-name-dired`?

texts:
During my search I keep having an error as follows:
Search failed with status 1: find: ‘/home/user/folder/flycheck_Driver.py’: No such file or directory
[Q] Is there any way to ignore files as following regex: flycheck_*.py?

My setup:
(defun my-find-orgfiles ()
  (interactive)
  (setq toggle-case-fold-search 0)  ; Turn Off Smart Case Sensitivity
  (find-name-dired "~/folder" "*py"))

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

(add-hook 'python-mode-hook
          (lambda ()
            (setq flycheck-python-pylint-executable "~/venv/bin/pylint")
            (setq flycheck-pylintrc "~/.pylintrc")))

Than, t to toggle marked/unmarked files (thus marking them all, since none were marked). Then I use Q to use query-replace on the marked files. And enter .value to replace with value.
=> Better solution could be to let emacs create flycheck_ files in another folder?
=> Should I use dired-omit-files as from the following answer.


texts: Can I toggle fringe-mode when entering / exiting edebug?

texts:
Paraphrasing a question I previously asked on SuperUser because, IMO, the answer found there does not resolve the issue.

Question

For the most part I prefer to disable Emacs' fringe. (I customize fringe-mode to 0 a/k/a no-fringes)  But I like to have the left fringe active when debugging elisp code (for the little fringe arrow pointing to the active line).

How can I configure Emacs to switch to fringe-mode of (nil . 0) a/k/a left-only when entering edebug and restore the previous fringe-mode when exiting?

Update

Since Emacs 24.3 is the latest stable release as of this writing, I have a preference for solutions that work there.  Since Emacs 24.4 is available, in feature-freeze, and actively in use by several users of this site, I'm accepting that answer.


texts: How to change Org-mode babel tangle write to file way as append instead of override by default?

texts:
By default, Org-mode will override current babel src block content on file
original content (when the file already has content).

For example, I have an org-mode file content as the bellowing block:

#+BEGIN_SRC org
,* config file

,** config 1

,#+BEGIN_SRC clojure :tangle "data/code/tangle-append-test.clj"
(println "hello")
,#+END_SRC

,** config 2

,#+BEGIN_SRC clojure :tangle "data/code/tangle-append-test.clj"
(println "world")
,#+END_SRC

#+END_SRC

If you tangle the whole buffer file, then the result will looks like this:

The tangled file result content:

#+NAME: data/code/tangle-append-test.clj
#+BEGIN_SRC clojure
(println "hello")

(println "world")

#+END_SRC

This is fine. But here is my problem:

But if you tangle only current src block with [C-u C-c C-v t]. Then
the current tangled src block will overwrite the whole destination file, like
this:

 $ cat data/code/tangle-append-test.clj

(println "world")

UPDATED

My question: The single babel block override original file content, I hope to
only append current tangled block without overwriting.


texts: Problems with COMBINING OVERLINE unicode rendering in Emacs 27.1

texts:
[Emacs 27.1 from manjaro arch]
Hi,
can anyone help me with the following?  I'd like to render "x bar" (x with a horizontal bar) above it in unicode.  I can get in Emacs 27.1, using monaco (check1), but not in other fonts, like Roboto mono.  See screenshot below.  On the left is the test file, unicode1.el, (availabe from
http://www.damtp.cam.ac.uk//user/sje30/unicode1.el ) in gedit where the xbar renders okay in Roboto Mono. On the right is the output when (check2) has been run; the  information in the Help buffer shows that x has not been combined.

If you run (check1) you get the desired output:


texts: Does anyone have any good tips for starting to use emacs?

texts: I have heard good things about emacs and have dabbled in a bit of vim/neovim. I was wondering if anyone has any good tips for starting to use emacs! I am using emacs 27.1 for Windows 10.


texts:
I am currently discovering orgmode and as a math student I want to write my math lessons with this beautiful tool. I love the way LaTeX code can be displayed inline in emacs.

I would like to know if there is a way to preview LaTeX in console mode.
It sounds like an adventure but I really prefer to run emacs in console mode, and of course I'm brave !


texts: How to change default shell for Emacs on MS Windows?

texts:
I'm very new to Emacs (using Doom Emacs) as a former Vim user, and I've been loving it. However, I've been having issues trying to get irony-server to run. From what little I've been able to gather (exits with error 53), it has something to do with Emacs using MS Window's cmd prompt by default.
I am trying to figure out a way to change it to Git's bash.exe, but cannot find the proper way to do so (at least for Windows, since there is no SHELL env var).
If this is not possible, is there an alternative to Irony? I am trying to get decent code completion working for C / C++ and so far, it has been a real pain.


texts: mu4e and multiple accounts/context don't work

texts:
Hi I have three gmail adresses, I can choose the contexts but it still shows the inbox of account1. offlineimap is configured with localfolders equals ~/.Mail/accountX@gmail.com

Here is part of my config:

(setq mu4e-maildir "~/.Mail")
(setq mu4e-contexts
  `( ,(make-mu4e-context
        :name "account1"
        :enter-func (lambda () (mu4e-message "Entering account1 context"))
        :leave-func (lambda () (mu4e-message "Leaving account1 context"))
        :vars '( ( user-mail-address      . "account1@gmail.com"  )
                 ( user-full-name         . "Peter Pan" )
                 ))

     ,(make-mu4e-context
        :name "account2"
        :enter-func (lambda () (mu4e-message "Entering account2 context"))
        :leave-func (lambda () (mu4e-message "Leaving account2 context"))
        :vars '( ( user-mail-address       . "account2")
                 ( user-full-name          . "Peter Pan" )
                 ))
     ,(make-mu4e-context
        :name "account3"
        :enter-func (lambda () (mu4e-message "Entering account3 context"))
        :leave-func (lambda () (mu4e-message "Leaving account3 context"))
        :vars '( ( user-mail-address       . "account3")
                 ( user-full-name          . "Hanno Jung" )
                 ))
))

What am I doing wrong?


texts: How can I insert some multiline text that respects the indentation at which it is inserted?

texts:
I have a function that reads a link from the clipboard and generates a metadata-ful markdown link from it, and inserts it:
(defun night/unt ()
  (interactive)
  (let* ((link (current-kill 0))
         (cmd (concat "brishzr.dash " (shell-quote-argument (concat "ec " (shell-quote-argument link) " | inargsf unt"))))
         )
    (message "%s" cmd)

    (insert (shell-command-to-string cmd))
    (save-buffer)
    ))

But this doesn't respect the indentation at which the text is to be inserted.
Invoking it on here:
* https://github.com/org-roam/org-roam
     CARET_IS_HERE

will produce
* https://github.com/org-roam/org-roam
     * [org-roam/org-roam-server](https://github.com/org-roam/org-roam-server)
    * A Web Application to Visualize the Org-Roam Database - org-roam/org-roam-server
![](https://avatars0.githubusercontent.com/u/65036520?s=400&v=4)

I want it to produce
* https://github.com/org-roam/org-roam
     * [org-roam/org-roam-server](https://github.com/org-roam/org-roam-server)
         * A Web Application to Visualize the Org-Roam Database - org-roam/org-roam-server
     ![](https://avatars0.githubusercontent.com/u/65036520?s=400&v=4)


texts: Can magit stage a hunk / selected lines in 'diff-mode'?

texts:
Is it possible to stage the current hunk or selected lines of the hunk in diff-mode?
For example, when in diff-mode, what command can I run to stage the current hunk?


texts: How to change default color theme for ansi-term?

texts:
I have the package color-theme-buffer-local, which allows you to change the default color theme on a per-buffer basis.

I added this to my config:

(add-hook 'term-mode
          (lambda nil (color-theme-buffer-local 'color-theme-black-on-gray (current-buffer))))

And it doesn't have the intended effect of forcing all ansi-term buffers to have the color-theme-black-on-gray value.  How do I get ansi-term to respect the colors I am trying to set?


texts:
After calling org-babel-tangle on a certain file containing latex
blocks, I see the prompt

  No comment syntax defined. Use:

What is this about?  This doesn't happen with another similar file I have.

PS.  Minimal example (which I couldn't easily provide before seeing the answer):

#+BEGIN_SRC latek :tangle yes :comments link
test
#+END_SRC


texts:
Is there a command to view the entries in the mark ring, similar to listing buffers with C-x C-b or viewing the kill ring with the function browse-kill-ring or viewing the jump list (in info mode) with L?

It doesn't need to be bound to a key -- I don't even know of (and cannot find) any function that does this.


texts: Find the next occurence of lines with matching prefix

texts:
I've got a file that looks roughly like this:

prefix.thing,11,12
prefix.something,10,20
prefix.something,30,40
prefix.somethingElse,10,20
prefix.anotherThing,1,2
prefix.anotherThing,3,4

assuming my point is at the beginning of the file, how can I find the first pair of lines that match up to the first comma on each line.


texts: How to run a mini-buffer command from interpreter

texts:
I think this might be a duplicate but I can't figure out how to run this:

(man emacs)[cursor] [C-x][C-e]

Error I get back:

Debugger entered--Lisp error: (void-variable gpg)
  (man gpg)
  eval((man gpg) nil)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

I'm trying to put a lisp expression in a file to open the man page in Emacs. So I can save an expression like this in my notes, and then open the man page in Emacs by running eval on the line.

I thonght it might be (man 'emacs), but It didn't work.


texts: Tell Tramp not to try again if login fails

texts:
We have this policy that the account gets locked if a user tries to login with the wrong password for three times.

Now if I mistype my password when connecting via tramp, it will try to login several times, locking my account immediately.

I could not find a way to disable multiple login attempts. Is there a way to tell tramp to try only once?


texts: How to set the dimensions of additional frames in Emacs / Aquamacs (OS X)

texts: I'm using Aquamacs on OS X and have multiple monitors in my setup. I'd like for all my Aquamacs frames to open with a certain position and size. In fact, my problem is rather similar to this one on StackOverflow. This solution of using modify-frame-parameters seems to have worked for setting the initial frame to my preferred position and size, but any additional frames open on my main monitor with a certain size and position, which are not the ones I want. I've tried many and varied solutions for fixing this including setting default-frame-alist, setting smart-frame-positioning-mode to nil, setting user-position to t, and even more. Yet, I'm still stuck with any additional frames opening in my main monitor with dimensions that I didn't specify. I even have this same problem in vanilla Emacs, so I guess this isn't specific to Aquamacs. Additionally, my version of OS X is 10.11.4 Beta, in case the OS / windowing system is causing this. Can someone specify a surefire way to have all frames open in a certain position and size on Emacs / Aquamacs for OS X?


texts: How can I comment a block of CSS or HTML in web mode?

texts:
I am using web-mode.el to edit my CSS and HTML files. I am 90% sure that I haven't touched it but, just in case I modified it in the past, you can find the actual web-mode.el file I'm using here.

I have mapped the shortcut C-cc to comment-region in my ~/.emacs:

(global-set-key "\C-cc" 'comment-region)

This works fine in all other modes but if I try to use it in web-mode I get No comment syntax is defined.  Use:. So, presumably, I need to tell web-mode to use <!-- and --> for HTML and /* and */ for CSS. I checked some other mode files and I'm guessing I need something like this for CSS:

(let ((deactivate-mark nil) (comment-start "/*") (comment-end "*/"))

How should I go about editing my web-mode.el to get my comments to work? Is the above line correct and, if so, where should I add it? Presumably, I would need to add the above (or something like it) to a CSS section of the file and the equivalent to an HTML one.

In the meantime, I would also appreciate a pointer explaining how I can give /* and */ or <!-- and --> as answers to the No comment syntax is defined. Use: prompt.

I am aware of the M-; shortcut from Web mode but I would rather have the same shortcut since I am very used to it from the various other modes I use where it works. In any case, I want the comment-region function to work as it does in other modes.


texts: Adaptive sorting of a company backends results

texts: Is there a way of asking company to sort the results it shows based on past choices? The custom variable company-transformers controls this behaviour. The only built-in choices are company-sort-by-occurrence and company-sort-by-backend-importance. Is there an existing method, possibly from another package, that I could use to do adaptive filtering of these results?


texts:
I regularly use Org mode's #+INCLUDE command to include local files in my Org file. Now I'm wondering if there is a way to include remote files (i.e. files that I reference via a URL) into my main Org file so that the source code gets embedded when I export.

My current specific use case would be to add a raw code snippet from a local Gitlab instance to an Org file. I have tried the following:

#+INCLUDE: "https://url-to-gitlab/snippets/11/raw" src sh

but that gives me the following error message when exporting from Org to PDF:

  org-export-expand-include-keyword: Cannot include file /home/ph0t0nix/Org_files/https:/url_to_gitlab/snippets/11/raw


texts:
I have

(setq TeX-auto-local "subdir")
(setq TeX-macro-private '("dir/"))

I want to set TeX-auto-private to dir/subdir by joining TeX-auto-local and TeX-macro-private together. I thought it was easy but I can't find a way.


texts: Automaticaly insert '~' Symbol before and after a "Marked Expression"

texts:
I am documenting Code a lot. For exporting purposes I often have to add a '~' infront and after an Expression. For Example "Adc_Cfg.c" needs to get "~Adc_Cfg.c~". That way the Export to PDF via latex is not making some indexes out of it. Now I have to do it manually. Often its about 100 to 200 Expressions Thats consuming a lot of Time. What I want ist something like this

'!' is the point:

Set Mark => '!'Adc_Cfg.c  => Move forward => Adc_Cfg.c'!' => Press some shortcut and get => ~Adc_Cfg.c~

Is there already a functionality for that, if not can someone help me with an elisp function?

In Addition: Is there anything like that for bold, italic...

Thank you


texts:
Using Aquamacs 3.2 on Mac OSX Yosemite. I run with delete-selection-mode set, and it mostly works as advertised. However, if I'm in TeX mode (AucTeX), make a selection, and then type $, the selection is cleared and the $ appended. So for example if I select foobar in xyzfoobarxyz and type $, I get xyzfoobar$xyz instead of the desired xyz$xyz. Is this known/documented behavior, or a bug? If it's a bug, is it an AucTeX or an Aquamacs issue (or an Emacs issue)?

Edit: In response to Tobias' comment below, C-h k $ returns

  $ runs the command TeX-insert-dollar, which is an interactive compiled
  Lisp function in `tex.el'.

  It is bound to $.

  (TeX-insert-dollar &optional ARG)

  Insert dollar sign.

  If current math mode was not entered with a dollar, refuse to insert
  one.  Show matching dollar sign if this dollar sign ends the TeX math
  mode and 'blink-matching-paren' is non-nil. When outside math mode,
  the behavior is controlled by the variable 'TeX-electric-math'.

  With raw ^U prefix, insert exactly one dollar sign.  With optional
  ARG, insert that many dollar signs.

And, the function delete-selection-mode is defined in delsel.el.

I'm far from LISP-literate. Perhaps the TeX-insert-dollar function does not take the delete selection mode into account (either by design or by omission)?


texts: org: How to sort headings by TODO and then by priority?

texts:
I often have a list like this:

* Main heading
** TODO [#A] Make world better
** TODO [#B] Make Emacs better
** TODO [#B] Customize emacs
** DONE [#C] some task
** TODO [#A] Launch rocket to mars

I would like to sort it according to the 'TODO' taskword first. Then the items inside the sorted TODO I would like to sort by priority.   (it would then be nice to further sort by "Effort").

And I mean currently I can click on the main heading and sort the children already by either priority or by todo keyword, but not both.

Is sorting by both possible like sort-strategy?

Currently I have two headings

* Tasks
** TODO [#A] meh
** TODO [#B] meh2
* Completed.
** DONE [#B] meh3.

But the problem with this approach is that I have to constantly shuffle tasks around when I complete them.

[EDIT]
This is kinda similar to this except that I couldn't make sense of his answer to transfer it to my needs?


texts: Is there a better way to handle multiline docstrings in elisp?

texts:
I hate the way that elisp (not sure if LISP in general) handles multiline docstrings.

(defun foo ()
  "This is
a multi
liner
docstring"
  (do-stuff))

I sure do wish that I could do something like

(defun foo ()
  (eval-when-compile
    (concat
      "This is\n"
       "a multi\n"
       "line\n"
       "docstring"))
  (do-stuff))

so that the indentation was consistent.

Unfortunately, eval-when-compile does not do the job.

Does anyone have any ideas?


texts: Function like save excursion for restoring buffers?

texts:
When I want to do something in another buffer and then restore the original, I currently do this:

(let ((this-buffer (current-buffer)))
  (switch-to-buffer (other-buffer))
  (insert "I was here!")
  (switch-to-buffer this-buffer))

Is there a less verbose way to this, something like:

(save-buffer-and-switch (other-buffer)
  (insert "I was here!"))


texts: Change color of preview expressions in Auctex

texts:
In the customize group "Preview Appearance", I click on "Preview Face" and set "Foreground" to "red". To the right, I see the word "sample" displayed in red. Then I select "Save for Future Sessions." But when I generate previews in my tex file, they are white instead of red.

How can I change the color of the preview images?


texts: How to get jabber.el to download all message history?

texts:
I'm using jabber.el and it's working great. I'm trying to find out if there's a way to have jabber download my recent chat history when initiating a chat with someone. It seems like my history is cached for conversations that occur while I'm online, but messages I missed while offline are not downloaded.

Is there a way to change this behavior?


texts: magit: squash commits in feature branch, but ability to unravel later if needed

texts:
Does magit offer a way to squash a bunch of commits, but preserve some sort of record
of the micro commits - should you need to step through them the next day.


texts: How to create plain text links or string variables that is displayed as its value in the buffer?

texts:
In my org-mode documents I want to be able to write:

#+VAR: that_year=2020

and then somewhere in text use it like:

"And [[var:that_year]] we are going to..."

which should be interpreted and displayed like a regular link description, so looking at it should just be:

"And 2020 we are going to.."

Then later on when changing that_year=2020 to that_year=2021 all occurences in the buffer of the variable link to that_year should also display 2021 instead of 2020.


texts:
Normally org-capture lets one insert a templated subtree somewhere into an existing Org file or tree node.

Is it possible to use org-capture to instead add a row to an existing Org-mode table?


texts: get/set package user-dir before installing org-mode

texts:
I have emacs 24.5.1 on Xubuntu 14.04. I want to install the latest version of the org package available in GNU ELPA (20150929). Following the advice on org-mode website, I launch emacs with the -q option: $ emacs -q. Then, I do M-x list-packages and install org. By default, it ends up being installed in ~/.emacs.d/elpa.

However, in my ~/.emacs, I have (setq package-user-dir "~/.emacs.d/lisp/"). Therefore, with emacs -q, how can I change the value of this variable?


texts: helm-M-x freezes and leaves large minibuffer after C-g

texts:
Often I type a command like C-x C-f and then want to cancel it by pressing C-g. In normal emacs this was never a problem, but with helm I get a big minibuffer that says Quit and then shows some weird stuff. Pressing C-g more times doesn't fix anything. (If it matters, I'm using spacemacs in holy-mode, but I'm convinced this is a helm-specific issue).

Demo

After pressing C-x C-f:

After pressing C-g to cancel, the minibuf says Quit at the top and then displays:

If I press C-g more times I just get more [No match]s at the bottom. The only solution is to press RET until it opens some random file, which is of course undesirable behavior. This happens for all commands, not just C-x C-f.


texts: Another level of "next/previous" in the compilation buffer?

texts:
I use Emacs with Cucumber (cucumber.io). Cucumber outputs lines like this:

Scenario: Jeff returns a faulty microwave              # /somepath/file1.feature:12
    Given Jeff has bought a microwave for $100         # /somepath/steps/file2.rb:5
    And he has a receipt
    When he returns the microwave
    Then Jeff should be refunded $100
          Exception blah
          /path/someotherdir/sourcefile.rb:123:error xxx occured

Scenario: Some other scenario...                       # /somepath/file1.feature:23
    Given ...

Everything works splendidly with the compilation buffers. I have made some entries in compilation-error-regexp-alist that locate those comments as "info" (in addition to whatever compiler/runtime errors from the Ruby environment) and am able to jump through everything.

Now, my question:

I would find it very handy if I could not only step between the "next" (M-n) and "previous" (M-p) steps in a completely linear fashion, but if I could separately do a "next scenario" (C-M-n) and "previous scenario" (C-M-p) binding. Those would ignore everything and just jump between the lines starting with Scenario:.

Is such a thing possible?


texts: how does optional argument `ALLOW-EXTEND` in `mark-word` work?

texts:
I am switching from VIM to Emacs for just a couple weeks and trying to write some Elisp. Having difficulties to adapt, I am exploring different options to do marking and reached this function.

(defun mark-word (&optional arg allow-extend)
  "Set mark ARG words away from point.
The place mark goes is the same place \\[forward-word] would
move to with the same argument.
Interactively, if this command is repeated
or (in Transient Mark mode) if the mark is active,
it marks the next ARG words after the ones already marked."
  (interactive "P\np")
  (cond ((and allow-extend
              (or (and (eq last-command this-command) (mark t))
                  (region-active-p)))
         (setq arg (if arg (prefix-numeric-value arg)
                     (if (< (mark) (point)) -1 1)))
         (set-mark
          (save-excursion
            (goto-char (mark))
            (forward-word arg)
            (point))))
        (t
         (push-mark
          (save-excursion
            (forward-word (prefix-numeric-value arg))
            (point))
          nil t))))

it's pretty straight forward except allow-extend. It seems to me for this function to work, allow-extend needs to be empty. But when we do interaction, we don't really provide any prefix key to it.

So why would allow-extend be non nil in this case? Also how does "P\np" work here?


texts:
Is there a way to have describe-variable show characters instead of numbers where it makes sense?

Here's for example output of describe-variable word-separating-categories:

  word-separating-categories is a variable defined in `C source code'.
  Its value is ((72 . 75))

  Documentation: List of pair (cons) of categories to determine word
  boundary. See the documentation of the variable
  `word-combining-categories'.

It would help if instead ((72 . 75)) it would show something meaningful.


texts:
lsp-clojure is executed 3 times when I start emacs so it ends up using about 2.5G of memory.
$ ps aux | fgrep java
benwiz      7920 82.8  8.7 6107672 1068712 ?     Ssl  08:11   1:18 java -Xmx2g -server -Dclojure-lsp.version=release-20200828T065654 -jar /home/benwiz/bin/clojure-lsp
benwiz      8033 92.5  8.6 6440492 1057176 ?     Ssl  08:11   1:27 java -Xmx2g -server -Dclojure-lsp.version=release-20200828T065654 -jar /home/benwiz/bin/clojure-lsp
benwiz      8141 20.9  2.9 6172188 365572 ?      Ssl  08:11   0:19 java -Xmx2g -server -Dclojure-lsp.version=release-20200828T065654 -jar /home/benwiz/bin/clojure-lsp

My entire lsp-related config
(setq lsp-keymap-prefix "C-l")
(use-package lsp-mode
  :hook ((clojure-mode . lsp)
         (clojurec-mode . lsp)
         (clojurescript-mode . lsp)
         (c++-mode . lsp)
         ;; (python-mode . lsp)
         ;; (javascript-mode . lsp)
         ;; (java-mode . lsp)
         ;; (c++-mode . lsp)
         )
  :commands lsp
  :config
  (setq lsp-modeline-code-actions-segments '(icon)
        lsp-modeline-diagnostics-enable nil
        lsp-enable-file-watchers nil
        lsp-enable-indentation nil
        lsp-enable-on-type-formatting nil
        ;; Optimiazations lsp-mode https://emacs-lsp.github.io/lsp-mode/page/performance/
        gc-cons-threshold 100000000
        read-process-output-max (* 1024 1024)
        lsp-completion-provider :capf))
(use-package lsp-ui
  :commands lsp-ui-mode
  :config
  (setq lsp-ui-doc-enable nil
        lsp-ui-sideline-show-code-actions nil))
(use-package lsp-ivy
  :commands lsp-ivy-workspace-symbol
  :config
  (define-key lsp-command-map "i"
    (lambda ()
      (interactive)
      (setq current-prefix-arg '(4))
      (call-interactively 'lsp-ivy-workspace-symbol))))
(use-package company-lsp
  :commands company-lsp)

Are there supposed to be 3 instances of clojure-lsp? If not how do I go about debugging this.


texts: How to modify bindings to match ECB window numbers?

texts:
ECB windows display their number: W-0, W-1, etc.

Is there a way to define bindings so that I can get to these windows using bindings such as C-c . w 0, C-c . w 1, rather than using C-c . g d to go to directories, C-c . g s to go to sources?

Alternatively, is there a way to display the key bindings for the windows in the frame modelines?


texts:
It seems that when using define-derived-mode, the new mode's keymap is merged with that of the parent mode. Is there a way to avoid this? That is, to inherit font-lock, etc. from the parent mode, but have a completely new keymap.

E.g.

(defvar foo-mode-map
  (let ((map (copy-keymap special-mode-map)))
    (define-key map (kbd "n") #'next-line)
    (define-key map (kbd "p") #'previous-line)
    map)
  "Keymap for foo-mode.")

(define-derived-mode foo-mode java-mode "Foo"
  "Major mode derived from `java-mode'.

\\{foo-mode-map}")

I'd like foo-mode to use foo-mode-map without any key sequences from java-mode-map.


texts: ssh - Pseudo-terminal will not be allocated because stdin is not a terminal

texts:
Windows 10 (64 bit), Emacs 25.1

If I want to remote connect by ssh to UNIX machine (Ubuntu) from my local machine (Windows 10) I do the next step:

Run cmd
Execute the next command

ssh -oStrictHostKeyChecking=no mwallet@192.168.210.16

Prompt password and as result I success connect to remote machine.

Here screenshot:

OK. Nice.

Now I want to do same on Emacs.
So my steps:

M-x shell
Execute command

ssh -oStrictHostKeyChecking=no mwallet@192.168.210.16

But I get error:

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

Here screenshot:


texts: Why does load-theme reset the custom-theme-load-path?

texts:
For some reason, I need to manually update the custom-theme-load-path list after every update of a theme like smart-mode-line or leuven-theme. Looking for a solution, I came across this SO post.  Here is the solution from that post (with slight modification):

;; Ensure that the custom-theme-load-path has all the theme paths added
;; Source: https://stackoverflow.com/a/15381087/1219634
(require 'dash)
  (require 's)
  (-each
      (-map
       (lambda (item)
         (format (concat elpa-dir "/%s") item))
       (-filter
        (lambda (item)
          (or (s-contains? "theme" item)
              (s-contains? "smart-mode-line" item)))
        (directory-files elpa-dir)))
    (lambda (item)
      (add-to-list 'custom-theme-load-path item)))

The above snippet works great and it updates custom-theme-load-path. The catch is that every time I load a theme using load-theme, the custom-theme-load-path resets to the value set by Customize. I have verified this behavior by putting (message "%s" custom-theme-load-path) before and after the call to (load-theme ..).

How can I permanently set the value of custom-theme-load-path so that load-theme cannot reset its value?

Here is a workaround I use to avoid this issue (but I'd like to understand why this is happening):

I have wrapped the above snippet in a function called update-custom-theme-load-path.
I call that function right before I call (load-theme 'leuven t)


texts:
In my .emacs file I have bound the tab-key to a function called smart-tab.

(global-set-key [(tab)] 'smart-tab)

(defun smart-tab ()
  "This smart tab is minibuffer compliant: it acts as usual in
   the minibuffer. Else, if mark is active, indents region. Else if
   point is at the end of a symbol, expands it. Else indents the
   current line."
  (interactive)
  (if (minibufferp)
      (minibuffer-complete)
    (if mark-active
        (indent-region (region-beginning)
                       (region-end))
      (if (looking-at "\\_>") ;; \_> end of symbol
          (dabbrev-expand nil)
        (indent-for-tab-command)))))

I'm using the module xah-find. So I also load it in my .emacs file.

(require 'xah-find)

When I'm now using e.g. the function xah-find-text all the results are printed in a temporary buffer *xah-find output* which is in the major mode ∑xah-find.

This major mode binds the tab-key to xah-find-next-match. But in my case the tab-key is still bound to my function smart-tab instead.

I would like to overwrite the global set tab-key in this major mode, so that in the major mode ∑xah-find the tab-key is bound to xah-find-next-match instead to smart-tab.


texts: How to make electric-pair-mode buffer local?

texts:
I would like electric-pair-mode to be enabled only in the buffers where I am editing, say, Emacs Lisp.

But it seems that electric-pair-mode is a "global minor mode": if it is activated in one buffer, it automatically becomes active in all buffers.  Thus, including (electric-pair-mode) in the emacs-lisp-mode-hook does not behave in a useful way.

Is there a way to configure Emacs to only use electric pairs in some buffers?


texts:
It would be nice to have a quick way to toggle a variable. Here's something that I have in mind.

Call a "toggle var" function.
The completing-read should list only variables that have single values (not lists or alists). I don't know if that can be done. It would be even better if it lists only the vars that have values as either t or nil. Pretty sure this cannot be done.
The function then sets the var value to t if its current value is nil, and vice-versa.

The question is if we already have an elisp function that does this. If not, and if people have dealt with this problem with their custom solution, would like to see how they do it.

Update:

A bonus feature would be to make the completing-read suggest the symbol under point (if present) for toggling.

So if the "toggle var" fn is bound to C-c ~, the usage will be as short as C-c ~ RET.

My current procedure to toggle a var is as follows:

C-h v VAR, get the current var value.
M-: (setq VAR toggled-value).

or

M-: (setq VAR (not VAR)).

I am looking for a way to speed up this process (less typing).


texts: How to make desktop-save store relative paths?

texts:
Perhaps I'm kind of misusing that feature – but I find desktop files rather handy to be kept with projects. Clearly, it doesn't make much sense then to store absolute paths for the files to be opened; rather, I would like paths relative to the desktop file's own folder, so I can move the entire project folder al gusto and always load the desktop file within.

Emacs has indeed no problem opening such “local desktop files”, like

(desktop-create-buffer 206
  "src/Main.hs"
  "Main"
  'haskell-mode
  ... )

However, as soon as I do desktop-save (e.g. because I added a new file to the project), all the stored paths will get changed to absolute format

(desktop-create-buffer 206
  "/home/me/right/now/the/project/is/stored/here/src/Main.hs"
  "Main"
  'haskell-mode
  ... )

It's not hard to undo this by hand or with a quick sed command, but that's quite annoying. Can I tell emacs not to store those paths in absolute format?


texts: How to close help buffer without moving to it?

texts:
I often use Emacs' help buffers, via e.g. C-h k.

Buffer *Help* is displayed in another window, and that window is not selected. In order to close the *Help* buffer, I need to switch windows via C-x o and then press q to close the *Help* buffer.

The solution of always opening the *Help* buffer in the current window, described here, almost works. But I would rather open the help in a different window.

Is it possible to close the *Help* buffer without moving to it, or to set it so that the cursor appears in the help buffer (which would mean I would just need to type q to exit)?


texts: Is there an equivalent to a spreadsheet's "freeze pane"?

texts:
I have an org file containing something like this:

|id   | foo         | bar       | ...
|-----+-------------+-----------| ...
|1    | foo1        | bar1      | ...
|2    | foo2        | bar2      | ...
|.    | .           | .         | .
|.    | .           | .         | .
|.    | .           | .         | .

I would like to split the window such that the id is always visible and/or the header is always visible, whichever line/column the cursor is set (that's very different from C-2 or C-3).

I'm aware that you can set a column width with <n>, which is a good substitute for splitting vertically, but to keep the headers visible?


texts: How to define a custom code style for C/C++ to be shared with others?

texts:
I have my own code style setup in my init.el file, but would like to publish it for other developers to use. Is there a good template to use so projects can share their C/C++ code style between developers?

Notes:

Having this as a separate package may be too much hassle/overhead.
Including a file and then referencing the style by name might be the way to go.


texts: Is there any way to view/edit the zip archive comment field

texts:
Zip files have a comment field for files and an archive comment, that you can set activating the --archive-comment option and display them with the zipnote command.

Is there any emacs package to edit them?


texts: How can I make customize use single quote for quotation?

texts:
Is it possible to teach customize to save its variables using single quote ' instead of quote?

Example:

…
'(package-archives '(("gnu"   . "http://elpa.gnu.org/packages/")
                     ("melpa" . "http://melpa.org/packages/")))
…

instead of:

…
'(package-archives (quote (("gnu"   . "http://elpa.gnu.org/packages/")
                           ("melpa" . "http://melpa.org/packages/"))))
…


texts: Why is cl-loop autoloaded on byte-compilation?

texts:
This question is motivated by a question about the "void function" error on cl-loop in the init file.

The following test shows that (require 'cl-lib) is not needed for byte-compilation:

Assume you have a file ~/tmp/test.el with the following content:

(defun test ()
  (cl-loop for i from 1 to 2 do
       (message "Looping %i." i)))

Start Emacs 26.3 with emacs -Q.
Run M-: (byte-compile-file "~/tmp/test.el"). Byte compilation works without errors.
Run M-x load-file RET ~/tmp/test.el RET.
The file is loaded and gives the message

Looping 1.
Looping 2.

But cl-macs is not loaded by default as the "void function" error on evaluating cl-loop shows.

The cl info manual says that cl-lib.el loads cl-loaddefs.el. This is done by a  (load "cl-loaddefs" 'noerror 'quiet) in the code.

But in the test code above there is no (require 'cl-lib). How gets cl-macs loaded at byte-compilation?

I already noted the (register-definition-prefixes "cl-macs" '("cl-")) in loaddefs.el.
The help string on register-definition-prefixes just says: Register that FILE uses PREFIXES., which is as much as nothing.

The info manual does also not contain any information about register-definition-prefixes.
Might it be that that command causes the autoloading at byte-compilation?

A look into register-definition-prefixes shows that it registers the prefix in the variable definition-prefixes.

The doc-string of definition-prefixes says:

Hash table mapping prefixes to the files in which they're used.
This can be used to automatically fetch not-yet-loaded definitions.
More specifically, if there is a value of the form (FILES...) for
a string PREFIX it means that the FILES define variables or functions
with names that start with PREFIX.

Note that it does not imply that all definitions starting with PREFIX can
be found in those files.  E.g. if prefix is "gnus-article-" there might
still be definitions of the form "gnus-article-toto-titi" in other files,
which would presumably appear in this table under another prefix such as
"gnus-" or "gnus-article-toto-".

Hm, "This can be used to automatically fetch not-yet-loaded definitions." seems to be a strong indication that register-definition-prefixes could play a role in the autoloading of cl-macs on byte-compiling code that contains cl-loop. But, the doc string does not say anything definite.


texts:
I want to write a scheme program in an org file. I want to be able to execute the #+SRC blcoks and see the result in #+RESULT: block. However, when I execute the #+SRC_BEGIN/END I get no output. Instead I get a guile REPL and that's it.

These are the config I have:

(setq geiser-default-implementation 'guile)

(org-babel-do-load-languages
'org-babel-load-languages
'((scheme . t)
 (emacs-lisp . t)
 (ruby . t)
 (R . t)
 (python . t)
 (C . t)
 (sh . t)))

There's an interesting detail. When I execute this code

#+SRC_BEGIN
(write "hello")
#+END_SRC

I get this output in the org file:

#+RESULTS:
[blank here]

And another buffer with this:

=> #<unspecified>

"hello world";; -*- geiser-scheme-implementation: guile -*-
(write "hello world")

But the following program produces no output at all, not even the empty #+RESULT: block,  except for a new guile REPL with nothing loaded into it.

This is the program (from SICP):

#+NAME rules
#+BEGIN_SRC scheme :tangle yes :noweb yes
(define (deriv exp var)
  (cond ((constant? exp var) 0 )
        ((same-var? exp var) 1)
        ((sum? exp)
         (make-sum (deriv (A1 exp) var)
                   (deriv (A2 exp) var)))
        ((product? exp)
         (make-sum (make-product (M1 exp)
                                 (deriv (M2 exp) var))
                   (make-product (deriv (M1 exp) var)
                                 (M2 exp))))))
#+END_SRC

#+BEGIN_SRC scheme :tangle yes :noweb yes

(define atom?
  (lambda (x)
    (and (not (pair? x)) (not (null? x)))))

(define (constant? exp var)
  (and (atom? exp)
       (not (eq? exp var))))

(define (same-var? exp var)
  (and (atom? exp)
       (eq? exp var)))

(define (sum? exp)
  (and (not (atom? exp))
       (eq? (car exp) '+)))

(define (make-sum a1 a2)
  (list '+ a1 a2))

(define A1 cadr) ;;TODO rewrite these as lambda expressions (lambada (x) (car (cdr x)). something like that.

(define A2 caddr)

(define (product? exp)
  (and (not (atom? exp))
       (eq? (car exp) '*)))

(define (make-product m1 m2)
  (list '* m1 m2))

(define M1 cadr)

(define M2 caddr)

(define foo '(+ (* a (* x x))
               (* (* b x)
                  c)))

<<rules>>

(deriv foo 'x)

#+END_SRC

Can someone tell me why the program isnt executed and instead a guile REPL is opened for some reason?


texts: is there any package that tracks changes made on an instantaneous basis?  That is, just like handwriting captures edits, I would like to see all the changes as a buffer is developing.  So, there is no separate ediff or compare call to make, but live tracking of all the deletions, backstrokes, etc.  Any pointers?  Thanks, -jay


texts:
It just occurred to me that the org-babel prefix C-c C-v must be what
it is because of the proximity of c and v in qwerty, and that it
would be better for me to use C-c C-f.  Is there a simple way to
change the prefix for all chords using it?


texts: What is the cause of this inconsistent behaviour of TeX-command-buffer when narrowing?

texts:
When editing medium sized .tex files, I often find it convenient to make use of the narrow command C-x n n (narrow-to-region), usually in combination with the mark section command C-c * (LaTeX-mark-section).

I then wish to compile only the accessible portion. For this purpose, I have been using the Tex command C-c C-b (TeX-command-buffer), but recently this command has started acting inconsistently. Depending on the position of point, it sometimes

Compiles only the accessible portion
Compiles the entire buffer
Returns the message ad-Advice-TeX-region-create: End of buffer

Compiling the accessible portion is what I intend, and I can usually (but not always) trigger this behaviour by putting point at the beginning of a line or at the end of the accessible portion.

Compilation of the entire buffer seems to happen sometimes when I have previously compiled the entire buffer with C-c C-c (TeX-command-master), but this is not consistent at all.

The End of buffer error is usually triggered by not placing point at the beginning of a line. It also seems to happen more frequently if there is a reference in the accessible portion to something in the inaccessible portion.

Sometimes (usually if I first trigger the End of buffer error by running C-c C-b with point placed mid-line, and then run C-c C-b with point placed at the beginning of a line) it happens that, although compilation occurs, new changes are not included in the output _region_.pdf file, although they are included in the _region_.tex file.

As a side-note, which is perhaps related, the Tex command C-c C-z (LaTeX-command-section) also behaves differently if I narrow: Instead of compiling the current section inside the accessible portion, it compiles only from the beginning of the section until the position of point.

I guess first narrowing and then running C-c C-b is not the intended use of the command C-c C-b. In that case, I should instead make my own command for this specific purpose. But it used to work for me consistently with the intended effect, so I am interested in knowing what might be the cause of this inconsistent behaviour.