texts:
I am a long term eclipse CDT user migrating to emacs (ver. 23.3.1), because I have to work on a large C codebase accessible only through a telnet/ssh shell. After going through several online guides, I have managed to get emacs work with cscope on the code. I have some minor issues with it (see below), I am asking it as a single question as I think they are very basic questions which any expert might know. If you feel they need to be split into multiple questions, please let me know

For navigating the cscope buffer, there are commands available to jump to next and previous symbol (C-c s n, C-c s p). I am not able to find a command to open the file where the cursor is currently set. What I do currently is move the cursor to the previous symbol and do a C-c s n to open the file. This feels very unnatural, there should be a command to jump to current symbol
Similar to cscope-find-global-definition, is there any command to jump to local definition. Sometimes while reading huge functions, it is helpful to quickly jump back to the definition of the variable. I understand this can be achieved by backward I-search, but it would be helpful to have a quick way to jump to definition.
I created a cscope database using the command cscope -b -R -q, but emacs was returning 0 results for every lookup. Then I added (setq cscope-do-not-update-database t) to my .emacs and it started working. I looked into the description of the variable and it says that if the variable is non-nil it will never check/update the cscope database. How did setting it to True made my cscope to work. From the description I would have expected the opposite. What is that variable doing?


texts: What is the difference between --load vs --script options?

texts:
man emacs:

--script file
    Run file as an Emacs Lisp script.
-l file, --load file
    Load the lisp code in the file file.

I think that --load uses usual convention to boot from compiled file version firstly and --script does not. But I am unsure...


texts: Why is my "repeat last action" (dot) operator is not working?

texts:
I'm a vim user moving to emacs evil.

I just added this line to my .init.el file and it broke my dot functionality.

(define-key evil-insert-state-map (kbd "TAB") 'evil-force-normal-state)

Why? I'm not even sure what to search for to start debugging this.

Here's my whole init.el file:

(require 'package)

(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/"))
(add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
(add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/"))

(setq package-enable-at-startup nil)
(package-initialize)

(global-linum-mode 1)

(require 'evil)
(evil-mode t)

;;;; Keymappings
(with-eval-after-load 'evil-maps
  (define-key evil-motion-state-map (kbd ":") 'evil-repeat-find-char)
  (define-key evil-motion-state-map (kbd ";") 'evil-ex))
  (define-key evil-insert-state-map (kbd "TAB") 'evil-force-normal-state))

If I don't comment out that line, the . in normal mode just deletes the current line as if I'm doing a dd. I tried adding stuff to the end of a line then repeating it on a few lines with .. All I got was fewer lines!


texts:
In my django project I use basic .html files for my templates.

I want to force the django engine from web-mode.el so I don't have to constantly change between .html and .djhtml.

I've tried the following

(setq web-mode-engines-alist
      '(("django"    . "\\.html\\'"))
      )

with no luck.

Anyone had any success in this? Should I try out a different plugin?


texts: Is there any difference between '(let (var) ...)' and '(let ((var nil)) ...)'?

texts: I've seen both  (let (var) ...) and (let ((var nil)) ...) is there any difference between these statements?


texts: Multiple header lines for different modes?

texts: I would like to use both tabbar-mode and global-semantic-stickyfunc-mode at the same time.  Both of these use a header line.  When I try to enable them both, one of them "wins" and I don't get the other.  Is it possible to get them to both work at the same time?


texts:
Windows 10, Emacs 26.1

I need the archive tool that in dired mode that can:

work with many archive: zip, 7z, gzip and so on
create archive from selected files  in dired mode and folders (with subfolders)
edit files INSIDE exist archive
copy/move files from selected files in dired  mode to EXIST archive
extract archive to desire path
view files inside archive
delete selected files/folders from archive

Can you advise me some archive tool?


texts: change warning time on a per appointment basis

texts:
I use appt to remind me of my upcoming appointments (which I keep in an org-mode file).  Under this setup, my computer beeps five minutes before the beginning of the next appointment (see setup here).

Is there a way change the warning time on a per-appointment basis? (e.g., if I have a meeting in a different building I would like to set up a 20-minute warning; for most other meetings, a 5-minute warning is fine).

I imagine nice solutions to this would be:

Including the warning time in the org-mode timestamp (e.g., <2016-07-12 Tue 16:15-20> would mean beep 20 minutes before the meeting), or
Associating a tag to a given warning time (e.g., items tagged :far: would beep 20 minutes before the meeting).

Any ideas on how to accomplish something like this?


texts:
Org-ref provides excellent bibliographic tools for authoring within org documents. However, one issue I've had is the mouseover timer for citation links appears to be set to zero seconds. That is, whenever the mouse pointer passes over a citation link, no matter how quickly, the link information is opened in a helm buffer at the bottom of the frame and persists until I click somewhere in the org buffer.

Is there a way to set this timer such that it only opens the additional helm buffer only when the mouse hovers over the citation for a specified duration, e.g. one second?

I could not find a mouseover timer setting in the org-ref documentation or customization. I'm not even sure if this is caused by org-ref, org, helm, or emacs.


texts: How can I build a regexp insensitive to case?

texts:
I have a bunch of keywords:

set
write
quit

which each can be shortened down to one letter:

s se set
w wr wri writ write
q qu qui quit

Further, these keywords are case-insensitive, so the following are added to the mix:

s S se sE Se SE ...
w W wr wR Wr WR ...
q Q qu qU Qu QU ...

Given a list of the basic keywords ("set" "write" "quit"), how can I create a regular expression that will match them as I describe?

I've approached it by providing a list to regexp-opt, but the case-insensitivity list is proving hard to write.  Here is what I have so far:

(defun mumps--command-variants (command &optional stack)
  "Returns the possible abbreviations of COMMAND.
For example, input of \"set\" would yield the list
  \(\"s\" \"se\" \"set\")"
  (let ((case-insensitive-command-list
         (mumps--case-insensitize command))))
  (if (= 1 (length command))
      (cons command stack)
    (mumps--command-variants
     (substring command 0 (1- (length command)))
     (cons command stack))))

Note on use-case

This is going to be used to create font-lock keywords for a major mode for editing MUMPS code.  MUMPS is an... interesting language: command names are case-insensitive (and can be abbreviated like this), but everything else in the language is case-sensitive (and cannot be abbreviated).  Furthermore, there is no syntactical difference between a expression which uses a command and that which uses a function (a subroutine of commands), but one is case-insensitive/abbreviated and the other is not.


texts: remove erroneous commands from ESS transcript

texts:
I'd like to better use my ESS transcript file while working on R.
I know how to clean the .Rout file only keeping the command lines.
But what could be great is to remove all the command lines that generated errors. Is there already a way to do this?
The other way would be to run a command, which selects from the < prompt followed by an Error on the following line and down to the next < prompt. I admit I'm not strong enough in lisp to do such a thing.


texts: How to get rid of the auto folder with .el files?

texts:
I'm using Emacs 25.1, and I use it primarily for LaTeX with AucTeX. Some time ago in the directories of my .tex files, there started to appear a folder named "auto" with .el files in it. The .el files look like this:

(TeX-add-style-hook
 "nameoffile"
 (lambda ()
   (TeX-add-to-alist 'LaTeX-provided-class-options
                     '(("article" "11pt")))
   (TeX-run-style-hooks
    "latex2e"
    "article"
    "art11"
    "amsmath"
    "amssymb")
   (TeX-add-symbols
    "R"
    "Z")
 :latex)

EDIT: So I found out that this is probably triggered by enabling parse on save. Is there a way to stop automatically generating these files?


texts: Performantly filter against a custom time-like property

texts:
My agenda view processes many items with SCHEDULED and DEADLINE fields, and fully generates from scratch in about 0.3s. However, if I append CUSTOM_SCHEDULED<"<now>" to my agenda view definition, the same view takes 2.1s to generate. How can I add a custom time-like property in a way that does not wreck the performance of the view?

Profiler excerpt:

- org-tags-view                                  904  97%
 - org-scan-tags                                 888  95%
  - #<lambda 0x5be5aafca262231>                  838  90%
   - and                                         838  90%
    - progn                                      838  90%
     - or                                        837  90%
      - and                                      835  89%
       - not                                     835  89%
        - org-time<                              833  89%
         - or                                    831  89%
          - org-cached-entry-get                 831  89%
           - org-entry-properties                822  88%

As you can see, there is an explicit org-time< call that is causing the slowdown. What's interesting is that SCHEDULED and DEADLINE properties appear to use some other mechanism, since they do not cause the same hot loop in org-time<.


texts:
I want to advise org-edit-special so that a function runs before Emacs enters org-src-mode. I am not particularly tied to org-edit-special. If there is a hook like org-src-mode-hook (but that triggers before org-src-mode runs, that would be perfect.

So I have the following code:

#+BEGIN_SRC emacs-lisp

(defun my-function ()
  (message "bingo!"))

(add-function :before (org-edit-special) #'(lambda () (my-function)))

#+END_SRC

When I C-c C-c this block, I get user-error: No special environment to edit here. Can you see the mistake?


texts: How to invoke Emacs from MS DOS prompt with a function with argument?

texts:
Inspired by the question Launch emacs with ediff-files (of ediff-directories) from command line and the answer https://emacs.stackexchange.com/a/3623/2609, I tried

emacs --eval '(set-background-color "green")'

from an MS DOS prompt without sucess. What is wrong with this? I also tried with the argument -Q but it doesn't change.
I should mention that it works well if I execute it from an eshell inside emacs.


texts: Fetch configuration from remote (e.g. Github) at startup

texts:
I have to work on multiple different machines and it would be nice to keep my .emacs file consistent everywhere.

Question: is there a package which allows to update the file at startup from a remote  location such as github or via ssh?


texts: Cannot figure out why vc-git.elc is always loaded on startup

texts:
This is more a curiosity, than a necessity.
I'm playing around with startup times, and to have something to compare with, I wanted to see how fast emacs could start up pure.
Running emacs -Q, emacs-init-time reported 0.3~ secs on average.
With a blank config, I installed esup (Emacs Start Up Profiler), and the init.el file became:
(add-to-list 'load-path "~/.emacs.d/packages/esup-0.7")
(require 'esup)

To test it out, I launched emacs normally, and ran esup.

Huh, look that. vc-git is loaded.
Curious on how low the start up time can get, I try to disable it.
And so it begins.

To disable VC entirely, set the customizable variable vc-handled-backends to nil
https://www.gnu.org/software/emacs/manual/html_node/emacs/Version-Control.html

I insert (setq-default vc-handled-backends nil) into init.el
Still being loaded.
Perhaps removing the vc entry it from load-path does the trick.
So I also add (delete "/usr/share/emacs/27.1/lisp/vc" load-path) to the config.
Still being loaded. Challenge accepted.
I try to add (add-to-list 'load-path "~/.emacs.d/overwrites") to the newly supported early-init.el config file, and add a dummy vc-git.el file into the folder specified, containing just (provide 'vc-git)
Still being loaded. Same if I move the line from early-init.el to init.el.
No effect by adding (setq-default load-suffixes '(".el")) either.
Seeing no other way to prevent it from loading, I try the nuclear option of moving the offending file /usr/share/emacs/27.1/lisp/vc/vc-git.elc temporarily.
Finally it does not load.
So it is possible.
Now I'm just wondering if it is possible without going nuclear.
For science (and negible reduced startup time)


texts: How to activate Coq for Org source blocks?

texts:
I have been writing some Coq code in Org, but when I try to run a source block, I get the following message:

No org-babel-execute function for coq!

I have tried to initialize the coq language in the org-babel-load-languages variable, but coq isn't an option on the list.

Is there anyway of running coq src blocks outside of the temporary buffer? My overall goal is to be able to define terms in one block and reference them in another, which activating the language should hopefully let me do (I think).


texts: How can I insert a new top level TODO below the current subtree in org-mode without moving the cursor?

texts:
To insert a new TODO in org-mode, I currently move my cursor to the end of the current line and use the M-S-<RET> shortcut. If I am within a subtree, I also have to go to the end of the last tree item.

I was wondering if it is possible to create a shortcut which appends a new top-level TODO (i.e., a single *) below whatever subtree the cursor is in. Eliminating the cursor movements would be very helpful to me while brainstorming and quickly capturing thoughts.


texts: How to get org-mode fully support Arabic language for export?

texts:
My intention is to write Arabic document using org-mode. Please consider the following MWE, given that my configuration in init.el has below code to enable writing of Arabic script from right to left (rtl) instead of left to right (ltr) default behavior:

;; for right-to-left direction in org-mode
(defun set-bidi-env ()
  "interactive"
  (setq bidi-paragraph-direction 'nil))
(add-hook 'org-mode-hook 'set-bidi-env)

MWE.org buffer

# -*- mode: org -*-
#+OPTIONS: toc:1
#+LANGUAGE: ar
#+CREATOR: Emacs 25.1.50.2 (Org mode 8.3.4)

* تعريف بالارقام الهندية او الشرقية ١، ٢، ٣
* هذه النقطة الان باللغة العربية

* ما هو الحل؟
* النهاية

* Introducing Hindi or estern numbers 1, 2, 3

* This point now in Arabic

* How to solve it?

* The end.

The last four points in English are translation of the first four bullets in Arabic. So now if I export it to HTML format by hitting C-c C-e h o I get this output:

Issues

Table of Contents was not translated into Arabic as would be normally expected when language was set to ar. How to make org-mode aware of these Arabic equivalents of any document structure, e.g. TOC, chapter, figure, table, etc.

Update
This now is fixed. I updated the ox.el:

(org-export-smart-quotes-alist): add "ar" to the list

(org-export-dictionary): add Arabic equivalents to template keywords

so I would put only the relevant code to table of contents which is enough for the current MWE:

("Table of Contents"
 ("ar" :default "قائمة المحتويات")

List numbers were in Arabic format 1,2,3 (yeah very counter-intuitive I know but bear with me please), while I wanted to appear in Hindi (see 1st list bullet in the output image). I want Hindi in Arabic language instead of 1, 2, 3 numbers. This applies to table of content also. How to achieve this customization?

Update
These are the hindi equivalent for arabic digits:

                 ("0" "\u0660")
                 ("1" "\u0661")
                 ("2" "\u0662")
                 ("3" "\u0663")
                 ("4" "\u0664")
                 ("5" "\u0665")
                 ("6" "\u0666")
                 ("7" "\u0667")
                 ("8" "\u0668")
                 ("9" "\u0669")

I hope this would come in handy to get it exported in case of Arabic language.

Finally, as you can see in the output, the direction of the first four list items were from left to right not like what is expected in Arabic language from right to left. How to change direction depending on the context of script used (Arabic/English)?

Your help would be much appreciated.


texts: Conditional CIDER breakpoint not working in recursive functions

texts:
I'm using CIDER for Clojure programming. I've been playing around with the CIDER debugger lately. I wanted to use the conditional breakpoint facility with some simple recursive function, such as factorial, so I got the following:

(defn factorial [n]
  #dbg ^{:break/when (< n 3)}(if (zero? n)
    1
    (* n (factorial (dec n)))))

It works correctly when I directly supply an argument that meets the requirement upon first function call, but apparently it does not work upon recursive function calls. So if I run e.g. (factorial 10), the execution never stops at the breakpoint. Is this a known limitation of the CIDER debugger, like some tricky way in which it instruments the code? More importantly, is there any way to make it work with recursive functions?


texts: How do I use Emacs as a feedly.com client?

texts:
Q: How do I use feedly.com as an RSS feed source in Emacs 24.4?

I've searched sporadically for months. I haven't found anything to even point me in the right direction to get started.

I've opened a ticket with Feedly as well.

Context

While not required for the question at hand, if you're interested please see my blog post. It provides additional information as well as my end game.

Update 2015-02-17

I updated the title according to the suggestion in the comments. My intent is for Emacs to fill the role Reeder and Readkit perform on OS X as well as on Gnu/Linux and MS Windows, where no analog resides.


texts: How should I change my workflow when moving from IDO to Helm

texts:
As an Emacs newbie, I found IDO and loved it since it made searching for files so much quicker. After spending some time on this site, I've read more and more about Helm and I'm planning on making the switch. Some of my questions are:

What are the biggest differences?
Specifically, how should my workflow change when finding files, switching buffers, or calling new commands?

I used this post to set up Helm, but my file searches (C-x C-f) and buffer switches (C-x b) look pretty much the same as they did before.

Here is my config:

(require 'helm)
(require 'helm-config)

;; The default "C-x c" is quite close to "C-x C-c", which quits Emacs.
;; Changed to "C-c h". Note: We must set "C-c h" globally, because we
;; cannot change `helm-command-prefix-key' once `helm-config' is loaded.
(global-set-key (kbd "C-c h") 'helm-command-prefix)
(global-unset-key (kbd "C-x c"))

(define-key helm-map (kbd "<tab>") 'helm-execute-persistent-action) ; rebihnd tab to do persistent action
(define-key helm-map (kbd "C-i") 'helm-execute-persistent-action) ; make TAB works in terminal
(define-key helm-map (kbd "C-z")  'helm-select-action) ; list actions using C-z

(when (executable-find "curl")
  (setq helm-google-suggest-use-curl-p t))

(setq helm-quick-update                     t ; do not display invisible candidates
      helm-split-window-in-side-p           t ; open helm buffer inside current window, not occupy whole other window
      helm-buffers-fuzzy-matching           t ; fuzzy matching buffer names when non--nil
      helm-move-to-line-cycle-in-source     t ; move to end or beginning of source when reaching top or bottom of source.
      helm-ff-search-library-in-sexp        t ; search for library in `require' and `declare-function' sexp.
      helm-scroll-amount                    8 ; scroll 8 lines other window using M-<next>/M-<prior>
      helm-ff-file-name-history-use-recentf t)

(helm-mode 1)


texts: How to perform a search for a string inside math environments in a tex/latex document

texts:
I have a long tex document and I would like to perform a search for finding some string inside math environments. Is there a search function already provided by auctex to do this? Other solutions are welcomed.

(I found https://stackoverflow.com/questions/19845598/emacs-regex-replacing-a-string-inside-a-latex-equation on a similar topic for replacing a string inside math environments).


texts:
I have this function in config

(defun launch-separate-emacs-under-x ()
  (interactive)
  (call-process "sh" nil nil nil "-c" "emacs &"))

(defun restart-emacs ()
  (interactive)
  (add-hook 'kill-emacs-hook
            (if (display-graphic-p)
                #'launch-separate-emacs-under-x
              #'launch-separate-emacs-in-terminal)
            t)
  (kill-emacs))

Update:

In general if i execute any command say package-install it will be added to command history. But when I execute above function using M-x, it is not getting added into commands history. How to make emacs to add this command to history?


texts: Is there a function like `assoc` that returns all matching values?

texts:
The assoc KEY LIST function returns the first element of an alist whose car is equal to KEY.

Is there a built-in Emacs Lisp function which returns all elements of the alist whose cars are equal to KEY, as a sub-alist, or list of values? After all, there is no requirement that an alist have unique keys.

That is,

(assoc foo '((foo . 5) (bar . 6) (foo . 7))) = '(foo . 5)

But,

(assoc-all foo '((foo . 5) (bar . 6) (foo . 7))) = '((foo . 5) (foo . 7))


texts: Eshell doesn't reuse TRAMP connection for remote subprocesses

texts:
I was trying to operate on remote host using eshell and was disappointed to discover that majority of operations would hang emacs for several seconds.

I found it surprising considering that normally eshell executes subprocesses asynchronously and upon further investigation found that eshell reopens TRAMP connections for any external command.

Below is sequence of commands which I pass eshell buffer:

~ $ cd /ssh:aws:
/ssh:aws:/home/ubuntu $ ps
  PID TTY          TIME CMD
12212 pts/3    00:00:00 ps
/ssh:aws:/home/ubuntu $

And messages which indicate that eshell opens connection several times:

Tramp: Opening connection for aws using ssh...
Tramp: Sending command `exec ssh   -o ControlPath=/tmp/tramp.32766gT7.%r@%h:%p -o ControlMaster=auto -o ControlPersist=no -e none aws'
Tramp: Waiting for prompts from remote shell...done
Tramp: Found remote shell prompt on `aws'
Tramp: Opening connection for aws using ssh...done
Tramp: Opening connection for aws using ssh...
Tramp: Sending command `exec ssh -q   -o ControlPath=/tmp/tramp.32766gT7.%r@%h:%p -o ControlMaster=auto -o ControlPersist=no -e none aws'
Tramp: Waiting for prompts from remote shell...done
Tramp: Found remote shell prompt on `aws'
Tramp: Opening connection for aws using ssh...done

Is it a limitation of eshell that it needs to spawn new shell every invocation of non-builtin command or could I make it use TRAMP shell which, judging by list-processes, appears to persist since I first navigated to a path handled by TRAMP?


texts: Jump to location in org-mode while properly unfolding headings

texts:
I'd like to find a way to jump to a location in an org-mode file while automatically unfolding only the heading at the location I'm jumping to and all its parent headings (but not any sibling headings).

For example, if I have this org-mode file:

* A
** AA
*** AAA
** AB
*** ABA
* B
** BA
*** BAA
** BB
*** BBA
* C
** CA
*** CAA
** CB
*** CBA

and I use evil-set-marker to mark the location at BBA, and then fold up all the headings, the file will now be displayed in org-mode as:

* A...
* B...
* C...

and if I now evil-goto-mark with the intention of going back to BBA, emacs will only place point on B without unfolding any of the headings, so the way the file is displayed remains unchanged.

Instead, I'd like emacs to unfold just BBA and all of its parent headings (but no sibling headings) like so:

* A...
* B
** BA...
** BB
*** BBA
* C...

and place point on the exact location I marked at BBA.


texts:
I use mmm-mode in order to add python code in LaTeX. So i have something like this in my emacs config:

(use-package mmm-mode
  :ensure t
  :config
    (mmm-add-group 'latex-python
           '((latex-python-envs
            :submode python-mode
            :face mmm-default-submode-face
            :front "\\\\begin{\\(pycode\\|pyverbatim\\)}.*\n"
            :back "\\\\end{~1}\n"
            :save-matches 1)

       (latex-python-cmds
        :submode python-mode
        :face mmm-default-submode-face
        :front "\\\\pyc?{"
        :back "}")))
    (setq mmm-global-mode 'maybe)
    (mmm-add-mode-ext-class 'latex-mode nil 'latex-python))

It works, namely the python code is highlighted and formatted in the block between begin{pycode} end{pycode}

However, flyspell does not recognize the python mode in the block, so it thinks that errors are almost everywhere. The code is highlighted as erroneous. How to tell flyspell that the block has python code?


texts: How to run a process without Emacs freezing?

texts: When editing TeX files, programming, upgrading packages, etc. we often need to perform tasks - such as compiling code or downloading files from internet - that take a long time to achieve. We can do all of them in Emacs, however executing such commands freezes the session: is there a way to execute heavy commands in the background, for example using another thread ?


texts: Searching all installed mode maps for a specific keybinding

texts:
When deciding on which keybinding I want for a specific command, it would be very nice to know if any of my installed mode maps (global, major and minor) have already used this keybinding for some command, and if so, what command.

I have looked at helm-descbinds, but it only searches in the currently active modes rather than all of them.

Is there a way to search all of the modes, regardless if they are active?


texts: Size of process output sent to filter functions

texts:
I'm using comint to communicate with a REPL.

From time to time the REPL sends large amounts of data. This causes a significant lag (about one second), because my filter function gets called on a bunch of small strings, instead of fewer, larger strings. (even with a fast filter function, parsing 1MB of output still ends up taking 0.001 ms per filter call, times 1000 = 1s).

Is there a way to get emacs to package the output into larger chunks? process-adaptive-read-buffering is already set to t.

The manual says:

  The output to the filter may come in chunks of any size. A program that produces the same output twice in a row may send it as one batch of 200 characters one time, and five batches of 40 characters the next. If the filter looks for certain text strings in the subprocess output, make sure to handle the case where one of these strings is split across two or more batches of output; one way to do this is to insert the received text into a temporary buffer, which can then be searched.


texts: How select and kill desire many buffers in ido mode?

texts:
Emacs 26.1. ido, smex

If I want to kill one buffer I use command C-x k

Here result:

As result I can kill ONE desire buffer.
But suppose I need to kill the next buffers:

build.gradle, approfile.json, cascade.update.txt

How I can do this quickly?


texts: Org-mode define face for pandoc citation syntax

texts:
I would like to set a new face in org-mode for pandoc citation syntax which looks like this:

[@bibtexkey{555-563}]

Custom face:

(defface pandoc-citation-face
  '((t :foreground "yellow"))
  "Face for pandoc citation syntax")

None of the attempts below worked:

(font-lock-add-keywords 'org-mode
      '(("\[@.+?\]" . pandoc-citation-face)))

(defun org-add-my-extra-markup ()
  (add-to-list 'org-font-lock-extra-keywords
               `(("\[@.+?\]" . pandoc-citation-face))))

(add-hook 'org-font-lock-set-keywords-hook #'org-add-my-extra-markup)

(defun org-add-my-extra-markup ()
  (add-to-list 'org-font-lock-extra-keywords
               `(,(rx (group "[@")
                      (group (+? anything))
                      (group "]"))
                 (2 '(face pandoc-citation)))))

(add-hook 'org-font-lock-set-keywords-hook #'org-add-my-extra-markup)


texts: Org Mode Babel - ensure more than one empty line between tangled code blocks (for python)

texts:
Suppose I have two code blocks in my org file

#+BEGIN_SRC python :tangle ~/dummy.py
class A:
    pass
#+END_SRC

#+BEGIN_SRC python :tangle ~/dummy.py
class B:
   pass
#+END_SRC

After org-babel-tangle I get a file dummy.py containing two classes separated by one empty line. However, according to pep8 there should be two empty lines between class definitions so as a result I receive a warning message in my editor.

How can I ensure more than one empty line between (selected) code blocks?

PS. I know the :padline argument. I wish there was an option :padline 2 meaning: precede a block using two empty lines.


texts: Background color of LaTeX fragments in Org mode

texts:
How can I control the background color of my LaTex fragments in Org-mode?

I am using the badwolf-theme package, and this is what I get:

I would like the background color of my formulas to match the background color of my org buffer.

Here are my current org-format-latex-options:


texts: org-mode use output of source block in other source block header

texts:
Is it possible to use the result of one source code block not within another code block but actually within another source blocks header argument? I know this piece of functionality works

#+name: block-1
#+BEGIN_SRC emacs-lisp
(current-time-string)
#+END_SRC

#+BEGIN_SRC emacs-lisp :var input=block-1
(format "We got %S in block-1" input)
#+END_SRC

but what I want is something like this, i.e. to reuse the result to e.g. form a path for the dir header argument

#+name: block-1
#+BEGIN_SRC emacs-lisp
(current-time-string)
#+END_SRC

#+BEGIN_SRC emacs-lisp :var input=block-1 :dir path/input
(format "We got %S in block-1" input)
#+END_SRC

so what I want to achieve is to have a variable path for the :dir header argument.

maybe there is a way to concatenate the argument to :dir in a dynamic way depending on what the first source block resulted in?


texts: " is undefined" error on space key press

texts:
I'm running Emacs 26.1 without any "strange" configuration: a bare bone Ubuntu 19.04 emacs package with few packages installed from elpa or melpa.  I have the following issue: when pressing space bar I get <Hangul> is undefined error. This doesn't happen all the time, yet really often and in all modes I could try. *Messages* doesn't help as the same message is printed. I already had this issue with version 24.5.1 but I thought it was due to some outdated package.

This is really painful as you can't keep pressing space to repeat the (space) input and even worst, you can't define a macro with C-x ( with spaces as the error cancels macro definition.


texts: How can I consider an unfinished clock in clock table

texts:
I want to use org clocks to clock my time at work, I finish after 7:30 of clocked time every day.

I want to know what would be my total clocked time if I stopped the time right now, but the last clock is ignored in the org-clock-table.


texts: Face of org-mode source block changes when returning from edit buffer

texts:
A strange thing happens when editing source blocks within an extra buffer with C-c ': the face of just this source block changes upon returning, i.e. the face settings are not used any more.

I'm using Emacs 25.1 with org-mode 8.2.10.

What could be causing this?


texts: Emacs doesn't display color fonts at all

texts: I tried to add Noto Color Emoji from Google Noto as my font for Emoji in GNU Emacs, as mentioned in here, but for some reason GNU Emacs doesn't display these characters properly in its window. I'm using GNU Emacs 24.5.1 on GNU/Linux. Is this a bug or am I doing something wrong?


texts: Including a header-section to text-file?

texts:
I'm occasionally writing fanfiction-stories as plain-text files in emacs.  It would be great if emacs could add a "header-section" in the beginning of these documents, for example:

Title:
Author:
Chapter:
Series:
Rating:
Email:

Some fields - like Author and Email - could obviously be pre-filled...

How could something like this be accomplished in emacs?

What would be the best way of doing it?  Would it be an idea to make a new major-mode - based on text-mode - called fanfic?  Or perhaps a new minor-mode (called fanfic) to be used with the text-major-mode?  A major/minor-mode could perhaps also set-up a few other things - like fly-spell-mode, auto-fill-mode and a suitable page-width...

For completeness, I'd like to know how such a standard header could be added for:

All new files created with emacs (just curious...)
All files of a certain type - eg. all .txt-files.  (I guess it could be bound to the file-type (.txt) and/or the text-mode in emacs)
Files created with a customized major/minor-mode

I've used emacs for a several years, but haven't really dived into customization or elisp much...  (why mess with perfection?  ;-)


texts: Is there a way to make auto-complete aware of user defined variables

texts:
I am using spacemacs with racket-mode, company-mode, and scheme-complete, to code in racket, and its pretty efficient.  But, in order to have completion for user defined variables and functions, I have to press tab to activate scheme-complete, since only scheme complete is aware of user defined variables/functions. And I don't know what Emacs thinks I want to type like I would if there was a drop down menu.  Is there any way to make company mode aware of the user-defined variables/functions that scheme complete is aware of, so that they appear in the drop down menu.  Currently it is only aware of built in functions like define, list, etc.  I am still relatively new to emacs/spacemacs so I might be doing something stupid.  Thanks in advance.

Edit: It seems like symbols become available after

racket run

is executed, but that doesn't exactly solve the problem of convenience.


texts: The fonts in my pdf's as displayed in doc-view aren't particularly readable. Is there a setting I can change to improve the image quality? I tried changing doc-view-resolution from 100 to 300, but that just made the pdf render larger.


texts:
I saw that use-package has an :after section that can be used, which:

  Defer loading of a package until after any of the named features are loaded.

The wording uses "any" instead of "all", so would that mean that if I set something like :after one two three, it will start loading even if only one is loaded but not two and three? The source seems to show that this is the case, but I'm not entirely sure.

If this is the case, though, what is the point of specifying more than one feature? Wouldn't it be preferable to defer until all of the specified features are loaded?

I have trouble envisioning a scenario in which it would be useful to defer a package until any of the specified features is loaded. Perhaps I'm misunderstanding the purpose of :after?


texts: How to show XPath for current location in an XML hierarchy in the modeline?

texts:
When editing a long Maven pom.xml I may see a screen full of <plugin> blocks with their parent tags out of sight. I would like to know whether I'm looking at a /project/build/plugins/plugin tag or a /project/profiles/profile/build/plugins/plugin tag.

Is there an easy way to display this information in the modeline or on the top of the screen?


texts: How do I automatically load a mode for a specific set of file extensions?

texts: I'd like to load the yaml-mode for any files named *.yml or *.yaml.


texts: How to automatically highlight all the words same with selection just like Notepad++

texts:
For example when I select a word I want the same words to be automatically highlighted just like it in Notepad++:

When I select the word "install" in Notepad++ (all other "install" are highlighted"):

I'm using spacemacs. I tried the package auto-highlight-symbol and also the package highlight-symbol. Set mode to 1 in .spacemacs. But when I select a word no other same words highlighted:


texts:
Disclaimer: I am not very well-versed about how email servers and email clients work.
I have been lately looking into setting up email on my Emacs. I decided that I'll use mu4e. If I understand correctly, one has to setup their maildir before they can get mu4e. For that, I decided to use fetchmail. I installed it using apt and now have some questions about setting it up properly. If I understand one has to put up a ~/.fetchmailrc.
Reading the manual, this was the simplest configs I could find for a single user.
poll <server address> proto <protocol, e. g., pop3> port <number>
     user <email address> with pass "<password>" is "<local machine username>" here keep

So is that setup it for setting up this maildir I keep reading about? Btw, if someone could tell me where this directory is, that'll be nice. The manual for fetchmail also says:
Note that although there are password declarations in a  good  many  of
the  examples below, this is mainly for illustrative purposes.  We rec‐
ommend stashing account/password pairs in your $HOME/.netrc file, where
they  can  be  used  not just by fetchmail but by ftp(1) and other pro‐
grams.

So this makes me a little nervous. Are those configs safe? Will the fetchmail encrypt the communication that downloads the mails and will it encrypt the password when it sends it to the server or will I have to setup some other options to do that properly?
Do I also have to configure other options to keep the directory structure that the Microsoft account has? Like will the mail in maildir be downloaded as folders for example inbox, sent, spam etc.
Basically, could someone who uses fetchmail with mu4e show us how to configure fetchmail for it? All of this still only configures downloading the mail. How could I set up sending mail?


texts: Format with the same value many times in a string

texts:
On python, you can repeat a value several times inside a string when formatting it:

>>> print "Hello, {name}, how are you, {name}?".format(name="George")
    "Hello, George, how are you, George?"

But I don't know how to achieve this with elisp. I'm trying to make a function that returns the GPLv3 copyright text (This file is part of Foobar. Foobar is free software:) with the name of any projectile project on it.


texts: Automatically save moved file to new location

texts:
If I open a file in emacs, and the file subsequently gets moved or renamed by a different program, emacs will still save the file to the old location and name.

Example process:

Open ex.txt in emacs.
Make some changes to the file.
From another terminal, move ex.txt to the dir/ subdirectory.
In emacs, save the modified file.

Expected behavior: emacs realized the file was moved and saves the changes to the new file location.

Actual behavior: emacs saves the changes to the old filename and location. There are now two files, the old ex.txt in dir/ and the modified ex.txt in the original directory.

How can I get emacs to realize an open file has been moved and update the file in its new location?


texts: Cannot define keybinding in markdown-mode

texts:
I'm trying to use the package checkbox together with markdown-mode. The checkbox documentation gives the following example on how to define a global keybinding for it's functionality:

I'd recommend globally binding checkbox-toggle to a convenient keystroke:

(global-set-key (kbd "C-c C-t") 'checkbox-toggle)

Although this does indeed work for all other modes, it does not seem to work with markdown-mode. While in markdown-mode, entering the C-c C-t keystroke simply waits for me to provide additional keystrokes (i.e. it's undefined according to emacs). Any ideas for why this happens, or how to fix it?

(I'm sorry if there is an obvious way to do this or find information about this problem, I'm a bit of an beginner)


texts: Automatically adding [/] or [%] to the end of TODO tasks

texts:
I'm using org-mode and I like to keep track of my TODO tasks.

EG: Here is what my TODO's look like

TODO [#B] Implement stuff [%]

If I currently add a TODO I just get the following;

TODO

I have to then set a priority, add a title and add the [%] at the end, I would like to have it automatically set to priority [#B] and put the [%] on the end, is this possible?


texts: Counting the number of days that have passed since a certain date

texts: I have an org-mode document in which I wish to keep track of the number of days that have passed since a certain date. Is there a built in function for this, or will I be forced to write a custom elisp function to accomplish this?


texts: As you're all probably aware, when you export a document from Org mode to HTML, the resulting file contains extra <div> and </div>  items around each heading.  In some cases these are very helpful, but is there a way to optionally exclude these additional HTML elements for a cleaner output?


texts: How to avoid obsolete warning when defining a compatibility alias?

texts:
Currently, I have this code:

(defalias 'hydra-set-transient-map
    (if (fboundp 'set-transient-map)
        'set-transient-map
      (lambda (map keep-pred &optional on-exit)
        (set-temporary-overlay-map map (hydra--pred on-exit)))))

It uses the newer set-transient-map that obsoletes set-temporary-overlay-map when it's
available, however I still want the package to work for Emacs versions that don't have
set-transient-map. And I'm getting this warning when byte compiling:

  set-temporary-overlay-map is an obsolete function (as of 24.4);
  use set-transient-map instead.

What's the proper procedure to avoid the warning in this case, without
ignoring a whole class of warnings?


texts: org-roam not using properties drawer id links

texts:
The org-roam docs say:

Links to headlines can be inserted by navigating to the desired headline and calling org-store-link. This will create an ID for the headline if it does not already exist, and populate the Org-roam database. The link can then be inserted via org-insert-link.

When I try that (with org-roam-mode enabled, and in an org-roam buffer), I get a regular org link like this:
[[*heading][description]]

Not a link to a properties drawer id like this:
[[id:04cd5c5c-fcf8-43aa-a70f-45d2401eeebd][description]

What's wrong?


texts: Keep region activated upon completion of my command

texts:
I'm using the following functions to speed up some regexps
replacements I frequently use. jc-replace-regexp-in-region can be
called by several functions like jc-dollar-to-paren. At the moment,
when one of those functions completes, the region is deactivated and I
have to reactivate it to execute another replace-regexp.

query-replace-regexp doesn't seem to offer an option to save the
activation of the mark, and the function jc-replace-regexp-in-region
explicitly sets the dectivate-mark (I don't actually know why, I
didn't write it).

Ideally I'd like to be able to chain several replace-regexp on the
same region without having to mark the region between each one. How
can it be done ?

(defun jc-replace-regexp-in-region (Begin End from to)
  "Replace from by to in the selected region"
   (interactive "r")
   (let (deactivate-mark)
    (query-replace-regexp from to nil Begin End)))

(defun jc-dollar-to-paren (Begin End)
      "Replace $toto$ by \\(toto\\) in selected region"
      (interactive "r")
      (jc-replace-regexp-in-region Begin End "\\$\\([\n\t [:nonascii:][:ascii:]]+?\\)\\$" "\\\\\(\\1\\\\\)"))


texts:
This is really a question about implementation rather than anything a user of GNU Emacs would be interested in.

Emacs regexps are represented as strings. There is a nice rx DSL for constructing regexps out of s-expressions, but it produces a string not some other more fundamental data structure. I assume that the underlying C regexp engine uses something lower level than strings to represent a regexp matcher.

Does emacs parse / compile every regexp string every time a procedure is called, or is there some memoization going on there under the hood... e.g. an LRU of the regexp string to the underlying compiled data structure. Is it possible to customise any of the parameters for that cache as a user?


texts: org-mode: override buffer-local options in subtree export

texts:
I have a large org-mode file containing handouts for a class. Each handout is a separate toplevel subtree (*). At the top of my org file, I have options:

#+OPTIONS: author:nil email:nil

This is followed by various handouts subtrees:

* Handout #1
** Some things about this handout
** Other things

* Handout #2
** Some things
** More things

On these individual handouts, I sometimes wish to override the OPTIONS settings at the top when I export to PDF. In the export settings section of the org manual, it suggests you can set specific export settings for a subtree, viz:

* Handout #1
#+EXPORT_OPTIONS: email:t
** Things
** More things

I've tried this, but it doesn't work as I'd like. Here, for instance, when I export the subtree for Handout #1 (C-c C-e C-s l o) my email does appear at the top of the PDF, but then it also appears at the top of the Handout #2 PDF when I export the Handout #2 subtree.

I'd like to set persistent OPTIONS at the top of the file that can be turned on or off for a subtree without affecting other subtrees. How could this be done? If it can't be, is there an approach that would work similarly to what I'm searching for?


texts: Placement option in org mode for tables and figures does not work

texts:
#+attr_latex: placement=[!htpb]
#+CAPTION: Some caption
[[../some-image.pdf]]

exports as:

\begin{figure}[htb]
\centering
\includegraphics[width=.9\linewidth]{../some-image.pdf}
\caption{Some caption}
\end{figure}

So I end up having to do:

#+latex:\begin{table}[!htpb]
[[../some-image.pdf]]
#+latex:\caption{Some caption}
#+latex:\end{table}

Which is kind of silly


texts: Why is the star before some menus in Info are red?

texts: There is one star (*) before every menu in Emacs info.  Some of them are red, I am wondering why they are red and what does the red means?  Thanks!


texts:
I've setup EMMS to use with MPD according to the manual with :
(use-package emms
  :config
    (require 'emms-setup)
    (require 'emms-player-mpd)
    (emms-all) ; don't change this to values you see on stackoverflow questions if you expect emms to work
    (setq emms-player-list '(emms-player-mpd))
    (add-to-list 'emms-info-functions 'emms-info-mpd)
    (add-to-list 'emms-player-list 'emms-player-mpd)

    ;; Socket is not supported
    (setq emms-player-mpd-server-name "localhost")
    (setq emms-player-mpd-server-port "6600")
    (setq emms-player-mpd-music-directory "/data/music")
  )

I can see the current playlist in MPD, play and pause. But I cannot add new files to it .
More precisely :

emms-cache-set-from-mpd-directory displays Dumping MusicPD data to cache...processing but never finishes (even for a small folder).
emms-smart-browse is never updated
I can modify the playlist outside emacs with ncmpcpp.
the previous thread was not helpful : mingus seems not maintained and broken

I'm using Doom emacs. Thanks !


texts: Installation of Org-ref slows down start-up

texts:
I am super new to Emacs. I just followed the installation section of org-ref. I managed to get a simple citation working by adding  bibliographystyle:plain to the file. This is one of the solution one user posted on an issue on Github.

I noticed that the process of startup is slowed down after I added the following lines to the configuration:

;; Melpa configuration
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
                    (not (gnutls-available-p))))
       (proto (if no-ssl "http" "https")))
  (when no-ssl
    (warn "\
Your version of Emacs does not support SSL connections,
which is unsafe because it allows man-in-the-middle attacks.
There are two things you can do about this warning:
1. Install an Emacs version that does support SSL and be safe.
2. Remove this warning from your init file so you won't see it again."))
  ;; Comment/uncomment these two lines to enable/disable MELPA and MELPA Stable as desired
  (add-to-list 'package-archives (cons "melpa" (concat proto "://melpa.org/packages/")) t)
  ;;(add-to-list 'package-archives (cons "melpa-stable" (concat proto "://stable.melpa.org/packages/")) t)
  (when (< emacs-major-version 24)
    ;; For important compatibility libraries like cl-lib
    (add-to-list 'package-archives (cons "gnu" (concat proto "://elpa.gnu.org/packages/")))))
(package-initialize)

;; org-ref configuration

(setq reftex-default-bibliography '("~/Dropbox/bibliography/references.bib"))

;; see org-ref for use of these variables
(setq org-ref-bibliography-notes "~/Dropbox/bibliography/notes.org"
      org-ref-default-bibliography '("~/Dropbox/bibliography/references.bib")
      org-ref-pdf-directory "~/Dropbox/bibliography/bibtex-pdfs/")

(setq bibtex-completion-bibliography "~/Dropbox/bibliography/references.bib"
      bibtex-completion-library-path "~/Dropbox/bibliography/bibtex-pdfs"
      bibtex-completion-notes-path "~/Dropbox/bibliography/helm-bibtex-notes")

;; open pdf with system pdf viewer (works on mac)
(setq bibtex-completion-pdf-open-function
  (lambda (fpath)
    (start-process "open" "*open*" "open" fpath)))

;; alternative
;; (setq bibtex-completion-pdf-open-function 'org-open-file)

(setq org-latex-pdf-process (list "latexmk -shell-escape -bibtex -f -pdf %f"))

(require 'org-ref)

Should I remove any of these from the configuration file? Or the slow down is unavoidable?


texts: How do I determine where a variable is set?

texts:
When I execute a M-x describe-variable web-mode-markup-indent-offset I get this output:

web-mode-markup-indent-offset is a variable defined in `web-mode.el'.
Its value is 4
Original value was 2

Documentation:
Html indentation level.

You can customize this variable.

I want the original value, but I can't find where in my setup I've set it to 4. Is there a way to determine this? (I'm using prelude, if that matters).


texts: .svg not exported through org-export + paragraphs not separated after newline

texts:
I have been constantly trying to render a logo.svg found in my custom title-page (included in #LATEX:) to match our university title-page for academic writings, but have unfortunately not had success doing so. I have since yesterday been trying to render the .svg files included in my .org writing, but unfortunately arrived at no solution..
Note that the following list includes methods I have attempted in a doom-emacs enivronment to resolve the issue while having inkscape, libsvg and imagemagick installed on my system.
What I have tried by far:

Used different formats (.png, .pdf and .svg), but failed to display any image through both \includegraphics and \includesvg. Keep arriving at: "cannot find file" and I do not know how to resolve this issue. I have tried to use both full/relative paths, but couldn't produce the desired output.

.svg files located inside .org files are not exported through org-export even after including #+LATEX_HEADERS: \usepackage{svg}. I suspect that this could be the issue, but I am not certain.

pdflatex -shell-escape file.tex returns the same issue as org-export does, which is the .svg images not being displayed.

Another issue that I am facing is paragraphs not being created for lines separated by a newline between them. Because of this, my text currently looks like one mash of text without any separation, which is in my opinion looking hideous.
If you know how to resolve this issue, please do help me since dropping emacs because of this is in my personal opinion not a wise choice. Not to mention that I am really comfortable in my doom-emacs environment and would prefer it over writing my academic work in google-docs. :/


texts: Config is broken when I use load-user-file

texts:
This is my config for org-babel:

(use-package org
  :mode (("\\.org$" . org-mode))
  :ensure org-plus-contrib
   :config
    (org-babel-do-load-languages 'org-babel-load-languages
                           '((emacs-lisp . t)
                             (python . t)
                             (shell . t)
                             (jupyter . t))))

It works when it is located in my init.el. However when I relocate it in another file org.el and load it in init.el with:
(load-user-file "org.el")
I have got the error:

Symbol's value as variable is void: org-src-lang-modes

Also I have the line
;;; -*- lexical-binding: t -*- and the same encoding in both files (init.el,org.el).
So, could you explain me what happens?

UPDATE.

Just for clarification this is my load-user-file :

(defun load-user-file (file)
  (interactive "f")
  "Load a file in current user's configuration directory"
  (load-file (expand-file-name file user-init-dir)))


texts:
I use helm-bibtex to navigate and manage my bibtex database. Each entry is linked to a PDF.

I am looking for a way to see a live preview of each pdf, while scanning through my helm completion window and marking entries that I want to read, take notes on, etc.

Alternatively, integration with QuickLook (I'm on a Mac) would be fantastic.

Thanks!


texts: How can I get emacsclient --eval not to print things in an emacs buffer, but only on the command line?

texts:
So I have a hack to get my emacs org-clock to display in polybar (a system panel utility). It involves a script that looks like this:

CLOCKSTRING=`emacsclient --eval "(if (org-clocking-p)(print (org-clock-get-clock-string))(print -1))))"`

if [[ $CLOCKSTRING = "-1" ]]
then
        echo "Off-clock!"
else
        echo $CLOCKSTRING | cut -d\" -f2
fi

The problem is that print apparently prints to both the output of the commandline command (where I want it) and to a buffer in emacs (where I don't want it. When I'm working in emacs, I just see a window pop up that says the output of this command all the time, i.e. "-1 -1 -1 -1". How do I get print to print only to the command line?


texts:
Sometimes a function will make the display blink and stutter, due do things happening in the background while the function is running (visiting other buffers etc). Does anyone know if there's a function, or another way, to tell Emacs not to redisplay during the course of an sexp? I'm searching for something like this:

(defun my-automatic-todo ()
  (interactive)
  (no-redisplay
   (let ((org-capture-entry
          `("z" "Automatic todo" entry (file ,my-todo-file)
            ,(format "* TODO %s" (my-get-todo-text-function))
            :immediate-finish t)))
     (org-capture))))

In the example above, no-redisplay would run the body without updating the display (and probably update the display when exiting the body). The no-redisplay function doesn't exist though.


texts: How to create empty signature line in org mode?

texts:
I often create legal documents by using GNU Emacs Org Mode. And I would like to have something like ______________________ as an empty line for signature:

Authorized person: Mr. Joe Doe

Signature: _______________________

And I wish to export as PDF, naturally through LaTeX, as those are legal documents.


texts: Ivy: How can I execute an action on a selection without opening the action menu?

texts:
Apologies if the question is poorly formulated, I am a beginner at understanding internals of Emacs/packages.
I am using using Doom Emacs, which provides Ivy as an interface for, for example, finding files.
I understand that custom actions can be created for acting on candidates. In my case (with Doom's Evil bindings), I select a candidate and hit C-o to open the actions menus
I wrote a function that opens the selected file in a vertical split rather than in the current window, and added it as an action.
However, I would like to call this function directly by hitting a keyboard shortcut when I'm in Ivy (as I'm filtering files/buffers and selecting a candidate), instead of having the additional step of opening the actions menu.
So, for example, when I open ivy in my personal config folder and select the file I want, I would like to:

Press RET to perform the default Ivy action (open the file in the current window)
Press C-v to open the file in a vertical split using my custom function
Possibly add more key mappings for other custom functions as well.

How might I be able to accomplish this?


texts: Function to get init.el file loading times multiple times

texts:
Yesterday I declared emacs bankruptcy and now I'm writing my init.el file from scratch.

I'd like to call a function several times within my init.el file to output the current loading times.
I've found this piece of code which only tells the final loading time:

(when window-system
  (let ((elapsed (float-time (time-subtract (current-time)
                                            emacs-start-time))))
    (message "Loading %s...done (%.3fs)" load-file-name elapsed))

  (add-hook 'after-init-hook
            `(lambda ()
               (let ((elapsed (float-time (time-subtract (current-time)
                                                         emacs-start-time))))
                 (message "Loading %s...done (%.3fs) [after-init]"
                          ,load-file-name elapsed)))
            t))

So far I failed any attempt to 'extract' some bits and bobs from there to create the function I look for.

Although I've using Emacs for several years, I have no idea about elisp. All I do is copy + paste + edit code, which is a shame.

Please don't accuse me of not even try it because I had spent a good couple of hours with zero results. I'd put some of the code I've written but I don't think it would help to anything apart from embarrass myself.

I know that there are several packages which help profiling Emacs configuration files but that's not really what I'm kindly asking here. I'd like some help to write a little function.


texts: How to properly advise macros used by functions if earlier byte-compilation is present?

texts:
I am trying to customize the looks of org-agenda and, in order to do so, I would like to advice the macro org-agenda--insert-overriding-header; this macro appears to be used in several functions.  However, if I add the advice in my init file, it does not appear to work.
I guess that it is because the macro has been earlier expanded during byte-compilation and thus my advice is never actually taken.
This leads to the more general question: is there a way to effectively add an  advice a macro if such macro is used in a function that has been byte-compiled?  Can I force byte-recompilation of some functions only? Do I need to give up byte-compilation altoghether?


texts:
I tried many different folding plugins for Emacs and ended up using folding-mode as I used Vim's folding marks and so my files contain a large number of folding marks. I am currently in the process of switching from Vim to Emacs (evil-mode).

However, I miss that my file is fully folded when I open it. Does anyone know how to force folding-mode to fold everything when opening a file?

My init file contains:

;; folding-mode
(load "folding" 'nomessage 'noerror)
(folding-add-to-marks-list 'ess-mode "/*{{{*/"  "/*}}}*/"  nil t)
(folding-mode-add-find-file-hook)
(add-hook 'ess-mode-hook 'folding-mode)
(evil-leader/set-key "ff" 'folding-toggle-show-hide)


texts: global-auto-revert-mode doesn't seem to work?

texts:
My init file includes

(setq global-auto-revert-mode t)

and I can confirm it's true with C-h v. But I still have to manually revert all my files with revert-buffer whenever I change git branches. I even get as far as trying to save and getting the "file changed on disk" prompt. Any suggestions for how to debug this?


texts: Autocompletion using company in org src buffer?

texts:
I can't seem to get completion when editing an org-babel source code block.

Elpy and company-mode both appear to be enabled minor modes for the buffer, but no completion candidates appear as they do when I am editing a .py file.

Does this have something to do with visiting a "non-file" buffer? Or am I misunderstanding something about how these things should be set up?

I am running:

GNU Emacs 24.5.1 (x86_64-apple-darwin12.5.0, NS apple-appkit-1187.40)

Org-mode version 8.3.1 (release_8.3.1-196-ga395da)

Company version: 0.9.0-cvs

Elpy 1.9.0

EDIT: To clarify, I am using C-c ' to open the org-babel block up in a dedicated Org Src  [ python ] buffer. Within this buffer I was not getting the kind of autocompletion I expected, but this may have been a failure to understand the way autocompletion and company works. See my answer below.


texts: Tag completion using ido during org-capture

texts:
I would like to quickly use one of the already used tags when taking notes quickly using org-capture.

There is one inbuilt way of using M-TAB after : but there are 2 issues with that:

It does not work in the narrowed down Capture buffer.. I need to widen it first.
I would like to have a "list" completion interface so that I can pick one of the existing tags from the minibuffer.. think of imenu/ido/ivy.

Here is a typical use case (using my bindings for the example workflow):

C-c c j to make a quick org-capture entry in my journal.org
Type heading
Hit C-c C-q to enter a tag
Start typing the tag (and at this point I would like the minibuffer to show a list of tags that match with what I already typed in the minibuffer).

Pick one from the list by hitting RET if I want to reuse a tag, OR
If that exact tag doesn't already exist, create it when I hit RET

Currently, in step 4, if I want to use one of the already used tags, there is no way for me to ensure if I am doing so or creating a new tag with slight variation of that old tag.

For example: I might already have had a heading with a tag PRJ_v1 in the past and I intend to make a new heading with the same tag. But by mistake I end up creating a new tag called PRJ_r1 (because I did not remember if the original tag was PRJ_v1 or PRJ_r1). I would like to prevent such tag duplication.


texts: How to lookup buffer visiting file opened via TRAMP

texts:
Motivation / Background

I use the ffap counterparts of common file- and directory-finding commands, i.e. find-file-at-point, dired-at-point et al. in place of find-file, dired et al., respectively.
I want to set ffap-file-finder (the file-finding subroutine defaulting to find-file which ffap uses behind the scenes) to counsel-find-file from the counsel package.
counsel-find-file returns a plain, non-TRAMP-qualified filename, in contrast with find-file et al. which return the buffer visiting the given file.
I thus want to write a function suitable as a value for ffap-file-finder (i.e. one that returns a buffer object) using counsel-find-file (which returns a plain filename).

Observations

I have tried calling find-buffer-visiting on the filename returned by counsel-find-file, but this approach breaks down when the file in question has been opened with TRAMP sudo syntax. Using the file /etc/pam.conf with inode 123 and device number 456 on host foo as an example, I have made the following observations in such cases:

;; This actually calls `(find-file "/sudo:root@foo:/etc/pam.conf")' internally
(counsel-find-file) ; => "/etc/pam.conf"

;; These follow the call to `counsel-find-file'
(get-buffer "pam.conf")                       ; => #<buffer pam.conf>
(get-file-buffer "pam.conf")                  ; => nil
(get-file-buffer "/etc/pam.conf")             ; => nil
(find-buffer-visiting "pam.conf")             ; => nil
(find-buffer-visiting "/etc/pam.conf")        ; => nil
(nthcdr 10 (file-attributes "/etc/pam.conf")) ; => (123 456)

Inside the buffer of the sudo-opened "/etc/pam.conf" file:

buffer-file-name   ; => #("/sudo:root@foo:/etc/pam.conf" 6 10 (tramp-default t))
buffer-file-number ; => (123 (-1 . 1))

AFAICT, (find-buffer-visiting "/etc/pam.conf") fails when "/etc/pam.conf" has been opened via TRAMP because find-buffer-visiting:

compares the given plain filename with the TRAMP-syntax values of buffer-file-name and buffer-file-truename; and
compares both inode and device numbers to determine file equality, but TRAMP seems to modify the device number.

Questions

Is it necessary for TRAMP to change the file-attribute-device-number of visited files? If so, why?
How does TRAMP compare files for equality in such cases?
Given a plain, non-TRAMP-qualified filename, how do I lookup a TRAMP buffer visiting it?
How do I make find-buffer-visiting work with TRAMP buffers?

(These questions overlap, but I would like to cover all bases.)

Addendum

I realise that I can call (get-buffer (counsel-find-file)) in my example, but I fear this is not a robust approach in the face of multiple buffers with uniquified names visiting the same file. I am also curious as to whether there is a more general and "correct" TRAMP solution to my questions.


texts: Using dired via tramp on a remote machine

texts:
Maybe I am missing something rather simple but I completely fail to use dired on a remote machine. I can connect via ssh directly without emacs and I can edited a file using Tramp on the remote machine from within Emacs, as it should be. But when I want to use dired to show the home directory on the remote machine I just get an buffer with just one line but not the files in this directory.

I did

C-x C-f /ssh:martin@martins-mbp.fritz.box:/Users/Martin/

and was expecting that the whole directory is shown as it is on my local machine.

During completion, i.e. before I press Enter above, I see the files and directories on my remote machine.

Any hint is gratefully acknowledge.

EDIT

Just to document my findings: I disabled dired-quicksort and switched back to macOS' ls and it works fine now. I do not have the time to investigate this further but maybe this will help others in the future.


texts:
Is there a web app for Emacs-Lisp API searching with nice description, links, examples, etc?
Something like http://apidock.com/ for Ruby, or http://en.cppreference.com/w/ for C++, etc.


texts: Permanently display line numbers in emacs

texts:
I am asking this after having read this post:

How do I display line numbers in emacs (not in the mode line)?

I have tried using:
M-x linum-mode
and
display-line-numbers-mode

After closing emacs and reopening, they are gone. Is there not a way to have emacs permanently display the line numbers?


texts: How to disable "/" 's default behavior on the F interactive mode?

texts:
I use interactive mode with Ivy and Dired for interactively creating new files, like so:
(evil-local-set-key 'normal (kbd "t") (lambda (file)
                                      (interactive "Ftouch ")
                                      (let ((target_exists (file-directory-p file))
                                            (target_dir (file-name-directory file)))
                                        (unless target_exists
                                          (make-directory target_dir t))
                                        (with-temp-buffer
                                          (append-to-file (point-min)
                                                        (point-max)
                                                        file))
                                        (revert-buffer)
                                        (dired target_dir))

It works fine. The problem is that the / key always automatically completes what I am currently hovering in the completion list. Please take a look at the following GIF:
https://gfycat.com/parallelscratchyhuman
When I type . A M /, interactive mode will automatically complete it to ".AMD/", which is not my intention.
What I want to do is get rid of this "completion" behavior of / to not disturb what I am typing, i.e. pressing / only outputs the literal / character and nothing else.


texts: Search tasks by tags in Mobileorg Android

texts:
I'm trying to use Mobileorg in android. Mobileorg syncs well with my Dropbox. The org files staged are captured well by mobileorg. However I'm having trouble searching for tasks based on tags.

Providing only tag name (ex: Project1) or with colons (:Project1:), the search tells me no results found.


texts: Cannot Display Empty Priority In Custom Agenda View After 9.1 Upgrade

texts:
I like using org agenda column view to view my important TODO items. To make that happen I use the following code:

(setq org-agenda-overriding-columns-format
      "%TODO %4PRIORITY(Pri.) %50ITEM(Task) %3POM_Estimate(Est.) %6POM_Pomodori(Poms) %6POM_Interruptions(Ints) %TAGS %16CLOCKSUM_T(Today's Clocksum)")
(setq org-agenda-view-columns-initially t)
(setq org-agenda-custom-commands
      '(("." "Simple agenda view"
         ((tags "+today" ((org-agenda-span 'day)))
          (agenda "")))))

As you can see, the second column of my "agenda table" is the TODO's priority. I like to change these priorities a lot, and often I'll remove the priority entirely.

The problem is that after upgrading from 8.2 to 9.1 all of my TODO's with empty priorities appear to have a priority of "B". Also, when I try to remove the priority in the agenda view I get this message:

user-error: No priority cookie found in line

This of course makes sense because when I leave the agenda view the TODO isn't marked with a priority. It just looks like the priority is B in the agenda view.

This is especially confusing to me because it used to work with Org 8.2. Has anyone else seen anything like this?


texts: org-brain-visualize alignment issue on Mac OS

texts:
I am having trouble getting the Picture art in org-brain-visualize to align properly. I have tried this with several versions of Emacs, both run as a Mac app and from the Terminal:

Org-brain version 0.5
Org mode version 9.1.9
GNU Emacs macports binaries 25.2.1
GNU Emacs 26.1 (both the Home brew and Railwaycats editions)
Savannah emacs compiled from scratch

I have tried this from a Retina display and non-retina, run from the Mac desktop and Terminal. But same issue.

When I run org-brain-visualize I am supposed to see this:

but instead, I get this:

Here is my init.el file:

;;; Add path to src directory
(add-to-list 'load-path "~/.emacs.d/lisp")

;;; Set default org directory
(setq default-directory "~/org/")

;;; Configure org-brain
(require 'org-brain)
(setq org-brain-path "~/org/brain")
(setq org-id-track-globally t)
(setq org-id-locations-file "~/.emacs.d/.org-id-locations")
(setq org-brain-visualize-default-choices 'all)
(setq org-brain-title-max-length 50)

The issue appears to persist any time I add more than one Parent for a Child node.

Any ideas?


texts: How do I change the visibility cycling in orgmode?

texts:
Currently when I press TAB it uses this:

,-> FOLDED -> CHILDREN -> SUBTREE --.

But I would like it to behave like other outliners. If I press TAB once it should open the children. It I press TAB again it should close it. Even if there is a SUBTREE.


texts: how can i split a cell in org-mode table


texts:
When I open my emacs 24.4, I get:

Warning (emacs): Unable to activate package `emacs-eclim'.
Required package `s-1.9.0' is unavailable

but If I open version 24.1 there is no such error. eclim works pretty fine in both version, why it is happening ?

Note: I had a warning in version 24.4 which is:

Warning (initialization): Your `load-path' seems to contain
your `.emacs.d' directory: ~/.emacs.d/
This is likely to cause problems...

and I disabled it.

If this warning is connected with eclim warning somehow, better know it.

Why am I getting these warnings in version 24.4 ?

Thanks in advance...


texts: How do I use company-mode in some buffers and auto-complete-mode in others?

texts:
My init.el loads company with (global-company-mode). I want to make an exception for Javascript buffers, and instead use auto-complete-mode for that mode.

Q: I am struggling to find a way to unhook company mode for only a particular mode. How can I do this?


texts: In org-mode, how to cancel task scheduling?

texts:
This seems trivial, but if you attempt to schedule a task and change your mind, how do you just cancel without actually setting a task.

C-j exits, but sets the date (like return)

C-k kills the active buffer, but doesn't work


texts: how to get org-mode to recognize markdown-style links?

texts:
I'd like to get org-mode to recognize hyperlinks written in Markdown syntax, that is, links in this format:

[markdown link syntax](https://daringfireball.net/projects/markdown/syntax)

How do I add the markdown hyperlink type to org-mode?

Related but different:
How to implement Markdown style link IDs in org-mode?

Probably helpful: http://orgmode.org/manual/Adding-hyperlink-types.html


texts: Kill or copy current line with minimal keystrokes

texts:
I do C-a C-k C-k to kill the entire line point is on.

If I want to copy the line instead of killing it, I can hit C-/ C-/
right after typing the sequence above.

Alternatively, I can do C-a C-SPC C-n M-w.

Is there a faster way to kill or copy the entire line point is on?


texts:
The following happens fairly often to me:

I do emacs note-xyz in the terminal to create a new note
I write something in the note
I forget to save before logging out

Now I'm left with a file #note-xyz# in my directory, without corresponding note-xyz.
What's the fastest way to open #note-xyz# as note-xyz, so that from then on C+x C+s saves to the intended filename? Ideally I'm looking for a single command that I can put in an alias.


texts: interactively edit emacs variable in buffer

texts:
I was looking at
this
on StackOverflow and was wondering if there was a nice way built-in to
edit strings of text stored in variables as if they were buffers? M-x set-variable doesn't really cut it when you have a long string of LaTeX options inside a variable.

I'm looking for behavior similar to the package string-edit, but in order to edit emacs variables.


texts: emacs in --deamon mode dies when X display socket closes. How to prevent this?

texts:
My initial quest is Can emacs on Mac using native window system connect to an emacs server on a Linux system but I got off on a tangent that might work ok but I hit a speed bump.

As described in the other question, I start emacs in daemon mode via the systemd script on Ubuntu.

I download and start XQuest and reboot my system.  Now, every shell has DISPLAY set to a local socket.  ssh -Y xxx works as expected causing the display to be on my Mac but inside XQuatz (X11).  Fine... this is looking promising (although not my original goal).

Then the speed bump -- which I've hit long long ago.

If I do (from my Mac) ssh -Y xxyyzz /usr/bin/emacsclient -f server -c, I get an X11 window on my Mac connected to the server on xxyyzz.  If I ^C the ssh, the window dies -- fine.  But the emacs daemon also dies taking along with it any shells running within it.

This quest is to prevent the emacs daemon from dying when the display socket abruptly closes.  I've tried setting debug-on-error, debug-on-quit, debug-on-signal but the daemon still exits.  No message ... nothing.

I also connect to the same emacs daemon from a terminal local to the Ubuntu server.  I thought I could see a message or something but no luck.  When I ^C the ssh job, the terminal goes back to the command prompt with the terminal still in raw mode so I have to do ^Jreset^J to get the terminal back to a sane state again.

So... I thought I would try to debug this with gdb.  Stopped the systemd service.  Did gdb /usr/bin/emacs and then run --daemon but then I hit another problem because emacs detaches and gdb doesn't catch the error.  As a sub-quest of this 2nd quest -- how can I get emacs in daemon mode not to detach?  Or... perhaps I can tell gdb (I don't use gdb much -- sorry) to also debug the detached forks?

This may be a duplicate of emacs --daemon crashes when parent ssh session dies


texts: How to suggest org-link description when completing?

texts:
I have a custom org link created using org-link-set-parameters. If I use org-insert-link and complete it will use the :complete function from the parameters to get the link. However I haven't found a clean way to then suggest a description based on the completed link. Do you have any suggestions?

There is org-link-make-description-function but that needs to be set before calling org-insert-link (I think?) and thus it isn't suitable for an emacs package. I tried let-binding it inside the :complete function, but that didn't work.

One thing I tried which did work, but seems a bit hacky was to add the following at the end of the :complete function:

(let ((link "mylink:this is my link"))
  (push link org-link--insert-history)
  (push `(,link "My description") org-stored-links)
  link)

Due to the way org-insert-link works this will get the description from org-stored-links. However it would then not insert the link into org-link--insert-history, so that's why I do that above.


texts: Make Emacs short keys work in different language

texts:
I have to often switch the OS keyboard language between Latin an Cyrillic. When the keyboard is Cyrillic the short keys don't work because they are not recognized. For example a Latin command of C-x-c becomes C-ь-ц. Is there a way to make Emacs map all the Cyrillic keys to the same functionality as the Latin ones (the short keys will be the same physical buttons both in Latin and Cyrillic).

I do know that I could switch between input languages in Emacs using C-\ which will make typing in Emacs be Cyrillic while short keys execute as Latin. However this is not what I need.


texts:
I want to follow footnote links in org-mode by positioning the point over the link and hitting the return key.

In my init.el file, I have (setq org-return-follows-link t) which works fine for regular org-mode links but has no effect on footnotes, i.e., links of the form [fn:1].

Any ideas?

Update

I had an idea to add something like this to my init.el. But it's not working quite yet...

(global-set-key (kbd "<return>")
                (condition-case nil
                    (org-open-at-point)
                  (error (execute-kbd-macro (read-kbd-macro "<return>")))
                  ))


texts:
I've read the various manual pages about DEADLINE and SCHEDULED, and have used them both.

I understand that DEADLINE is used in the Agenda to alert in advance about an upcoming deadline, and to continue to alert after the deadline if the item is not marked DONE.

However, I am not sure that I completely understand how to use SCHEDULED. My understanding is that if I have a task, which is larger than just a once-off action, I can use SCHEDULED so that the item keeps appearing daily on my Agenda, until I mark it as DONE. Therefore, each day on my Agenda, I will see the same SCHEDULED task, reminding me to continue working on it. Is this correct? I know SCHEDULED is not intended to simply "schedule" a meeting.


texts:
The polymode manual suggests that creating new polymodes should be very easy:

  Creating new polymodes typically takes a few lines of code.

I wanted to set it up to make emacs to switch to python mode inside of pythontex commands and environments. For the object oriented approach seems to be more complex to modify than just adding some delimiters to a list in my .emacs file. So I don't even see how to start and where to save apply my modifications.

So how would the equivalent setup for polymode look like as that given by JeanPierre for mmm-mode: https://emacs.stackexchange.com/a/20150/2323


texts:
In emacs-lisp-mode, flycheck cannot run.
If execute M-x flycheck-select-checker RET emacs-lisp RET, Emacs tells message below:

Syntax checker in buffer example.el in emacs-lisp-mode:

  emacs-lisp (disabled)
    - major mode: `emacs-lisp-mode' supported
    - may enable: Automatically disabled!
    - predicate:  t
    - executable: Not found

Flycheck cannot use this syntax checker for this buffer.

Flycheck Mode is disabled.  Use C-u M-x flycheck-disable-checker to
enable disabled checkers.

--------------------

Flycheck version: 32snapshot
Emacs version:    26.1
System:           i686-w64-mingw32
Window system:    w32

How can I do to fix it?


texts: How to stop a minor mode from auto-loading in Spacemacs?

texts:
The smartparens minor mode is quite annoying to me, so I want to have it disabled on default. However, I don't want to uninstall it, in case I need it someday.

Can I disable a minor mode without uninstalling it?


texts: how change behavior of kill-sentence based on position in sentence?

texts:
I'd like to modify the behavior of kill-sentence (which I have bound to M-k) according to context, in the following way:

If the point is at the beginning of a sentence, then kill the sentence in the usual way, deleting all the words of the sentence, as well as the period and the space after the period.
If the point is in the middle of a sentence somewhere, it makes no sense to delete the period and space, because this unwantedly joins two sentences. So if point is inside a sentence, I want Emacs to run kill-sentence-to-period, below, so as to preserve the period.

i.e. something like this:

(defun kill-sentence-to-period ()
    "Kill the rest of the sentence but leave the period."
    (interactive)
    (kill-sentence)
    (push-mark)
    (insert ".")
    (backward-char))

Is it possible to change the behavior of M-k depending on the context, conditional on whether or not the point is inside a sentence?


texts: How can I tell magit to ignore specific modified files?

texts: I am working on a project where webpack's bundle.js is part of the repository. This file is gigantic and has many diffs and slows magit down. Is there a way I can tell magit to ignore this file when computing unstaged changes? To reiterate, I don't want to untrack the file or add it to my .gitignore, I just want magit to ignore it.


texts: How can I visualize files inside of a folders to create multiplefile documents using auctex?

texts:
I'm creating a multiple-file document with auctex/LaTeX using emacs with the next file's structures:
├── chapters
│   ├── diffusion.tex
│   └── resis.tex
├── configuration.tex
├── figures
│   └── physics-diffusion
├── itmthesis.cls
├── main.tex
└── references.bib

Inside the main.tex file, I would like to add other files using \include or \input commands. However, when I call TeX-insert-macro, the input command list files out of the project's folder, while include list only files inside the project's folder, but the folders chapters and figures are not listed. Do I miss some configuration variables at emacs?


texts: Persp-mode doesn't recover last activated perspective and doesn't restore all buffers

texts:
I'm using persp-mode.

(setq-default use-package-always-defer t)

(use-package persp-mode
  :init
  (setq-default
   persp-auto-resume-time 0.1
   persp-keymap-prefix (kbd "C-c C-w"))
  (persp-mode 1)
  :config
  (setq-default
   persp-auto-save-fname ".persp"
   persp-auto-save-num-of-backups 0
   persp-autokill-buffer-on-remove nil
   persp-save-dir user-emacs-directory))

Here are the steps to reproduce:

Start Emacs, create a dotemacs perspective with persp-copy.
Visit dotemacs.org, it is added to the perspective.
Visit then Magit buffer for that file, it is not added to the perspective.
Add that Magit buffer with (persp-add-buffer (current-buffer)).
Save .persp with (persp-save-state-to-file persp-auto-save-fname)). https://bpaste.net/show/3c3ebf87da29

When I restart Emacs:

Persp doesn't restore dotemacs perspective, perhaps intended but I haven't found a way in the customization menus.
The Magit buffer is saved in the .persp file, but is not open, nor restored.

My questions:

How do I mark "active" a perspective to restore to on startup?
How do I make Magit buffers automatically added to my perspectives?
What are "leaves" in the .persp file?
What are "weak" perspectives?


texts: Is it possible to make a function local to the buffer?

texts: I want to override the function helm-swoop-pre-input-optimize in man mode using its hook, but not anywhere else. Is there something similar to make-local-variable for functions?


texts: Difference between an org element and entry

texts:
What are Org elements (e.g. org-element-type) and entries (e.g. org-entry-get)?
The best I can figure is that an entry is anything in the buffer.  Org defines properties (org-special-properties and org-default-properties) for various purposes; TODOs, clocks, etc.  The text in a buffer is parsed through string matching and properties are identified correspondingly.  So, an entry is text with (or representing) a property?
It also looks like there is a push for a fully parsed syntax tree, starting with (or around) Org 9.  The org-element.el library parses a buffer into an AST composed of elements.  Therefore, an element is merely a node in the abstract syntax tree?


texts: How do I set evil mode to use the normal state by default in Customize mode?

texts: When I open the Easy Customization in Emacs, I want to be in normal mode instead of emacs mode.  Is that possible?


texts: How to use the same elpa directory to download packages for different Emacs starter kits

texts: I am using different Emacs starter kits. The problem is that each starter kit, I use different directories (for example, for prelude I use´.emacsPrelude.d´, for SciMax I use ´.emacsSciMax.d´) . But all starter kits shares a common directory inside the directories, which is called Elpa. I can't use the same directory because each has  different directory structure. Is there any Emacs command to define where Elpa packages will be installed? Or can I change the Elpa directory in my ´init.el´ file?


texts: What's the relationship between js-mode and js2-mode?

texts: I saw there is a js-mode bundled in Emacs. I've also seen a js2-mode. However, I have also seen Emacs git log on js-mode refers to js2-mode bug reports. What is the relationship between them?


texts: How do i change the default shell for shell-command

texts:
I am having an issue with one of the plugins i am running because its trying to use fish and does not like the parameters.

Is there a way i can change emacs to use bash for any plugins that use shell-command or similar functions.

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

I tried the above but shell-command still seems to use fish.


texts: How to install package without install dependencies through "package"?

texts:
I am using :ensure t of use-package to install "go-prjectile" package which depends on "go-rename". But I would like to use a local version of "go-rename" and its path is already added to load-path.

My configuration:

(use-package go-rename
   :load-path "lisp/go-rename")

(use-package go-projectile
   :ensure t)

But every time when "go-projectile" is installed, the "go-rename" is also installed from melpa too.

Is there any way to only install "go-projectile" without install its dependencies?


texts: How to generate emacs manual to pdf by myself?

texts:
Are there any off-the-rack way to generate a pdf version GNU Emacs Manual (and other manuals GNU Emacs brings with) from GNU Emacs source code or the texinfo files by myself?

I've found a free version of GNU Emacs Manual of version 24.5 and want to print a newer version of this manual.  I also want to print a manual of GNU Calc.

----- UPDATED -----

I've found these lines in GNU Calc's manual:

  The Calc manual can be printed, but because the manual is so large,
  you should only make a printed copy if you really need it.  To print
  the manual, you will need the TeX typesetting program (this is a free
  program by Donald Knuth at Stanford University) as well as the
  ‘texindex’ program and ‘texinfo.tex’ file, both of which can be
  obtained from the FSF as part of the ‘texinfo’ package.  To print the
  Calc manual in one huge tome, you will need the Emacs source, which
  contains the source code to this manual, ‘calc.texi’.  Change to the
  ‘doc/misc’ subdirectory of the Emacs source distribution, which
  contains source code for this manual, and type ‘make calc.pdf’.
  (Don’t worry if you get some “overfull box” warnings while TeX runs.)
  The result will be this entire manual as a pdf file.

but when I tried to run

$ pwd
~/gits/emacs/doc/misc
$ make calc.pdf
make: *** No rule to make target 'calc.pdf'. Stop.

I am wondering whether this is because the calc's manual is outdated and the writer didn't keep it updated.

Can you help me out? Thanks!


texts: Org mode export to HTML not opening in browser in cygwin emacs-w32

texts:
When I do C-c C-e h o the file opens in an Emacs buffer instead of my default browser which is odd because org-mode links do open in the browser as is the case when I preview a file from web-mode, so Emacs must know how to open the default windows program for html files.

I have tried to customize the org-file-apps variable as per an answer in this question. I put in the cygwin path of browser executable and org-mode now indeed opens the browser but the browser fails to open the file as Emacs gives it a cygwin path to the html file, and I don't know what magic I would have to insert to convert the file path to a windows one. In any case it should open the browser with default setting for this variable, which was default before I changed it.


texts: compilation-scroll-output doesn't work if *compilation* buffer is created by hand

texts:
Emacs version 25

I have a short piece of elisp to create a few buffers and split my frame into multiple windows that are displayed the way I like. This code creates a *compilation* buffer and dedicates it using this code:

;; https://stackoverflow.com/questions/5151620/how-do-i-make-this-emacs-frame-keep-its-buffer-and-not-get-resized
;; Toggle window dedication
(defun toggle-window-dedicated ()
  "Toggle whether the current active window is dedicated or not"
  (interactive)
  (message
   (if (let (window (get-buffer-window (current-buffer)))
         (set-window-dedicated-p window
                                 (not (window-dedicated-p window))))
       "Window '%s' is dedicated"
     "Window '%s' is normal")
   (current-buffer)))

(switch-to-buffer (get-buffer-create "*compilation*"))
(toggle-window-dedicated)

My issue is that when running a compilation, even if the compiler output goes to the correct buffer, the *compilation* buffer doesn't scroll automatically to always display the most recent text.

My configuration is (setq compilation-scroll-output 'first-error)

The normal scrolling behavior seems to only be enabled when the *compilation* buffer is created by the compile command and not by hand. Even if I make the window with this buffer dedicated latter.

Is there a correct way to create the *compilation* buffer without running the compile command but keeping the compilation-scroll-output configuration behavior?

EDIT: a more detailed procedure:

How to trigger the problem:

put mybuffer.el and Makefile in one directory (/tmp/emacs_problem for example)
open file mybuffer.el
go to end of the create-my-buffers function and execute the code (C-x C-e)
execute the create-my-buffers function with M-x create-my-buffers
execute M-x compile RET RET

How to see the expected behavior:

open file mybuffer.el
execute M-x compile RET RET

The Makefile:

default:
    ls -1 /bin

mybuffer.el:

(defun create-my-buffers ()
  (interactive)
  (delete-other-windows)

  (setq total-window-size (window-width (frame-selected-window)))
  (setq total-window-height (window-height (frame-selected-window)))

  (split-window-vertically)
  (other-window 1)
  (switch-to-buffer (get-buffer-create "*compilation*"))
  (setq second-window-height (window-height (frame-selected-window)))
  (setq expected-window-height (* 0.10 total-window-height))
  (setq expand-window-height (- expected-window-height second-window-height))
  (enlarge-window (round expand-window-height))
  (other-window 1)
)

The result with the "bad" behavior, the window with the compilation buffer has not scrolled to the bottom:

The result with the good behavior, the cursor is at the end of the content and the window has scrolled correctly:

The output for M-x describe-mode after calling M-x compile is:

Enabled minor modes: Auto-Composition Auto-Compression Auto-Encryption
Autopair-Global Column-Number Company Company-Quickhelp
Company-Quickhelp-Local Delete-Selection Display-Time Electric-Indent
Evil-Matchit File-Name-Shadow Font-Lock Global-Auto-Revert
Global-Company Global-Eldoc Global-Evil-Matchit Global-Font-Lock
Global-Git-Gutter Global-Linum Global-Undo-Tree Global-Visual-Line
Global-Whitespace Hl-Line Line-Number Mouse-Wheel Save-Place
Shell-Dirtrack Show-Paren Tooltip Transient-Mark Undo-Tree Visual-Line

(Information about these minor modes follows the major mode info.)

Compilation mode defined in ‘compile.el’:
Major mode for compilation log buffers.
To visit the source for a line-numbered error,
move point to the error message line and type RET.
To kill the compilation, type C-c C-k.

Runs ‘compilation-mode-hook’ with ‘run-mode-hooks’ (which see).

EDIT 2: It seems that the scrolling is done correctly if I launch M-x compile from the window containing *compilation* rather than from the window containing mybuffer.el.


texts: Getting electric indent behaviour for added chars to "electric-indent-chars"

texts:
I am trying to get electric indent behaviour in bazel BUILD files.  These are essentially python files, although the structure is extremely simple.

Let me give you an example:

cc_binary(
    name = "hello-world",
    srcs = ["hello-world.cc"],
    deps = [
        ":hello-greet",
        "//lib:hello-time",
    ],
)

What I want is to have electric indentation behaviour for "]" and ")".

What I have tried is:

to add these characters to electric-indent-chars
to add electric-indent-post-self-insert-function to post-self-insert-hook

Neither of these steps seems to change the behaviour of the characters.  What am I doing wrong?


texts: Org-Mode: Exclude specific code line from html export

texts:
I'm writing a Lilypond typesetting tutorial in Org to be published on a web page. I would like to exclude the line with set-default-paper-size from html export, cause it doesn't belong to the tutorial but is needed to shrink the size of the resulting png. How could this be done?

#+begin_src lilypond :file c-major.png :exports both
#(set-default-paper-size "a9" 'landscape) % How to exclude this line from export???

{ c d e f g a b c }
#+end_src
#+results:
[[file:c-major.png]]

An alternative would be if babel could invoke lilypond with the -e option when evaluating the code block. Any other ideas how to hide specific code lines are appreciated as well.

EDIT:
The following solution works fine for a single code block:

#+begin_src lilypond :file c-major.png :exports both :prologue "#(set-default-paper-size \"a8landscape\")"
{ c d e f g a b c }
#+end_src

All I have to do is to escape the double quotes. Now I try the same for a default setting in .emacs:

(add-to-list 'org-babel-default-header-args:lilypond
             '((:prologue . "#(set-default-paper-size \"a8landscape\")")))

Then the following error message is thrown:

org-babel-exp process lilypond at line 38...
Wrong type argument: stringp, (:prologue . "#(set-default-paper-size \"a8landscape\")")

This is the full backtrace:

Debugger entered--Lisp error: (void-function stringp\?)
  (stringp\? "#(set-default-paper-size \"a8landscape\")")
  eval((stringp\? "#(set-default-paper-size \"a8landscape\")") nil)
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)


texts: Is there a way to check whether or not a string is valid json?

texts: I am trying to parse a string with the json.el package, though when the string is not json unexpected things happen. Is there a way in elisp to check whether or not a provided string is actually a valid json before trying to parse it with json-read-from-string?


texts: Export an orgmode buffer without expanding noweb references?

texts:
Normally, when I use orgmode's export function on a buffer that contains noweb references, they get expanded, resulting in lots of duplicated code throughout the exported HTML document.

Is there a way to export an orgmode buffer without expanding noweb references, so they still show up as <<reference>> in the exported document?


texts: Emacs manuals are missing on Debian/Ubuntu

texts:
I was expecting the Emacs Lisp Reference Manual at (C-h i m elisp). But there was no menu elisp or lisp there. C-h v and C-h f work fine for variables or functions though. C-h i 5 takes me to file permissions.

What other binding is standard to find something like this?

Is that something that has to be installed?


texts: how to convert 4 lines block text to 1 line space interrupted

texts:
I have a text file (name, surname, phone number)
than I would import in excel and the play with column (name, surname...)

The file was previously a docx file.
I've converted it on as a text file.
But the converted txt file, has a strange format:
Repeated 6 lines block, with each field (name, surname, phone, town)

xxx
yyy
999
zzz
xxx1
yyy1

repeated more times.
I would compact each block in a single line and separate field by space.
NOTE that xxx1 and yyy1 are name and surname of next person
So I can import it in Excel, taking space as a separator column.

How can I do that?
I know I can do that in Lisp, but I do not know how.


texts: Replace PlantUML source with generated image in org-mode

texts:
I write UML diagrams in org-mode with PlantUML and usually "compile" it to HTML to view the result. Is there a way to have the image show up in my buffer?

I try to enable iimage-mode but it doesn't work well. It replaces the file name at the start of the source block.

#+begin_src plantuml :file my-diagram.png
...
#+end_src
#+results:
[[file:my-diagram.png]]

Both references to the filename get replaced and the source stays. Is there a way to hide the source block and only show one instance of the image?