texts: Is there any way to search in the current narrowed subtree in org mode?

texts:
I can use C-x n s (org-narrow-to-subtree) to narrow the content to the current subtree, which is great. After doing that, I want to search a keyword in the current narrowed subtree(instead of the whole file). I tried opening org-agenda, and use the search functionality(s) in it. But it didn't work as expected. Org Mode searched the whole file for my keyword.
So my question is, how to only search in the current narrowed subtree?


texts: What does it mean hlines in org's table?

texts:
Emacs 26.1.
In my org file I has table.

As you can see in table formula I has:

@>$6 = vsum(@I..@II)

This mean:

Last row and column#6 = sum of all rows between first and second hline

The question is:

What does it mean hline in org's table?

This is all rows that start by symbol #  ?


texts: How can I use the function debian-run-directories in Ubuntu 18?

texts:
I had this code in my emacs config to load/include any additional config in the site-start.d folder. It worked well on two debian machines, but currently I need to use Ubuntu 18 with emacs 26.3 and it fails.

(setq dotfiles-dir (file-name-directory (or load-file-name (buffer-file-name))))
(let ((user-site-start-dir (concat dotfiles-dir "/site-start.d")))
     (debian-run-directories user-site-start-dir))

From a related answer at https://stackoverflow.com/a/27676611 I understood it is both available in debian and Ubuntu. The error I get on start is:

Warning (initialization): An error occurred while loading ‘/home/foo/.emacs.d/init.el’:

Symbol's function definition is void: debian-run-directories

What is the easiest way to use it in Ubuntu?


texts:
paredit restricts my editing freedom to guarantee me that my s-expressions are never unbalanced.  Unfortunately, hippie-expand doesn't care a bit about rules and manages to disturb the balance by expanding to syntactically wrong text (e.g. text containing a couple of parentheses more than would be appropriate in the current context).

Cleaning up after the hippie is a chore; I have to disable paredit temporarily to delete the superfluous parentheses and reenable it afterward.

Can the hippie be made aware of paredit's efforts to keep the buffer clean?  Is there an alternative expansion feature that is more well-behaved when paredit is around?  Or is there a way to make paredit (or something like it) clean up invalid expansions automatically?


texts:
I don't really like the feeling of not being in control when using emacs' abbreviations feature. On the one hand, I don't want to be asked all the time but on the other hand I'd like to know when an abbreviation is expanded.

Hence, I fired up emacs (just kidding, it was already running) and did some elisp coding. Using some inspiration I got a working prototype, that is a minor-mode which highlights the expansion inserted by abbrev-mode for some time (default is 0.5s). You can find the code below.

However, after using this code for some time, I noticed that from time to time, the seemingly random parts of the buffer are highlighted. It appears my "hooking" into expand-abbrev is not working. So here comes the actual question:

  How do you advice expand-abbrev such that the advised code gets only executed when there really was an expansion?

I did some digging in the abbrev code, added some debug statements, etc. but could not get it to work.

Furthermore, although it has been fun fiddling around with elisp, I don't think my code is idiomatic and I would not be surprised if there were a better way to approach the problem, thus any comments on the code and how it can be improved are appreciated.

Here comes the code:

(defadvice expand-abbrev (after expand-abbrev-after-expansion-flash)
  (ahl/add-range last-abbrev-location (+ last-abbrev-location (length (symbol-value last-abbrev)))))

(defface ahl/default-face
  '((((class color) (background light))
     (:background "yellow1"))
    (((class color) (background dark))
     (:background "SkyBlue4"))
    (t :inverse-video t))
  "Face used for abbrev highlights.")

(defvar ahl/default-time 0.5
  "Time the abbrev high light should last.")

(defun ahl/add-range (beg end &optional buf face time)
  "Add a highlight for `TIME' second to the buffer `BUF' at
the position specified by `BEG' and `END' using the face `FACE'.

When the buffer `BUF' is not specified or its value is `nil',
highlight will be added to current buffer.

When the face `FACE' is not specified or its value is `nil',
the default face `ahl/default-face' will be used as the value.

When the time `TIME' is not specified or its value is `nil',
the default value `ahl/default-time' will be used as the value."
  (let* ((face (or face 'ahl/default-face))
         (hl (ahl/--make-hl beg end buf face))
         (time (or time ahl/default-time)))
    (run-with-idle-timer time nil (lambda (hl)
                                    (ahl/--remove-hl hl)) hl)))

(defun ahl/--make-hl (beg end buf face)
  "Make a highlight at the position specified by `BEG' and `END'."
  (let (hl)
    ;; GNU Emacs
    (setq hl (make-overlay beg end buf))
    (overlay-put hl 'face face)
    (overlay-put hl 'priority 1)
    (overlay-put hl 'abbrev-high-light t)
    hl))

(defun ahl/--remove-hl (hl)
  "Clear highlight."
  (and (overlayp hl)
       (delete-overlay hl)))

(define-minor-mode abbrev-high-light-mode
  "Highlight abbreviations upon expansion." nil
  :lighter ""
  (if abbrev-high-light-mode
      (progn
        (ad-enable-advice 'expand-abbrev 'after 'expand-abbrev-after-expansion-flash)
        (ad-activate 'expand-abbrev))
    (ad-disable-advice 'expand-abbrev 'after 'expand-abbrev-after-expansion-flash)
    (ad-activate 'expand-abbrev)))

(provide 'abbrev-high-light)


texts:
is there a way to sort only on second level headlines in org mode?

i am outlining a novel with top level headline being the chapter number and the second level headline being the timeline of the events in that chapter starting with a number = YYYYMMDD. the top level headline starts with a number representing the chapter. i have made the top level headline chapters high numbers in a hundreds sequence for ease of interpolating new chapters later, e.g., adding a chapter between 200 and the next chapter, 300, only requires adding at the end of the outline the new chapter with a top level headline of 250 and then resorting numerically. the second level headline is a different (chronological) number since chapter 300 may be a flashback occurring earlier in time than, say, chapter 100.

(see examples below)

if i could have two different ways of sorting (by chapter and by timeline), i could visualize the narrative more easily as i progress.

i have done some searching online for a solution and have considered tags and properties and functions but although i have been using emacs for about 5 years now (mainly as a text editor with .txt and .org and .markdown) formats, i am a writer with no programming or coding skills.

example of sorting by chapters (top level headline):

* 100 stranger comes to town
** 20190911
* 200 stranger meets chanteuse
** 20190925
* 300 stranger tells chanteuse a childhood story
** 19900525

example of sorting by timeline (second level headline):

* 300 stranger tells chanteuse a childhood story
** 19900525
* 100 stranger comes to town
** 20190911
* 200 stranger meets chanteuse
** 20190925

thanks for any help. i am not committed to org mode. any help will be appreciated. i could do this via a spreadsheet or a database manager, i realize, and have done so in the past, but would like to stay with emacs, which i use as aquamacs on an apple laptop.


texts: EPA (EasyPG Assistant): How to encrypt for *two* of my own keys? OR How are key-ids used to select keys

texts:
I want to tell epa to encrypt for two of my public keys. (stored in two different places). I have this at the top of the file:

# -*- mode:org; epa-file-encrypt-to: ("arthur@ul___dt.com") -*-

which causes it to select the first one key for that email. If i run epa-file-select-keys I can choose the two keys I want, though only for that session. I would prefer it remember this decision in the file so I don't have to remember to do this each time on each new computer this file is opened on.

How can I specify two keys by key-id on that line?
What is the actual syntax of the strings in the epa-file-encrypt-to variable? Is it defined somewhere? How are specific keys selected from this string

PS: these keys have the same user-id string and I'd prefer not to have to change that.

PPS: there is also a revoked key with the same email that it needs to not choose. I have tried on emacs 24.3.1 and emacs 25-snapshot


texts: Creating Shell-Based Filter in .emacs.d/init.el

texts:
This could be a useful FAQ for non-emacs-programmers.

  What should I put into .emacs.d/init.el in order to hard-code a specific shell
  filter that will replace the contents of the region?

For example, say I wanted to create an emacs command named uniqc that replaces the region with the output of uniq -c.  This should presumably be based on shell-command-on-region...  If I figure it out myself, I will post it tomorrow.


texts:
How do I close all code folds (but not comments) with evil's code folding?
For now I'm using evil-close-folds and evil-open-folds, but it closes all folds, including comments.
I'm using spacemacs 0.300.0@26.3 with the emacs edit style.


texts: How to delete a long region by setting a mark and then searching for the location of the end of the region?

texts:
I have a long document. I placed two unique identifiers, in the form of short strings of printable English letter, in two positions in the document. The identifiers are far apart. My task is to delete the region starting just before the first identifier and extending all the way down to just after the other identifier.

Here's how I've tried to do it.

I placed the cursor on the first letter of the first identifier.
I typed C-Space to set the mark.
I typed M-s, o + the second identifier + Enter to search for the location of the second identifier, and then moved the cursor to this location by clicking on the corresponding row in the resulting mini window.
I clicked the backspace key to delete the region between the mark and the current position of the cursor.

Unfortunately, nothing seemed to happen at the end of step no. 4, and the region I thought I was selecting was not deleted.

What did I do wrong? How can I accomplish my task?


texts: How do I focus Emacs from elisp in macOS?

texts:
I want to focus emacs by running some elisp. I have tried using do-applescript and the following snippet to focus Emacs:

if application "Emacs" is running then
    tell application "System Events" to click UI element "Emacs" of list 1 of application process "Dock"
end if

The problem is that I don't know how to grant emacsclient assistive access (The elisp code is given to emacsclient as an argument, see my full script at the end to get a feel for what I mean. I have given Emacs.app that access.)
Note that just "tell to activate" doesn't work if Emacs is in fullscreen.
I have also tried these, they don't work:

(raise-frame)
  (x-focus-frame nil)
         (make-frame-invisible)
         (make-frame-visible)
         (other-frame 0)
         (select-frame-set-input-focus (selected-frame))

Here is my full bash script that gets a file and its position from IntelliJ and opens emacsclient with the necessary code to open the file and focus emacs:

#!/bin/bash

emacsdir=/usr/local/Cellar/emacs-mac/emacs-25.3-mac-6.8/bin
socket=$HOME/.emacs.d/server/server

file=$1
#printf "%q\n" "hello\world"
#printf -v file "%q\n" $1
#printf "%q\n" "hello\world$1 $2 $3"

line=$2
col=$3

# if [ ! -e $socket ]; then
#     # $emacsdir/Emacs &
#     /usr/local/Cellar/emacs-mac/emacs-25.3-mac-6.8/Emacs.app/Contents/MacOS/Emacs &
#     while [ ! -e $socket ]; do
#         sleep 1
#     done
# fi

#Printf $file
#$emacsdir/
emacsclient \
    --no-wait \
  -e \
    "(progn

       ;; Load the file
       (find-file \"$file\")

       ;; Jump to the same point as in IntelliJ
       ;; Unfortunately, IntelliJ doesn't always supply the values
       ;; depending on where the open is invoked from; e.g. keyboard
       ;; works, tab context doesn't
         (when (not (string= \"\" \"$line\"))
         (goto-char (point-min))
         (forward-line (1- $2))
         (forward-char (1- $3)))

       ;; Raise/focus our window; depends on the windowing system
       (if (string-equal system-type \"darwin\")
(progn
(do-applescript \"tell application \\\"Emacs\\\" to activate\")
         (do-applescript \"if application \\\"Emacs\\\" is running then \\\n    tell application \\\"System Events\\\" to click UI element \\\"Emacs\\\" of list 1 of application process \\\"Dock\\\" \\\n end if\")))
         (raise-frame)
  (x-focus-frame nil)
         (make-frame-invisible)
         (make-frame-visible)
         (other-frame 0)
         (select-frame-set-input-focus (selected-frame))

       ;; Automatically pick up changes made in IntelliJ
       (auto-revert-mode t))"


texts: Theme background with opacity? Or theme callback?

texts:
Two related questions

Is it possible to use opacity while theming in emacs? I mean defining theme which - for example - would add 25% of blue to the background color of elements it is applied to. Or which would make font 30% lighter.

Or, if not.

Is it possible to dynamically recalculate some theme properties whenever main custom theme changes?

Background

Such a thing would be great for various „add-some-mark” modes. One case I mean specifically is flycheck-error face, which would be less invasive if it gave  background slight red accent instead of underlining text.

But my main case is crosshairs mode (which combines highlighting current row and current column). I configured it to use background slightly different than default, and that created nice subtle indication of cursor location. But once I started switching themes more often, it turned out to be nuisance, as proper color depends on current background.


texts: Why can't I resize my windows to be the same width?

texts:
When I split windows using SPC-w / then my windows are created with different widths. I want them to split in half. I can't resize it by dragging it nor by using the shortcuts.

I downloaded emacs for MacOS from https://emacsformacosx.com/

I am using GNU Emacs 26.2 (build 1, x86_64-apple-darwin18.2.0, NS appkit-1671.20 Version 10.14.3 (Build 18D109))
 of 2019-04-13.

I am on the develop branch of spacemacs on 0.300.0@26.2 (commit 48ffd37594825b2a2f3e6ff09e18460618449da9)

Let me know what other information I can supply.


texts:
I have multiple sources in helm like this

(setq helm-sources '(helm-source-buffers-list
                                  helm-source-recentf
                                  helm-source-dired-recent-dirs
                                  helm-source-emacs-commands-history
                                  helm-source-emacs-commands
                                  helm-chrome-source
                                  hgs/helm-c-source-stars
                                  hgs/helm-c-source-repos
                                  helm-source-buffer-not-found
                                  hgs/helm-c-source-search))

I  can goto next source using C-o. But when I reach to the last source, C-o doesn't go to first source. I  have to kill helm session and start a new one.

How do I make C-o to cycle through all sources?


texts:
I struggle to pronounce many computer terms, and to this day still mispronounce latex in my head - it just sounds better rhyming with flex.

How would I pronounce Emacs?


texts: evil (vi) keybindings for customize-mode

texts:
A recent convert to Spacemacs and I'm having trouble trying to change the keybindings in customize mode.

From a customize buffer I can change the state with M-m SPC evil-evilified-state and then it works as I expect (navigation, using SPC as leader; to be able to insert into the search bar properly you need to go back to emacs mode with C-z but I can live with that).

Trying to set this in my config with variants of (evil-set-initial-state 'custom-mode 'evil,normal,insert,and so on...) and nothing I've tried thus far is working.

Related: https://github.com/syl20bnr/spacemacs/issues/6699


texts: How to make my own org-mode text emphasis work again?

texts:
This might be interersting: For quite some time I used the code block below in my custom.el to make my own emphasis definitions. This worked up to org 9, I think. Then all of a sudden when I needed it again it stopped working. I found out that it had nothing to do with my config. So I filed a bug report. Then Nicolas Goaziou told me that it even if it worked in the past it is not supported meaning they won't fix it. He gave me the advice below, but without any knowlege of coding and lisp that ain't helping. What I need is quite simple. I want to define a character before and after a word or line and the defined face should be applied.Like:
%Exampletext Bla Bla%
Based on my codeblock this should turn into "org-habit-alert-face" which is more or less yellow. The % character should be invisible when set. Like ** for bold.
So can anyone with knowlege of lisp help me out here?

My custom-set-variables block that worked before:

 '(org-emphasis-alist
   (quote
    (
     ("!" org-habit-overdue-face)
     ("%" org-habit-alert-face)
     ("*" bold)
     ("/" italic)
     ("_" underline)
     ("=" org-verbatim verbatim)
     ("~" org-code verbatim)
     ("+" (:strike-through t))
     )))

Advice by Nicolas Goaziou:

  You may want to tweak font-lock related variables, e.g.,
  `org-font-lock-hook' to achieve that effect.


texts:
I am trying to use the enriched-mode for my personal documentation. I would like to colorize specific sections of my text for clarity. I can successfully do it with Edit/Text Properties/Foreground Color. The saved files seam to contain the right tags  etc. but the colors do not show up by reloading the file. Other features like italic/bold/etc. work fine. I cannot figure out why and how to solve this.
The original emacs buffer : "bold" is ... in bold font and "yellow" is yellow

standard
bold
yellow
end

The content of the file:

Content-Type: text/enriched
Text-Width: 98

standard

<bold>bold

</bold><x-color><param>yellow</param>yellow</x-color>

end

When reloading, only the "bold" line has the right face, the color is gone.


texts: Don't consider space and tab as abbrev-expand commands, but keep the C-x whatever shortcuts intact

texts:
I read the docs (at bottom) but can't figure this out.

I just started using "abbrev.el", and find that pressing
space,
tab,
C-x ', C-x a ', C-x a e
can cause the expansion to happen.

what if I find it dangerous for the expand to happen on tab and space,
how can I tell abbrev.el to not expand when pressing tab/space,

I still want to keep the ability to expand using "C-x ', C-x a ', C-x a e"

C-x ' runs the command expand-abbrev (found in global-map), which is
an interactive compiled Lisp function in ‘abbrev.el’.

It is bound to C-x ', C-x a ', C-x a e.

(expand-abbrev)

Expand the abbrev before point, if there is an abbrev there.
Effective when explicitly called even when ‘abbrev-mode’ is nil.
Before doing anything else, runs ‘pre-abbrev-expand-hook’.
Calls the value of ‘abbrev-expand-function’ with no argument to do
the work, and returns whatever it does.  (That return value should
be the abbrev symbol if expansion occurred, else nil.)


texts: Are there any lisp projects like jazz band?

texts: I was curious is there anything like https://jazzband.co/ but for emacs lisp where you can submit packages so that they can be submitted / maintained by a group rather than an individual ?


texts: org-babel: load (all) languages on-demand

texts:
I'm a big fan of supporting as many languages as possible. In particular, I wouldn't like to exclude support for any particular language from org-babel. (Who knows? Maybe I'll need to write some Fortran one day.) However, I know that loading support for all of the available languages at once can be painful.

Is there any way for org-babel to load support for languages when I actually try to use a code block with that language?

EDIT: org-babel-execute-src-block is probably the function that needs to be advised.


texts:
I would like to configure my Emacs fringe to show code folding sections.

For example, BBEdit on the Mac would show the following when editing a JSON file:

The marks themselves are actionable: clicking on a mark would expand or collapse the corresponding code section. When the document does not have a mode that supports code folding, the fringe is not shown.

Is it possible to expand the Emacs fringe functionality in such a way?


texts: How can I get the effect of buffer-local symbol plist property values?

texts:
Does Emacs have a way to set buffer-local properties on symbols?

It's well-known that there are buffer-local variables. But a property belongs to a symbol, not to a variable. Hence, if I have understood correctly, making a variable foo buffer-local has no effect on on properties set on the symbol foo.

(Note: In Emacs Lisp, the term property can refer to anything having to do with property lists (plists), including their uses for text properties, symbol properties, and other things. This question is about symbol properties specifically.)


texts: Remember previous text searches history with positions after further text search

texts:
TL;DR: Is it possible to go back and forth between different helm-ag searches, and keep the last visited position in each of them?
Using Spacemacs’ spacemacs/helm-project-smart-do-search (SPC / pattern RET, which I think is using helm-ag under the hood), I search for a text pattern in my project and go to the first match, and then SPC r s C-n RET to jump to subsequent matches. This is already more cumbersome than Vim’s :Ggrep pattern and then :cn, but still forgivable.
Recently, I learned that in Vim, after doing another :Ggrep pattern in the middle of jumping through the matches of the first, I can go back to the first pattern with :cold and continue jumping (:cn/:cp) from where I left it off. Is there an equivalent to this :cold/:cnew quickfix list history stack in Emacs? (Specifically for helm-ag results or otherwise.)
As a side question, I would also like to know if my current workflow with SPC / (as described above) could be made more ergonomic without custom key bindings.


texts:
I have been working on a document that I want to export to both HTML and latex; while working on the document I noticed that using latex \label{} and \ref{} tags works properly for latex export, but these are shown as plain tex in the HTML export.
Similarly if I use Org links for references inside the document (for example a link to an Org header ) these are translated as links in the HTML export, but the latex export only shows a different typografy (\texttt{}), but I don't get any hyperlink characteristic.

Is there a way to the same behavior for both exports, either latex directives to translate into html links or Org links as in-file references for the latex export?

For an example of what I'm dealing with please check the following snippet.

#+OPTIONS: H4 num:3 toc:nil \n:nil @:t ::t |:t ^:nil -_t f:t *:t <:t
#+OPTIONS: TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc
#+OPTIONS: author:t email:nil creator:nil timestamp:nil
#+LATEX_HEADER: \usepackage{geometry}
#+LATEX_HEADER: \hypersetup{colorlinks, citecolor=black, filecolor=black, linkcolor=black, urlcolor=blue}

* Section name
\label{sec:section_name} (not working properly in html export)
some text
#+LABEL: fig:image
[[img][file:image]]
some reference to figure \ref{fig:image} =link work in latex but not in html=
* other section
reference to [[* Section name][link work in html, but not latex export]],but if I use the reference \nameref{sec:section_name} will not work in html, but it will in latex export

PS: I'm aware that I may try to use pandoc, but I have never used it and I don't know if I will get the desired result, and I'd rather not use add additional tools to the toolchain.

Thanks in advance

-- Edit, Added org-mode fragment as example


texts:
I'm trying to send an html-formatted email via gnus. I found this:

https://groups.google.com/forum/#!topic/gnu.emacs.help/nZBJxHHYdko

which suggests:

1. M-x mml-insert-part enter
2. Content type: text/html

I tried this as shown in the screenshot:

but got a plaintext email (on an android gmail client).

What is the proper way to do it or what am I doing wrong?


texts: Opening my windows 10 project with spacemacs via samba/mount will attach wrong encoding to all files

texts:
I have a project on my windows machine.
I mounted that via samba.
Then I access the project with spacemacs.
When I run magit now all project fiels have been modified.

The actual change is that every file has a line feed with ^M now.

How can I disable this?


texts: exporting org-mode nested blocks to html

texts:
Is there a way to convince org-mode to export nested blocks as nested
 elements?

This would be really cool to handle nested quotes in html emails with mu4e.

#+BEGIN_QUOTE
hey ho
#+BEGIN_QUOTE
 hey hey
#+END_QUOTE
ho ho
#+END_QUOTE

Currently the exporter outputs:

        hey ho

        #+BEGINQUOTE
        hey hey

    ho ho

    #+ENDQUOTE

While I would expect it to output:

        hey ho

            hey hey

        ho ho


texts: customize-face for display-graphic-p only

texts:
I run graphical GNU/Emacs on macOS and also emacs in Mac Terminal installed via Homebrew.

I would like to customize the default face for only the graphical display.

I used M-x customize-face default, which produced the following in my ~/.emacs file

(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.

 '(default ((t (:inherit nil :stipple nil :background "White" :foreground "Black" :inverse-video nil :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 180 \
:width normal :foundry "nil" :family "Menlo")))))

Unfortunately, this configuration also applies to emacs in the Terminal (and makes the background grey for some reason). I do not want the config applied to emacs in the Terminal.

I've read that display-graphic-p would be a good way to distinguish between my two emacs versions.

How can I modify my ~/.emacs file to only customize the default face when display-graphic-p is true?

I attempted wrapping the inside of custom-set-faces with (when (display-graphic-p) ... ) but it caused the customization to be lost in both display modes.


texts: Is function `list` equivalent to using `cons` with a final cdr of `nil`?

texts: I'm trying to explain Elisp to 5th and 6th graders and I tell them that (+ 1 2) evaluates to 3 and not (3). So if I do want something that evaluates to (3) would I just evaluate ((+ 1 2))? No! This gives the error message Lisp error: (invalid-function (+ 1 2)), which I explain by saying any list must have a function in the first element position, and having (+ 1 2) in the first position is not a function. Good. But again, how to get a result (3)? If I try (list (+ 1 2)) I do in fact get (3). Why does list evaluate (+ 1 2) then create the list containing 3? quote doesn't -- and, no, it shouldn't. (function (+ 1 2)) gives (+ 1 2). As I understand,list is just syntactic sugar for (cons (+ 1 2) '()). Is this true? Can anyone explain some of the details of what I'm experiencing here -- or point me to a good explanation?


texts: Inserting timestamp in mini buffer in Emacs

texts: I keep on saving various org files in their respective folders using Filename as YYYY-MM-DD.org files . So I ended up typing C-x C-w  2020-10-06.org at least thirty times today. Can this process be automated ?


texts:
I'm running GNU Emacs on Windows 7 and was just wondering how to set up emacs so the "find-name-dired" command works. When I try using find-name-dired to recursively search for files I get this:

find . "(" -iname "*.tex" ")" -exec ls -ld {} ";"
File not found - "*.tex"
find exited abnormally with code 2 at Thu Feb 26 16:58:31


texts: I found that there's a :requires (source) section, but I'm not quite sure what it does and there doesn't seem to be any documentation on it. Can someone explain what it does?


texts:
I am experiencing a very unusual (concerning) error with my org-mode installation, and I am afraid that something might be broken. First, I have this setup in my .emacs file
;; Use my org-mode file as an init emacs file
(org-babel-load-file
 (expand-file-name "~/my_NOTES_file.org"
                   user-emacs-directory))

and when I try to load emacs there is an error in that org file. Starting with --debug-init reveals
Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  string-match("emacs-lisp\\|elisp" nil nil)
  org-babel-tangle-collect-blocks("emacs-lisp\\|elisp" nil)
  org-babel-tangle(nil "/home/username/my_NOTES_file.el" "emacs-lisp\\|elisp")
  org-babel-tangle-file("/home/username/my_NOTES_file.org" "/home/username/my_NOTES_file.el" "emacs-lisp\\|elisp")
  org-babel-load-file("/home/username/my_NOTES_file.org")
  eval-buffer(#<buffer  *load*> nil "/home/username/.emacs" nil t)  ; Reading at buffer position 1404
  load-with-code-conversion("/home/username/.emacs" "/home/username/.emacs" t t)
  load("~/.emacs" t t)
  #f(compiled-function () #<bytecode 0x1e0f4d>)()
  command-line()
  normal-top-level()

so it seems that the functions following org-babel-tangle are receiving a nil for some reason. I have tried several things, including

a full reinstallation of emacs
tangled the emacs-lisp source blocks in the org file.
isolate the emacs-lisp code blocks in a separate org-mode file and use that one instead.

The last solution does work, but I'd rather have all my configuration in my main org file. This main file is rather large (31128 lines) and has source blocks from several other programming languages. However, these two factors shouldn't be an impediment right? Thank you in advance for any help.


texts: Local variable's state mutated across function calls

texts:
I was surprised to discover that a local variable can have it's state modified across function invocations.  Consider the following example.

(defun example-mutable ()
  (let ((x '("the" "quick" "brown" "fox")))
    (nbutlast x 1)))

nbutlast is documented as follows:

  This is a version of butlast that works by destructively modifying the cdr of the appropriate element, rather than making a copy of the list

(And butlast is a function removes the last n elements from a list.)

Then multiple calls to example-mutable will return ("the" "quick" "brown"), ("the" "quick"), ("the"), and nil, in that order.

Another example is the following:

(defun example-nonmutable (change-val)
  (let ((x '("the" "quick" "brown" "fox")))
    (when change-val
      (setq x "something else"))
    x))

Then calling (example-nonmutable t) followed by (example-nonmutable nil) yields results of "something else" and ("the" "quick" "brown" "fox").  So we see that in the first example the value of x is not rebound on repeat function invocations, while contrastingly in the second example it is rebound.

So I am guessing that when the function is called that Emacs looks at the address of the data that x is bound to, and if it hasn't been changed, then it doesn't bother to create a new data object and rebind it in the interest of efficiency?

Is this behavior documented in the manual or elsewhere?


texts: Yasnippet not being loaded automatically in php-mode

texts:
I have a list of yasnippets for php mode in ~/.emacs.d/yasnippets/php-mode. One of the them is var_dump.yasnippet:

#name : var_dump
# key: vd
# --
var_dump($0);

The weird thing is that it's not being loaded when I open a php file. All the other yasnippets are loaded. I thought, that a compiled version of php-mode yasnippets is used. But I don't have any compiled yasnippet files in php-mode directory. I upgraded yasnippet to the last version from github.

Every time I start Emacs I have to manually navigate to var_dump.yasnippet and load it into the memory.

How to load var_dump yasnippet when php file is loaded?


texts: Is it possible to define multi-character pair for electric-pair-mode?

texts: Is it possible to define multi-character pairs (like LaTeX displayed equation pair \[ ... \] or markdown bold ** ... **) for electric-pair-mode?


texts: In eshell, if I echo $TERM, the result is dumb. What does this mean? Is this an emacs specific thing, or a tty thing?


texts: Open several files in a specifc layout with a shortcut

texts:
I would like to open in emacs, with a shortcut/bookmark three files in this configuration:

_____________
|       | B |
|   A   |___|
|       | C |
|_______|___|

A is my main editing file, B is for the outline of what I write in A and C is for notes. Note that I manually set this layout because the second column is much smaller than what C-x 3 produces.

I'm using lawlist-bookmark -- https://stackoverflow.com/a/19284395/2112489 -- which allows me to use F5 and then a letter shortcut to open quickly a file configured. But with this solution, the opened file take all the space and I have to set manually the layout of emacs to achieve the picture above. I am looking for a solution which will open the three files in the specific geometry layout with one keystroke (after typing F5 to enter inside bookmarks "menu").

Is it possible?

My current bookmarks:

(global-set-key (kbd "<f5>") 'lawlist-bookmark)
(defun lawlist-bookmark (choice)
  "Choices for directories and files."
  (interactive "cf[o]lder | [F]ile | ... )
  (cond
   ((eq choice ?o)
    (dired "~/folder"))
   ((eq choice ?f)
    (find-file "/~file.tex")
    (message "Opened:  %s" (buffer-name)))
 ....
   (t (message "Quit"))))


texts: How can I copy text from read only buffer?

texts:
When read the org mode manual to provide support for the raised question.
The  contents in read-only buffer is causally need to be copied as reference here.

Take the Org Capture Template as an example,

Tried to copy to the above region to this text area,  to perform the following operations:

1, Ctrl  + Shift  + 2 set  headline "org' as mark
2,  Ctrl + N to mark to the end
3, C-w
It prompt it as read-only-buffer

If strike Ctrl + V in this text area, there are no text are pasted.

Is it possible to copy contents from read only buffer?


texts: Make \includegraphics and TEXINPUTS setting for images work together

texts:
In my .profile-file I have a setting like:

export TEXINPUTS=$TEXINPUTS:/home/myuser/projects/images//

If I try to include an image by using (TeX-insert-macro "includegraphics"), auctex is in the directory where my current latex file is by default. However I want to be it by default in the directory /home/myuser/projects/images/.
If I include then an image from this dir it gives includes the whole path. But this isn't desired since I have set the TEXINPUTS variable. So how can I change this such that it only inserts the filename and not the whole (relative) path?

Edit
As suggested by @giordano, setting LaTeX-includegraphics-read-file to LaTeX-includegraphics-read-file-TeX should make it work. However in this case the solution in https://emacs.stackexchange.com/a/14011/2323 doesn't work anymore. However I want both.

Edit 2
Maybe one could create a custom helm source for inserting images, which is called when I want to insert an image via auctex (don't see how to bind this). Here is what I tried so far, but it doesn't work:

(defun helm-image-select ()
  (interactive)
  (helm :sources
      (helm-build-async-source "helm-image-select"
        :candidates-process
        (lambda ()
          (start-process "find-images" nil "find" "/home/myuser/projects/images/" "-iname" helm-pattern)) ;; doesn't seem to work, in particular no fuzzy search... should also take all path's from TEXINPUTS as base.
    :action '(("insert-image" . insert-image-action)
          )
    ))
  )

(defun insert-image-action (candidate)
(insert (format "%s" (helm-get-selection))) ;; should return only the filename without the path
)

As said above, I also don't know how to connect this to auctex (maybe alternatively, this could be executed if I expand a snipped for includegraphics).

Another problem with the approach above shows up in the case I don't want to add a pictures from a path known by $TEXINPUTS. In particular in this case the path has to be insert such that latex can find the image.


texts: How can I recenter grep or compile window on next error

texts:
On next-error in the grep or compilation window, I can use something like

(setq next-error-recenter 35)

to ensure that window displaying the match scrolls to show the whole match, as described in more detail in this stackoverflow question.

How do I do the same thing in the grep or compilation window itself? I often have grep output or compile output that is off the bottom of the window, and on days when I spend all of my time going through grep output or compile errors, switching back and forth between windows adds a significant overhead.


texts: Inserting org-style links from external program

texts:
I have written this function to insert an org-style link to a file:

(defun jay/insert-file-link (fname)
  "Insert link to file (called by Midnight Commander)."
  (interactive "s")
  (insert "[[")
  (insert fname)
  (insert "][")
  (insert fname)
  (insert "]]"))

When I am in a buffer with the cursor after this:

(jay/insert-file-link "foobar")

and hit C-x C-e it correctly inserts and I see

(jay/insert-file-link "foobar")[[foobar][foobar]]

However when I try it from the command line,

emacsclient -e "(jay/insert-file-link \"/tmp/foo\")"

it doesn't do anything in the buffer (it prints nil on the command line as expected)

Any clues as to what I'm dong wrong?  Thanks.


texts:
I am trying to rebind j, k key as well as capital E, B and Y, but cannot get them to work. Any pointers?

I put this into my .spacemacs (in dotspacemacs/user-config):

(evil-define-key 'normal key-translation-map (kbd "j") (kbd "gj"))
(evil-define-key 'normal key-translation-map (kbd "k") (kbd "gk"))
(evil-define-key 'normal key-translation-map (kbd "Y") (kbd "y$"))
(evil-define-key 'normal key-translation-map (kbd "B") (kbd "^"))
(evil-define-key 'normal key-translation-map (kbd "E") (kbd "$"))


texts: Why emacs can not see outer variable in lambda function?

texts:
I had a simple config to set fci-rule-column to different values depend on file types:

(use-package fill-column-indicator
  :ensure t
  :config
  (setq fci-rule-color "LightSlateBlue")
  (setq fci-handle-truncate-lines t)
  (add-hook 'python-mode-hook (lambda ()
                                (setq-default fci-rule-column 79)
                                (fci-mode t)))
  (add-hook 'c-mode-hook (lambda ()
                           (setq-default fci-rule-column 80)
                           (fci-mode t))))

You can see every time I add new file type, I have to repeat the work (add-hook ...). So I decide to refactor the code:

(use-package fill-column-indicator
  :ensure t
  :config
  (setq fci-rule-color "LightSlateBlue")
  (setq fci-handle-truncate-lines t)
  (defun my/fci-config (mode num)
    (add-hook mode (lambda ()
                     (progn
                       (setq-default fci-rule-column num)
                       (fci-mode t)))))
  (let (mode-config-hash)
    (setq mode-config-hash (make-hash-table :test 'equal))
    (puthash 'python-mode-hook 79 mode-config-hash)
    (puthash 'c-mode-hook 80 mode-config-hash)
    (puthash 'cperl-mode-hook 80 mode-config-hash)
    (maphash (lambda (k v) (my/fci-config k v)) mode-config-hash)))

With this approach, I only to put the mode and the number to hash table mode-config-hash when I configure setting for new file type.

But the code above did not work. I opened a Python or C file and the fci-mode was not enabled.

I try some debugging and realized that the line:

(setq-default fci-rule-column num)

did not ran correctly. If I change it to an integer value:

(setq-default fci-rule-column 79)

Then it worked.

So why did emacs see my variable? Is there a better way to accomplish this?


texts: What is the difference between global-set-key and local-set-key?

texts:
I want to make a prefix key. So which command is better for making a prefix key?

REF:

https://www.emacswiki.org/emacs/PrefixKey


texts: Symbol’s value as variable is void: Info-default-directory-list

texts:
I am getting this error when I start my emacs. It happens even if I comment out my init.el but not when I use the --no-init-file option.

Any thoughts on how to debug this issue? If this is a an upstream issue, do I need to create a Ticket for that?


texts:
I have a simple python script:

$ cat ~/simple.py
import os
import sys

def write_greeting(inpath):
    outpath = os.path.splitext(inpath)[0] + '.txt'
    with open(outpath, 'w') as f:
        f.write('hello world!')
    sys.stdout.write('wrote {}!'.format(outpath))
    return None

if __name__ == '__main__':
    write_greeting(sys.argv[1])

For example, running

$ python ~/simple.py ~/path/to/foo.bar

creates a text file ~/path/to/foo.txt reading hello world!. After ~/path/to/foo.txt is created, the message wrote ~/path/to/foo.txt! is printed to stdout.

Now, say I'm editing a file ~/path/to/foo.bar in emacs. I want to run simple.py on the file I'm currently editing from within emacs. After my script is called, I want to insert the contents from stdout where my cursor is.

Is this possible?

Essentially, I'd like to automate the sequence of commands:

C-u M-! python ~/simple.py ~/path/to/current/file/name

with a function M-x my-python-script.


texts: Tramp keep losing remote file permissions

texts:
I use: Emacs 26.1 on Windows 10 with tramp with plink/pscp to edit perl scripts on a remote Linux server

The scripts are executable (permissions 755).

When I load and then save them, if short time has passed, the permissions are preserved. However, when I don't save the buffer for somewhat longer time, it corrupts remote file permissions and set them to 666.

Even after switching off the saving of backups problem persists.

How do I fix that? Are there workarounds?


texts: Additionally factor like 0.33 mail after enable to display time in linemode

texts:
I enabled time-show on the line-mode following the instruction of EmacsWiki: Display Time

(display-time-mode 1)

The single line was appended and it take effects but has side outputs

Additionally displayed factor 0.33 and mail.

What does the factor of 0.33 guide to do, it should not be there is 0.33 piece of mail to check.


texts:
Suppose I have following pattern:

throw "some message";

which I'd like to replace with:

throw new Error("some message");

So, "some message" part should not be changed (or copied as is), and everything around it should be changed with arbitrary strings.

Is there any way to do that in Emacs?


texts: org mode: how to expand <s after heading without indentation?

texts:
I am using Org Mode version 9.3 with (require 'org-tempo) in my configuration.

Observed behaviour:

A.

Given

* Heading

<s

TAB produces

* Heading

  #+begin_src

  #+end_src

B.

Given

* Heading
Text
<s

TAB produces

* Heading
Text
#+begin_src

#+end_src

Desired behaviour:

Given

* Heading

<s

TAB produces

* Heading

#+begin_src

#+end_src


texts: Halting Clojure debugger after pressing the Continue Command

texts:
I use Emacs with Cider to debug Clojure Code. After setting a breakpoint using the default debugging framework, there appears the list of debugging options one might execute shown in this Figure

I experience recently a strange behaviour. If I press c(continue) while debugging a function and the debugger leaves the function debugged, it never stops in it again. This happens as well for the case when I press t(trace). It is as if the action is saved in the debugger. Every time this function is called, it executes the last command executed by the debugger. In this case continue or trace. I can see the trace result in the repl, thats why I came to this conclusion. However using the n(next) command does not lead to problems. Maybe its also saved and executed, but executing the next command never skips the function and always halts.

How to halt the function after pressing the continue command?


texts:
Emacs has the function other-window that lets you jump between windows. The function's documentation states that it takes an optional argument that tells the function how many windows to jump ahead.

Once upon a time, I defined a keyboard shortcut to call (other-window -1) to jump to the previous window. But at some point (GNU Emacs 25, I think), this stopped working. At first, it did not bother me much, but over time it has become a real nuisance. So if anybody knows a way to replicate that behavior, I would be very grateful!

The function I wrote looks like this:

(defun previous-window ()
    (interactive nil)
    (other-window -1))

And it is bound to a command key like so:

(global-set-key "\C-xp" 'previous-window)

The error message I get:

other-window: Wrong number of arguments: (lambda nil (interactive nil) (other-window -1)), 3

When I run emacs -Q and enter the function and keybinding manually, I get the same error.

Also, I have a function to switch to the previous frame:

(defun prev-frame ()
    (interactive nil)
    (other-frame -1))

This function works as expected.


texts: How to get fixed-pitch code blocks in variable-pitch Spacemacs org-mode?

texts:
I like to use variable-pitch mode when working with prose in org-mode, but I have to turn it off when I involve tables or code blocks. Using answers found elsewhere, such as https://stackoverflow.com/questions/3758139/variable-pitch-for-org-mode-fixed-pitch-for-tables I can obtain what I am looking for in vanilla Emacs.

My issue is that this does not work with the code blocks in Spacemacs. Spacemacs seems to add font-lock'd faces to code blocks, and I do not know how to make only these faces stay fixed-pitch while the rest of the buffer is in variable-pitch-mode. Would anyone have any advice?

I currently use the following Spacemacs layers:

 auto-completion
 better-defaults
 emacs-lisp
 git
 markdown
 org
 (shell :variables
        shell-default-height 30
        shell-default-position 'bottom)
 spell-checking
 syntax-checking


texts: which-key takes up entire lower half of the screen (possibly related to package zoom)

texts:
Suddenly which-key, when triggered, takes up the entire lower half of the screen although only a portion of that is then filled with information. This behaviour started a couple of days ago, but I did not change the behaviour of which-key in any way.

(use-package which-key
  :ensure t
  :diminish which-key-mode
  :config
  (which-key-mode))

How can I change that?

Sometimes I think that the order in which my config file introduces packages is really crucial in terms of how emacs behaves, is that true?


texts:
After having moved to an upgraded machine, I am now facing problems with my org-mode setup, specifically that org-id-find now returns nil for IDs that do exists in my org files. This breaks some of my functions (where it is used in conjunction with org-with-point-at), as they are unable to find the correct headings.
On emacs 24.5.1/org-mode 8.2.10, org-id-find returns (file-name . position) as it should, but on emacs 25.2.2/org-mode 9.1.6, org-id-find returns nil. The configuration files are the same.
org-id-track-globally is set to t, and I can see in *Messages* that files are searched for IDs. The file system in which my org files are located are the same on both machines (it's mounted from a central file server with NFS). org-id-locations-file is set and I have tried running org-id-update-id-locations to no avail.
I haven't been able to find any explantion for this behaviour. Anyone experienced anything similar?


texts: How to move cursor to my first todo entry

texts:
Is there any way to move the cursor (point) to the first todo entry in my org file?
Is there any built-in function in org-mode? if no, any elisp code that can do that is welcome.

I had tried this function:

org-show-todo-tree

This will only search(and unfold) for todo entries without pointing to the first todo item.


texts:
My system has emacs 24.5.1 with a built-in ruby-mode. I want to update to the latest ruby-mode from emacs 25.1 in order to get improved syntax highlighting. Upgrading the entire emacs installation is more than I want to chew off (many servers times many users).

I copied the improved ruby-mode.el to my home dir and added to my .emacs file:

(load "~/ruby-mode")

I get no error messages upon reloading emacs, but also no upgraded ruby-mode (squiggly heredocs still not properly highlighted).

How can I replace the built-in ruby-mode with my own local copy?


texts: Going to bookmark in other window and frame

texts:
I work with two screens (screen 1 and screen 2) and each screen has got an emacs frame (respectively frame 1 and frame 2).
Sometime I have a bookmark in a window in screen 1, the cursor is in screen 2 and I want to jump in the location of the bookmark in screen 1.
If I use bookmark-jump, the current buffer in the current window is replaced with the one containing the bookmark.
If I use bookmark-jump-other-window, in the current frame a new window is created with the buffer contained in screen 1.

So in no case I jump in frame 1 without changing the content of to frame 2.

I would like to get the following behaviour.
If the bookmark I want to jump to is not contained in a buffer in any window in any frame, then replace the current buffer in the current window with that one.
If there is a frame containing a buffer with the bookmark, then jump to that frame without replacing any buffer in the current frame.

How can I get this behaviour?


texts: AppleScript in Org-Mode source code blocks?

texts:
Does anyone know how to setup org-mode so that you can write/process applescript from within org source code blocks? I.e.,

#+BEGIN_SRC applescript

tell application "Emacs"
    [do something amazing]
end tell

#+END_SRC

Thanks!


texts: How to show matching parenthesis faster?

texts:
When you type closing parenthesis (or maybe it works for other paired
symbols too), and opening parenthesis is not visible on the screen, Emacs
“jumps” to opening parenthesis to show you where it is. This is very handy.

I want to make period for which opening parenthesis is shown
shorter (say, half a second). This shouldn't be hard, but the problem is that I don't know what
this functionality is called, so I cannot search Emacs variables/functions.


texts: Company Completion Within Yasnippet Snippet

texts:
I am trying to use company-completion within a Yasnippet header. I bound company-complete to C-SPC and use that for my auto-completion. When I hit control enter, I get a screen like this:

And I hit enter to get this:

Then I start typing iost- and wait to get the company-complete (It breaks immediately when I hit C-SPC, see below):

And then I hit enter to complete, and this happens: (or immediately if I hit C-SPC):

I tried googling around but no solution worked. I only want to be able to yasnippet snippets from the company-complete dropdown if that's possible.

Thank you!


texts:
Running Doom Emacs 2.0.9 on Emacs 26.3.

I have a test.org as follows:

* h1                                                            :tag1:tag2:
* h2                                                                 :tag2:
** h21
** h22
* h3                                                                 :tag1:
** h31
** h32

init.el does not carry any customization for any org variable.

When I run org-agenda m it provides tag1 and tag2 to choose from. But when selected it does not produce any results. Can this be achieved without a predetermined list of agenda files?

When I do org-sparse-tree m for tag1, it continues to show the file as it is. I thought it would only show tag1 items.

What is wrong? How do I set things right?


texts: Copy and Paste From PDF to Emacs as Plain Text

texts:
Here is my problem:

I often copy text from a PDF (let's say one that is nicely formatted or scanned cleanly) and like to post it in an active org-mode file I have for academic research. However, pasting it with C-y typically inherits a lot of the new lines that PDF text tends to carry, requiring me to fix the text manually.

I've checked around for a solution to this problem, but the closest I found was a previous question on overflow, but it only works partially. It requires that I select the newly pasted text with C-x C-x, call replace-string with C-q C-j RET RET.

This typically removes most of the new lines effectively, but will often eliminate the space between two words that were on the end of the previous line and the first on the next (example would be 'betweentwo' in this sentence).

Any common fix to this? If possible, I would like a general solution that allows me to paste text from any source as simply plain text. I'm using Linux and emacs 24.5 for clarification. I don't think any of my own configurations are in conflict, but if my init file is wanted, I can post that on request.

EDIT: Pictures to show the problem.

Here's sample text of a pdf I want to copy. It's either a direct PDF export or a very clean scan, so I have no problem copying text accurately to my clipboard (No incorrect words, symbols, etc).

Here's what it looks like pasted C-y in emacs (org-mode on). Notice how it doesn't just let the lines wrap naturally. This is actually a cleaner yank than most, but the problem is still present.

Here's what it looks like after I use the make-shift method I linked in the original post. As of now, I'm re-highlight the region with C-x C-x and then use ispell-region to methodically correct the words combined together.

Solution: YoungFrog's answer below clarified my problem. TL;DR, M-q, fill-column, does well to reformat the text I yank from PDFs into paragraphs of length determined by emacs' fill-column (70 by default).

In addition, I was using visual-line-mode, which can make fill-column look like it's not working right since the minor-mode is intended to visually wrap text with "soft new lines", as YoungFrog also pointed out.

A useful package that combines visual-line-mode with the formatting benefits of fill-column is visual-fill-column, available on MELPA.


texts: Defining minor-mode buffer-local variables

texts:
I want to do something  VERY simple. I want to create a minor mode, which when enabled sets a buffer-local variable (say left-margin-width, for instance) with a specific value.
I can do this:
(define-minor-mode margin-mode
  (setq left-margin-width 3))

Now, I want the variable to take back it's global value when margin-mode is disabled. To me this seems like a very natural use-case, but apparently I can't find a simple and easy way to do his yet! Once enabled, the variable retains it's value until the buffer is closed. Which is very undesirable.
Help!


texts: How can I create an function to build a table of contents at a marker?

texts:
I'm planning to move StackMode to a literate program once it matures, but until then I'm using the conventional ^L section markers.

My files look like this:

;;; Code:

^L
;;; Section 1 Title

(defun code () things)

^L
;;; Section 2 Title

(defun bleh () bergh)

I'd like to be able to add a hook that creates a table of contents at some marker, say ^;;; Contents:$:

;;; Contents:

;;;  1. Section 1 Title
;;;  2. Section 2 Title

;;; Code:

^L
;;; Section 1 Title

(defun code () things)

^L
;;; Section 2 Title

(defun bleh () bergh)

For extra fun, subsections could be repeated linefeed characters:

^L^L
;;; Subsection


texts: I have created a workflow where a python script creates urls in org lists on a dayly basis. Thus the links might be created twice or more often. I open the in my web browser by using C-c o. What I would like to see now in the org table is if I already opened the link in the browser before I open it. I would like to have it like it is done in the web browser itself when you already visited a url then the link is purple instead of blue. Can I do this in org mode as well?


texts: Certain keywords show font weight of bold

texts:
The syntax highlighting in Emacs is not great so I installed tree-sitter plugin to improve it and configured it like this,
;; Tree sitter
(use-package! tree-sitter
  :config
  (require 'tree-sitter-langs)
  (global-tree-sitter-mode)
  (add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode))

It does work, but for some reason certain keywords like a call to a class method show up as font weight of bold, when they should show as normal weight.

As you can see all #include statements show as bold here and,

These methods also show as bold.
Is there a way to make them normal weight, without turning off the bold weight globally?


texts: using theming to adjust theme in spacemacs

texts:
I'm trying to use theming to make adjustments to an existing theme. Under dotspacemacs/user-init I have the following section:

  (setq-default theming-modifications
        '((tao-yang
           (font-lock-comment-face :foreground "#bbbbbb")
           (org-level-1 :foreground "#ea056d")
           (org-level-3 :weight 'normal)
           (default :cursor "pink")
           (cursor :background "pink")
           )))

The font-lock-comment and org-level-1 adjustments work just fine.
:weight 'normal gives an error: set-face-attribute: Wrong type argument: symbolp, (quote normal)
I also get a wrong argument error when I try :slant 'italic
The last two lines don't create errors but also neither has an impact on the cursor color, individually or combined

I'm a bit at a loss of why that is. I couldn't find anything in the documentation of theming that would send me in the right direction.

How can I adjust the weight or slant of a font using theming in spacemacs?


texts:
Is there some option to make frame active when i create it? I can switch to it with this code, but maybe there's a way to do this without select-frame func?

(defun show-misc-posframe ()
  (when (posframe-workable-p)
    (posframe-show "*spec-buffer*"
           :poshandler 'posframe-poshandler-frame-top-right-corner
           :height 45
           :width 50
           :override-parameters '((cursor-type box))))
  (setq misc-posframe--frame (with-current-buffer "*spec-buffer*"
                    posframe--frame))
  (select-frame misc-posframe--frame))


texts: Is there a way to selectively stash in Magit without indexing?

texts:
Is there a way to stash changes in magit selectively, akin to:

git stash save -p <paths>


texts:
I am teaching myself  autoloads for "home-made" packages.
Official Docs
suggest to  use update-file-autoloads or update-directory-autoloads on the related package file or directory, which will add the corresponding autoload calls into loaddefs.el. This does not seem to be the strategy followed by most packages, which instead create a distinct *-autoloads.el file for each source equipped with the magic autoload comments  (perhaps to avoid cluttering loaddefs.el).
I haven't found any tutorial on this, by the way a user suggested to use package-generate-autoloads. Indeed, it works up to a certain point, and this is my attempt.
I created the file ...site-lisp/foo/foo.el:
;;;###autoload
(defun foofunc () (message "I'm foo"))
(provide 'foo)

Then, I executed on the foo folder:
(package-generate-autoloads "foo" "foo")

Much like for any package, it generates in foo the foo-autoloads.el file, where there is a line:
(autoload 'foofunc "foo" nil nil nil)

When restarting Emacs, by inspecting the value of the variable load-path, I see that the foo is automatically included, being under site-lisp. However, evaluating foofunc, gives:
Debugger entered--Lisp error: (void-function foofunc)

Not surprisingly, if I manually evaluate (autoload 'foofunc "foo" nil nil nil) or
(load "foo-autoloads.el")

foofunc works. However, there should be some way to have this done automatically by Emacs for all autoloads files in the path.
Note that, while this question focuses on package-generate-autoloads function, if there is a better way to activate autoloads, your answer is welcomed.
Side Question
As a side note, I have seen that applying package-generate-autoloads to some ELPA packages adds to the corresponding *-autoloads.el files a convenient call to register-definition-prefix. As I understand, with this function you can add a custom prefix mypref-, such that, whenever you try to autocomplete mypref- in the minibuffer, you autoload the relevant lisp file.
What (magic cookies) in the source files trigger(s) the insertion of these calls in the *-autoloads.el files?


texts: Making Emacs show the last part of bash-command output

texts:
I use the Evil mode inside Emacs for doing a lot of my work. If I need to run a shell-command and see its output all I need to do is type in normal mode :!<bash command>. The window splits into two halves and displays
the output in another buffer named Shell Command Output

However, I notice that when the output is very long (say when one compiles a program) the output buffer shows the top part of the output rather than the bottom part which is where the compilation errors are usually mentioned, and are of immediate interest during programming.

How do I get Emacs to display the ending of the bash command output on running the bash command?


texts:
When cycling visibility of a subtree using TAB, subtrees will open increasingly showing more subheadings, one at a time. However, when I cycle a buffer globally using S-TAB, their contents are shown, which feels like the wrong thing to do.

This is my tree:

* heading 1
** subheading 1.1
*** subheading 1.1.1
*** subheading 1.1.2
** subheading 1.2
* heading 2
** subheading 2.1
*** subheading 2.1.1
* heading 3

When all collapsed, they look like this:

* heading 1
* heading 2
* heading 3

When I do S-TAB they all open to their most inner subheading:

* heading 1
** subheading 1.1
*** subheading 1.1.1
*** subheading 1.1.2
** subheading 1.2
* heading 2
** subheading 2.1
*** subheading 2.1.1
* heading 3

I would want first to show the immediate level, like this, before showing all the sub-subheadings.

* heading 1
** subheading 1.1
** subheading 1.2
* heading 2
** subheading 2.1
* heading 3

Any way to do this?

Thank you,
EG


texts: org-habit - do a repetitive task certain days of the week only?

texts: I want to know how can I set a repetitive task for only a range of days of the week, for instance from Monday to Friday only.


texts: org-mode additional line-spacing after paragraphs, list items and headings

texts:
It has been asked before, but the answers are a bit old, and did not work for me. So I am hoping that the situation has changed a bit.
I would like to modify the vertical space around headings, at the end of lists and paragraphs to visually group them. A bit like a context specific line-spacing at the newline character. Is there a way of doing this? Here I have found that it is possible to change the font for each org-level. Would that be a good entry point?


texts: A way to auto have entries in the property drawer to to track header creation and last change of the header?

texts: is there a way to auto have entries in the property drawer for tracking header creation and last change of the header? anyone using something like this?


texts: Dired show specific files in default omit-mode

texts:
I'm omitting certain files in dired mode using this hook:

(add-hook 'dired-mode-hook (lambda () (dired-omit-mode 1)))

Is it possible for me to display parent directory .. in the omit-mode ?


texts: How to configure spacemacs to work correctly with haskell Stack?

texts:
The Haskell stack build doesn't install ghc to the system, only for itself, and using spacemacs without a systemwide configured ghc have been a painful experience (to me).

My question is, there is a correct way of configuring emacs/spacemacs for using with stack, or users are supposed to install a systemwide ghc and stack to work with emacs/spacemacs and haskell?

Creating a layer specific to deal with stack seems to me to be the right  solution, but I don't know how to do this, I'm a beginner on both stack and emacs, so...


texts: How to format code similar to the way Vim has (select + "=")?

texts: In Vim I can format code by the key =, with or without selecting a region. Is there a way to do it in Emacs in an easy way too?


texts:
I am using spacemacs. When writing .html file, it shows that it is in web-mode. I want to indent, press TAB, but nothing happened. So I can only use SPC to indent.

I added

(setq web-mode-markup-indent-offset 4)
(setq web-mode-css-indent-offset 4)
(setq web-mode-code-indent-offset 4)
(setq web-mode-indent-style 4)

to .spacemacs file, but it did not work. I also tried

(defun my-web-mode-hook ()
  "Hooks for Web mode."
  (setq web-mode-markup-indent-offset 4)
  (setq web-mode-css-indent-offset 4)
  (setq web-mode-code-indent-offset 4)
  (setq web-mode-indent-style 4)
  )
(add-hook 'web-mode-hook  'my-web-mode-hook)

But it did not work either.

So what I should do to make it indent using TAB?

From C-h k tab:

<tab> runs the command spacemacs/emmet-expand, which is an interactive Lisp
function in ‘../../../html/funcs.el’.

It is bound to <tab>, TAB, <hybrid-state> <tab>, <hybrid-state> TAB,
<emacs-state> <tab>, <emacs-state> TAB, <insert-state> <tab>, <insert-state>
TAB.

(spacemacs/emmet-expand)


texts: Ignore code evaluation output in org-mode

texts: Is it possible to set a header setting in a org file to indicate that when I eval any source code block in the file it shouldn't change the file contents? I don't want that default #+RESULTS: block that's added by default below the code block.


texts:
The option c-doc-comment-style supports javadoc, autodoc and gtkdoc.

Is there a way to get doxygen support? (\returns, \note, \brief... etc)


texts: Comparing `system-configuration-options` to a user-specified list

texts:
In this example, the system-configuration-options is a string:

"--prefix=/Users/HOME/.0.data/.0.emacs/.0.x11 --with-x --with-ns=no --enable-checking=yes,glyphs --enable-check-lisp-object-type --without-compress-install 'CFLAGS=-O0 -g3' CPPFLAGS=-I/Users/HOME/.0.data/.0.emacs/.0.macports/include LDFLAGS=-L/Users/HOME/.0.data/.0.emacs/.0.macports/lib"

Inasmuch as the order of the configuration options may change, I would like to come up with a fancier test than the layman's approach (i.e, me) using split-string and comparing each element one-by-one with member using mapc.  [Some cl-... magic, for example, would be nifty.]

MY CUSTOM LIST:

'("--prefix=/Users/HOME/.0.data/.0.emacs/.0.x11"
  "--with-x"
  "--with-ns=no"
  "--enable-checking=yes,glyphs"
  "--enable-check-lisp-object-type"
  "--without-compress-install"
  "'CFLAGS=-O0 -g3'"
  "CPPFLAGS=-I/Users/HOME/.0.data/.0.emacs/.0.macports/include"
  "LDFLAGS=-L/Users/HOME/.0.data/.0.emacs/.0.macports/lib")

Q:  How to programmatically determine whether system-configuration-options contains ALL of the members of My Custom List?


texts: Magit hunk with long lines set default hidden

texts:
When I am using magit and open a a certain commit containing hunks with very long lines (a minified javascript file, css ...), emacs does not respond anymore or it becomes very slowly, luckily still responds to C-g.

If I manage hide this hunks in the Magit Rev buffer emacs behaves nicely again.

Is there a way to tell magit, if the lines for this hunk are too long, don't show this hunk?

This might be related to: How do I prevent extremely long lines making Emacs slow?


texts: command to transpose two adjacent windows when I have more than two windows?

texts:
My idea was kind of this (but I'm open for other suggestions):

I need

a functions to get names of windows (not frames)
a way to read the current window configuration.
e.g. (vertically-split a (horizontally-split b c))
a functions to transpose 2 windows / modify window configuration.
e.g. (vertically-split a (horizontally-split b c)) -> (vertically-split (horizontally-split b c) a) -> (vertically-split (horizontally-split c b) a)


texts: How to render latex in-line with org mode?

texts:
I have a file with the following contents:

Math Notes -*- mode: org -*-
#+STARTUP: latexpreview

Test $\forall \epsilon > 0$

I am trying to render the latex with C-c C-x C-l, but it's not working. My .emacs.d file is taken straight from this gh repo.
Could someone please offer some advise on how to debug this? Thanks!


texts: How to change the default keybinding of a mode?

texts:
I am using skewer mode which binds C-c C-z  to Select the REPL buffer

This conflicts with another mode's (which I use simultaneously) keybindings.

What is the canonical way for me to make it so that C-c C-z is instead C-c C-r in Skewer mode?


texts:
I hoped to enable a virtualenv with org-babel source block before executing some python.

I wanted to do something like pyenv pyvenv-workon before it evaulates my code block. I didn't want to have to manually enable the virtualenv.

Something like,

#+NAME: elasticsearch_dsl_test
#+BEGIN_SRC: python :prologue "(pyvenv-workon 'elasticsearch)"
from elasticsearch import Elasticsearch
from elasticsearch_dsl import Search, Q

client = Elasticsearch()

search = Search(using=client, index="localdev-news-newsentry")
response = search.execute()

print ["No response", "Was successfull"][int(response.success())]
print "Response took {0}ms.".format(response.took)
#+END_SRC

I couldn't quite get it working.


texts:
I'm trying to add a search engine in emacs-w3m and use duckduckgo to search emacswiki

(eval-after-load "w3m-search"
  '(progn
     (setq w3m-search-engine-alist
           (append '(
                     ("emacswiki" "https://duckduckgo.com/?q=%s++site%3Aemacswiki.org&ia=web" nil)
                     ))
                     )))

It does not work as intended because of the second "%". How can we escape the % character in emacs?


texts: How to add right padding to the current line number in emacs in nlinum-mode

texts:
I'd like to make current line number in relative line number mode more distinguishable

(setq nlinum-format-function 'myformat)
(defun myformat (line width)
  (if
    (eq line (what-line)) "123  "
    "321"
  )
)

Notice padding to the right of the current line number in vim which very subtly makes it easily distinguishable.


texts: Debugging and setting breakpoints in Java code built with Gradle

texts:
I am using Emacs (v24.4) for writing Java applications. I have created a Java library that I am building using Gradle (v2.2) and testing with Spock Framework where I have all my test cases.

I would like to debug my Java code using Emacs. However, I haven't found any way of doing this. I would like to set a breakpoint and step through my Java code.

Here is my Gradle build file:

apply plugin: 'java'
apply plugin: 'groovy'

repositories {
    mavenCentral()
}

dependencies {
    compile 'org.igniterealtime.smack:smack-core:4.1.0'
    compile 'org.igniterealtime.smack:smack-tcp:4.1.0'

    testCompile 'org.spockframework:spock-core:0.7-groovy-2.0'
    testCompile 'org.codehaus.groovy:groovy:2.3.6'
}

jar {
    baseName = 'SunSmackClient'
    version = '1.0.0'
}

gradle.projectsEvaluated {
    tasks.withType(JavaCompile) {
        options.compilerArgs << '-Xlint:unchecked'
   }
}

task wrapper(type: Wrapper) {
    gradleVersion = '2.1'
}

Example Spock Framework test:

public class SmackClientSpec extends Specification {
    private SmackClient smackClient;

    /* Test 1 */
    @IgnoreRest
    def 'Create a connection to XMPP server'() {
        setup: /* Setup connection object */

        def domain = 'domain'
        def username = 'username'
        def password = 'password'

        SmackClient smackClient = new SmackClient()

        expect: /* Connection to return true */
        smackClient.createConnection(domain, username, password) == true
    }
}

Many thanks in advance.


texts: font-lock keywords and syntax-table mutually interfering

texts:
I would like to define something that font-locks a bit like a new sort of string-literal/comment.  I might write:

(font-lock-add-keywords 'emacs-lisp-mode
   (list '("<<.*>>" 0 'my-custom-face prepend)))

I'm using 'emacs-lisp-mode as my example just because it's an existing mode with syntax-table driven string literal and comment highlighting.
As per How to highlight specific keywords inside strings/quotes? the prepend above ensures that my new delimiters take precedence, so that

<<"foo" bar>>

font locks entirely with the new face.  I'm happy enough with that.  But I would like

; some comment text <<foo>>

to highlight with the comment colors, and for

"some string stuff <<foo>>"

to highlight entirely with string-literal colors.  Unfortunately, I get the custom face appearing within the literals and comments, which is distracting and arguably wrong (certainly, string literals and comments are mutually compatible).  How do I get the outermost delimiters to take precedence?

(Annoyingly, if I don't have the prepend, the syntax-table stuff takes precedence particularly dramatically: something like <<foo bar>> is fine, but <<"foo" bar>> has the "foo" in string literal colors, and doesn't color the delimiters or the bar at all.)


texts: Elisp-Function to always insert "*/" in C-Mode when "/*" was typed

texts:
I want to implement the functionality, that i wrote about in the title. Since searching the web for existing solutions didn't give me anything useful, i figured i would just try and implement it myself.

I would want to just add a lambda or function to my init.el-File, that executes everytime, it looks at an opening multi-line-comment and inserts that matching closing chars.
This is what i have so far:

(add-hook 'c-mode-hook
      (lambda ()
        (if (looking-at "/*")
            (insert "*/"))))

Probably not right at all. I just started with elisp a while ago, so help and explanation will be thankfully appreciated!
If there is an existing solution, i also wouldn't hesitate to try that out.
Is there an option to enable this in C-Mode, as well as in C++-Mode?
Thanks in advance!


texts: Regexp for distinguishing uppercase and lowercase not working

texts:
I've made the following command:

(defun search-backward-lowercase-alphabet ()
  (interactive)
  (search-backward-regexp "[a-z]"))

But when I run it at the end of a line like the following:

abcDEF

It just selects the last letter F, when I actually want to select the c. It doesn't distinguish between uppercase and lowercase at all. How can I fix this?


texts: What is the proper way to identify a font for .spacemacs file?

texts:
Spacemacs isn't finding my Source Code Pro font files, and I think it's a naming issue. I have the fonts installed and in the font cache,

/usr/local/share$ fc-list : file | grep source

Returns:

/usr/share/fonts/adobe-source-code-pro/SourceCodePro-Bold.otf:
/usr/share/fonts/adobe-source-code-pro/SourceCodePro-It.otf:
/usr/share/fonts/adobe-source-code-pro/SourceCodePro-BlackIt.otf:
/usr/share/fonts/adobe-source-code-pro/SourceCodePro-BoldIt.otf:
/usr/share/fonts/adobe-source-code-pro/SourceCodePro-Medium.otf:
/usr/share/fonts/adobe-source-code-pro/SourceCodePro-ExtraLight.otf:
/usr/share/fonts/adobe-source-code-pro/SourceCodePro-LightIt.otf:
/usr/share/fonts/adobe-source-code-pro/SourceCodePro-Semibold.otf:
/usr/share/fonts/adobe-source-code-pro/SourceCodePro-MediumIt.otf:
/usr/share/fonts/adobe-source-code-pro/SourceCodePro-Black.otf:
/usr/share/fonts/adobe-source-code-pro/SourceCodePro-Light.otf:
/usr/share/fonts/adobe-source-code-pro/SourceCodePro-SemiboldIt.otf:
/usr/share/fonts/adobe-source-code-pro/SourceCodePro-ExtraLightIt.otf:
/usr/share/fonts/adobe-source-code-pro/SourceCodePro-Regular.otf:

But every time I load up spacemacs it returns the error:

Cannot find any of the specified fonts (adobe-source-code-pro)! Font settings
  may not be correct.

In my .spacemacs file, I have

dotspacemacs-default-font '("adobe-source-code-pro"
                               :size 13
                               :weight normal
                               :width normal
                               :powerline-scale 1.1)

What can I change so that spacemacs will correctly find my fonts?


texts:
What's the best source of emacs release notes - especially for reading prior to installing an update?

I searched Google for "emacs release notes". There are some posts about specific releases (and some, like this about Emacs 25.1, are really good), but no definitive source.

There's another question on this site which discusses what's new in Emacs 25. The answers and comments there point to some source locations - are those generalizable?


texts: How to discover all available Emacs packages?

texts:
How can I discover all available packages of Emacs?

So far, I was under the impression that I could find almost anything through one of these means:

The Emacs Manual (C-h r)
M-x list-packages
C-h p

But it does not seem enough. As an example, I came upon rcirc (an IRC client) online. I could not find it in the above resources. Is it a built-in package? How can I know? Is there a place where all features are listed?


texts: command to mark a block comment as region

texts:
Is there an existing EMACS command to select a block comment? That is, I have

/**
 * A Comment
 */

I want to set the mark ahead of the /** and set the point after */.

I realize there are several ways it can be done, but I don't want to write code if there already is code.


texts:
Trying to figure out why find-file (C-x C-f) operations are taking a long time on Windows 10 with emacs 26.3. I tried to do profiling and got following results.

- command-execute                           74  84%
 - call-interactively                       74  84%
  - byte-code                               50  56%
   - read-extended-command                  33  37%
    - completing-read                       33  37%
     - completing-read-default              33  37%
      - read-from-minibuffer                26  29%
       + fci-redraw-frame                    3   3%
       + redisplay_internal (C function)     1   1%
       + linum-update-current                1   1%
   - find-file-read-args                    17  19%
    - read-file-name                        17  19%
     - read-file-name-default               17  19%
      - completing-read                     17  19%
       - completing-read-default            17  19%
        - read-from-minibuffer              12  13%
         + linum-update-current              3   3%
         + fci-redraw-frame                  3   3%
         + redisplay_internal (C function)   1   1%
  - funcall-interactively                   24  27%
   - find-file                              21  23%
    - pop-to-buffer-same-window             11  12%
     - pop-to-buffer                        11  12%
      - display-buffer                      11  12%
       - display-buffer-same-window         11  12%
        - window--display-buffer            11  12%
         - set-window-buffer                11  12%
          + linum-update-current             7   7%
          + fci-redraw-frame                 3   3%
          + linum-after-scroll               1   1%
    - find-file-noselect                    10  11%
     - find-file-noselect-1                  9  10%
      - after-find-file                      8   9%
       - normal-mode                         8   9%
        + run-hooks                          4   4%
        + set-auto-mode                      4   4%
      + normal-backup-enable-predicate       1   1%
     + find-buffer-visiting                  1   1%
   + execute-extended-command                3   3%
+ ...                                        8   9%
+ linum-update-current                       6   6%

However, I am not an expert in reading these reports. I am not exactly sure how to go from here. Can someone help?


texts: What's this gap between the right end of the mode-line and the fringe when changing font's size?

texts:
I'm toying around with font sizes in Emacs and I noticed that changing the font size to something huge, like, 160, creates a gap between the right end of the mode-line and the fringe:

This is the code I ran on my scratch buffer:

(let ((faces '(mode-line
               mode-line-buffer-id
               mode-line-emphasis
               mode-line-highlight
               mode-line-inactive)))
  (set-face-attribute 'default nil :height (* 16 10))
  (mapc (lambda (face) (set-face-attribute face nil :height (* 9 10))) faces))

Yes, I'm trying to keep the mode-line font size I currently use (900)


texts: use paredit key bindings with paredit-everywhere

texts:
How can I tell paredit-everywhere to use bindings from paredit,
so I can :

Use paredit's keybinding without having to redeclare them
Keep paredit-everywhere shortcuts the same as paredit if I change a shortcut in paredit

paredit-everywhere.el and paredit use mode-map to define keys.

A better way of formulate my question could be "how to use some paredit mode-map keys in paredit-everywhere mode-map when mode is paredit-everywhere)

I came across this manual page and came up with this:

(when (package-installed-p 'paredit-everywhere)
  (require 'paredit-everywhere)
  (eval-after-load 'paredit-everywhere
    '(progn (set-keymap-parent paredit-everywhere-mode-map paredit-mode-map)
        (define-key paredit-everywhere-mode-map (kbd "(") nil)
        (define-key paredit-everywhere-mode-map (kbd ")") nil)
        (define-key paredit-everywhere-mode-map (kbd "[") nil)
        (define-key paredit-everywhere-mode-map (kbd "]") nil)))
  (add-hook 'prog-mode-hook 'paredit-everywhere-mode))

which works (but is kinda-hacky) it make the paredit-everywhere-mode-map parent's paredit-mode-map and set the parenthesis, bracet open,close to nil to avoid the extra space added by paredit.

Do not hesitate to share if you have a better solution thus


texts: Looking for a theme that takes medical considerations into account

texts:
As the title suggests, I am interested in an emacs theme that has been specifically designed for the good of the 24/7 hard-working programmer's eyes.
Notice that this question is not opinion-based; I am asking whether someone has developed a theme that has taken the medical considerations into account and not the personal tastes. There are some articles on the internet that describe the colour schemes, colour contrasts etc. that are least damaging for the eyes.


texts: How to use web-mode to edit multiline HTML inside backticks?

texts:
I often work with Angular and Typescript, and I'm fond of putting my Angular templates directly into my Typescript files. The resulting code is essentially Javascript with HTML snippets in it, like this:

showModal() {
  return modalService.open({
    template: `

A heading

`,
    controller: ...
  });
}

I would love if web-mode could detect the HTML section and apply HTML syntax highlighting and indentation rules. But unfortunately, web-mode seems to treat everything inside the backticks as a simple string, so it doesn't work.

Back when I used to work with Coffeescript this sort of thing worked fine, but Coffeescript used a different delimiter for multiline strings (triple double-quotes I think).

Is there some way to configure web-mode to do the right thing here?


texts: How tell web-mode to use tidy syntaxchecker in flycheck?

texts:
I have tidy in my setup.

When I run HTML-mode as major mode in html file, I do flycheck-verify-setup and I get
tidy as syntax checker. the executable is also found.

When running web-mode as major mode, I do flycheck-verify-setup and I get
handlebars as syntax checker, which is not found.

I configured it then as

(setq flycheck-handlebars-executable "c:/Dropbox/Vim/vim74/tidy.exe").

Then it's running, verified with flycheck-verify-setup, but when I made intentionally flaws in my html file, I get no error reporting from flycheck, which is using Tidy.

So I assume I'm mistaken somewhere. But I have really no idea.

Any suggestion?


texts: org-babel not concatenating strings before sending to code block variable

texts:
I have just started using org-mode and org-babel as a lab notebook. I am trying to use a code block to fill in two columns of a table. The code block seems to work for the first column because those are the right numbers. However, when trying to concatenate a string to the file name in column three so the code blocks works on a different set of files it seems to just run the code block on the original files instead, which produces the same output as column one.

#+name: tRNAs
#+begin_src sh :var filename="" :results silent
cd Data/tRNA
grep -c ">" $filename
#+end_src

#+tblname: sequences
| # of Sequences before QC | # after QC | Original File name|
|--------------------------+------------+------------------|
|                   681865 |     681865 | read1            |
|                   324223 |     324223 | read2            |
|                  1014578 |    1014578 | read3            |
|                   971965 |     971965 | read4            |
|                   931777 |     931777 | read5            |
|                   810798 |     810798 | read6            |
|                   965134 |     965134 | read7            |
|                   718474 |     718474 | read8            |
|--------------------------+------------+------------------|
#+TBLFM: $1='(org-sbe tRNAs (filename (concat "\"" $3 "\"")))
#+TBLFM: $2='(org-sbe tRNAs (filename (concat "\"final_" $3 "\"")))


texts: Org capture datetree duplicanting entries (when using other locales)

texts:
I started using Emacs on Linux, now I moved to Mac OS and my problems began.

When I use org-capture to capture stuff to a datetree, it duplicates the day entry instead of just adding a new node under the existing day.

Example:

* 2019
** 2019-08
*** 2019-08-09 Sexta Feira
**** [2019-08-09 Sex 01:21] Entry 1
*** 2019-08-09 Sexta Feira
**** [2019-08-09 Sex 03:55] Entry 2
*** 2019-08-09 Sexta Feira
**** [2019-08-09 Sex 17:19] Entry 3

The 2019-08-09 Sexta Feira part is duplicated for every new entry on that same day.

I know what the problem is, BUT I DON'T KNOW HOW TO FIX IT. On Linux, the day appears as "sexta" (one word). On Mac OS, it's "Sexta Feira" (two words, without hyphen).

I could track things down to the org-datetree-find-day-create function. It uses a regex that ends with \w+, but it won't match a day with more than one word.

How can I fix it? My emacs knowledge is limited, so any help is welcome.


texts: delete-c-electric-paren deletes active region in CC mode with delete-selection-mode enabled

texts:
I've the delete-selection-mode enabled. In programming modes like Python and Lua, or in general modes like Fundamental or Text, when there's an active region, pressing ( rightly wraps the region with the parenthesis pair like ( region ). I understand that this behaviour is not special and the key ( is just bound to self-insert-command.

However, when I'm in CC mode the region is deleted and I see this (|), which is not the desired behaviour as there was an active region; this seems appropriate when there's no active region. Upon investigation I understand that disabling delete-selection-mode fixes the situation.

In CC mode, giving M-( does the job, however, I don't want to special case in my brain saying, for CC mode do M-( and for every other mode do (. I want a simple solution where I can just do ( and instead of deleting the selection, the active region should get wrapped.


texts:
Is there a way to show the number of items with a given tag(s) in a given subtree.

For example: I want the number of entries not in a done state

* Tasks (2)
  ** DONE done thing
  ** STARTED do thing
  ** TODO do another thing
  ** CANCELLED thing I don't have to do

Edit:
I know that you can you can use [/] to get TODO/TOTAL but I'm want the number of TODO not the total. Basically, I'm not interested in the total number of entries as it will increase infinitum. Alternatively, if it didn't include archive items that would work to

Stretch goal would be to adjust the colour of the number dependant on some range (i.e. 0-2 Green, 3-4, yellow, 5+ Red

Cheers


texts: Emacs - How "package management tool" got installed?

texts:
In emacs 24.5.1,

M-x package-list-packages

shows the list of packages.

My understanding is, below elisp code should be part of my .emacs,

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

I do not see/wrote any such elisp code in ~/.emacs or ~/.emacs.d/init.el

Question:

For given emacs, How to verify/troubleshoot, how package management tool(package) got installed?


texts: Issue with add-hook for web-mode and js2-mode when using ranger

texts:
I wanna add some hooks to web-mode and js2-mode, but it doesn't go well.

Here is what I am doing. I wanna to add header line for web-mode and js2-mode cuz they are derived from fundamental-mode. And I have to manually add these modes.

(which-function-mode)
;; when editing js file, this feature is very useful
;; (setq-default header-line-format
;;               '((which-func-mode ("" which-func-format " "))))

(defun set-header-line ()
  (setq header-line-format
        '((which-func-mode ("" which-func-format " ")))))
(add-hook 'prog-mode-hook 'set-header-line)
(add-hook 'text-mode-hook 'set-header-line)
(add-hook 'js2-mode-hook 'set-header-line)
(add-hook 'web-mode-hook 'set-header-line)

The reason why the header-line disappear is due to the ranger. It shows up when I open the file with dired or treemacs, but not for ranger.

Here is the header-line-format value opened with dired and ranger.

Dired:

Ranger:

I tried adding hooks to ranger-mode-load-hook and set ranger-modify-header to nil. Not working.

Does anyone have some ideas what's going on here?


texts:
In Emacs 24, the function system-name returns an FQDN.  In Emacs 25, system-name returns just the host name, and there doesn't seem to be a good way to get the FQDN.

How do I get an FQDN portably across Emacs versions?


texts: How to exit emacs with `q` when man inside emacs is opened

texts:
Default behavior of man <command> (opens inside less) when q is pressed it is closed.

I am using following to open MANPAGER with emacs:
emacsclient -nw -e "(let ((Man-notify-method 'bully)) (man \"$1\"))"
Here pressing q closes buffer but does not close the emacs like Ctrl-x Ctrl-c does. Is it possible to bind q into the same action Ctrl-x Ctrl-c to exit the emacs and get back to shell.


texts: Choose window to select when there are more than two visible

texts:
When I have four windows visible and I want to move from one to another, I use C-x o.  But that cycles through the windows in a predetermined order, namely:

1  3

2  4

Without intending to do so, just because my brain and fingers go on auto-pilot, I've fallen into the weird habit of using a combination of C-x 0, C-x 1, C-x 2, C-x 3, and bury-buffer (which I've bound to C-x c) to select the buffer I want while keeping them in a chosen order.

Is there a more direct way for me to move from window 1, say, to window 4?


texts: How can I specify max height and/or width of images displayed in eww?

texts: eww loads images at full size which consumes far too much space in some sites. How can I scale all images on a page (or all pages) so that they don't exceed a specified height or width?


texts: Can you install Emacs temporarily for testing purposes like new versions and packages?

texts:
Is there a way I can install two versions of Emacs on the same machine ?
The last time I tried installing versions 24 and 25 neither of the installations was working and the easiest solution was to reinstall the operating system. This is Ubuntu 18.04.

Virtual machine is a solution, of course, but I was wondering how you are dealing with such situations.

The reason for this is I want to try Spacemacs, Emacs26 and different packages without polluting my current setup.

Since my question "appears subjective", answers like "use the virtual machine" would be fine.


texts: Understanding Emacs macro and org mode tikz behavior

texts:
I found this discussion, and the last response gives this code:

#+TITLE: Test
#+AUTHOR: Blah
#+LATEX_CLASS: article
#+LATEX_CLASS_OPTIONS: [american]
#
# Setup tikz package for both LaTeX and HTML export:
#+LATEX_HEADER: \usepackage{tikz}
#+PROPERTY: header-args:latex+ :packages '(("" "tikz"))
#
#+PROPERTY: header-args:latex+ :exports results

* One Diamond

#+name: diamond
#+header: :file (by-backend (latex "diamond.tikz") (t "diamond.svg"))
#+begin_src latex :results raw file
  \begin{tikzpicture}
    \draw (1,0) -- (0,1) -- (-1,0) -- (0,-1) -- cycle;
    % \node at (0,0) {\(x_i\)};
  \end{tikzpicture}
#+end_src

#+caption: A diamond.
#+attr_latex: :float t :width ""
#+results: diamond

* COMMENT setup

#+name: setup
#+begin_src emacs-lisp :results silent :exports none
  ;; (setq org-babel-latex-htlatex "htlatex")
  (defmacro by-backend (&rest body)
    `(case (if (boundp 'backend) (org-export-backend-name backend) nil) ,@body))
#+end_src

# Local variables:
# eval: (org-sbe "setup")
# End:

First, the local variable call to elisp block setup doesn't seem to work. But then I don't really understand what by-backend is doing. Where can I learn about such a macro and why is it used in this situation? Also, why is so much placed in the org-mode header, i.e., what exactly are these doing?

#+LATEX_CLASS: article
#+LATEX_CLASS_OPTIONS: [american]
#
# Setup tikz package for both LaTeX and HTML export:
#+LATEX_HEADER: \usepackage{tikz}
#+PROPERTY: header-args:latex+ :packages '(("" "tikz"))
#

I've seen TikZ code like this:

\documentclass[tikz, margin=3mm]{standalone}

and org-mode doesn't seem to like it. Where and how would it be utilized? Basically, I'm trying to put together a comprehensive tutorial on TikZ in org-mode. I'm seeing lots of one-off tunneling. Need a good tutorial, I'd say. . . .


texts: Define an emacs function to take arguments in the same way as something like M-x goto-line

texts:
I want to write an emacs function for debug purposes in c++ code. Basically I'm fed up typing the following:

std::cout << "variable is: " << variable << std::endl;

Instead I want to define an emacs function called say "td" for temp debug such that I do

M-x td RETURN
foo

And it will print

std::cout << "foo is: " << foo << std::endl;

I want it to behave like M-x goto-line whereby I type M-x goto-line and press enter then it prompts me for an input, in my case I want my input to be the variable name and something like td instead of goto-line.

Open to other suggestions, but I'd like to know how to code this type of function for future reference anyway.


texts: org-mode: Is there a description markup like in LaTeX?

texts:
In org-mode, is there a markup like LaTeX's description?

\begin{description}
  \item[First] The first item
  \item[Second] The second item
  \item[Third] The third etc \ldots
\end{description}

Result:

Please note that the items are in bold face. and if the description is longer than one line, the second line (and the following line) would be indented right.


texts: How to define a yasnippet whose content depends on the value of an Elisp variable?

texts:
I want to define a yasnippet for shell-script mode that would insert a chunk of text whose content depends on the setting of the sh-shell variable.

Since the possible different text insertions are several lines long, and are quite different from each other, so doing this with conditional fields of the form

${N:`(case sh-shell (zsh  "foo")
                    (bash "bar")
                    (sh   "baz")
                    (t    "frobozz"))`}

...would all but eliminate the convenient formatting one this sort of template for.

EDIT: To clarify: the code above is not useful to me, because I need to insert multi-line formatted text, not little, one-word strings like "foo", "bar", etc.

If I were to use an unholy mix of Elisp and bash to represent what I'm looking for, this is how I'd represent it:

`(case sh-shell (zsh <<EOZSH)
zsh version
    of
    snippet
    looks
    like
    this
EOZSH
                   (bash <<EOBASH)
bash version of snippet looks like this
EOZSH
                   (sh   <<EOSH)
sh
 version
  of
   snippet
    looks
     like
      this
EOSH
                   (t    <<EODEFAULT)
default version
  of snippet
    looks
    like
    this
EOSH
)`

IOW, the snippet would consist of a single embedded Elisp case expression, where the key of each key-value pair is a possible value of sh-shell, and the value is a (formatted) snippet/template; I've represented the latter using (totally invalid) heredoc notation.

Is there a (syntactically sound) way to implement this idea?


texts:
I want a "default directory" which is constant across all contexts
(buffers, packages, etc).  That is, when working on multiple files,
opening a new terminal, doing anything which requires a starting
directory, I want that starting directory to always be the same.

How can I set a global default directory without having to write an arbitrary number of wrapper functions?

To illustrate the problem, suppose my project has the following
structure:

.
└───my-project
    │   bar.py
    │   foo.py
    │
    └───tests
            test_bar.py
            test_foo.py

If I'm working on test_foo.py and I do find-file (C-x C-f) to
open foo.py, the prompt will start at my-project/tests.  I have to
go up a level.  Now suppose I'm editing foo.py and I want to look at
test_bar.py.  When I do find-file within the foo.py buffer, the
prompt will be at my-project.  I need to navigate to
tests.  Similar things happen when using eshell and other
applications which have a default directory.

According to this, this, and this, the starting directory is handled
by default-directory.  They all indicate that to change the starting
directory, you need to do something like,

(setq default-directory "/my/default/path")

or

(cd "/my/default/path")

The trouble is, default-directory is buffer local.  You need to constantly re-assign default-directory.

In the case of find-file, I overcome this by creating a wrapper
which changes the directory to the default before calling find-file.  I then reassign the keybinding:

(defun my-set-global-default-directory (new-default-directory)
  "Set my-global-default-directory to NEW-DEFAULT-DIRECTORY."
  (interactive "DNew global default directory: ")
  (setq my-global-default-directory new-default-directory))

(defun my-find-file ()
  (interactive)
  (cd my-global-default-directory)
  (call-interactively 'find-file))

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

This works for find-file, but for this to work universally, I would
need to manually wrap any function that uses default-directory!


texts: Changing default font size in org latex export

texts:
Org exports latex with default font size of 11 pts. Is it possible to make this font size to 10 pts and also reduce spacing to one and half space ?
Regards