texts: Is there any way to ask for a interactive input after a condition is met?

texts:
Something like the example below, which I want to test whether you are eligible to enter a number before you actually enter this number

(defun foo (x)
  (cond (condition (progn (interactive "nEnter your number: ") ...))
        (t (message "You cannot enter a number right now!"))))


texts: Non regex variant of dired-do-find-regexp-and-replace

texts:
Dired has the interactive function dired-do-find-regexp-and-replace which can be match based on the regexp you have passed and perform the replace.

But I'm looking for non regex variant of dired-do-find-regexp-and-replace where I don't have to pass the regexp. Is something like that available for dired ? I'm okay with using additional dired based packages for it, if they provide the non-regexp version of the function.


texts: Magit equivalent for "git remote -v" (list remotes)

texts:
I'm wondering if there is a magit equivalent to git remote -v to list remotes and their URL's defined on a git repository.  The magit remotes popup offers options to add, remove, rename, and set url, but I don't see any sort of listing mechanism.

Sample git remote -v output:

origin  ebpa@example.com:/var/git/myproject.git (fetch)
origin  ebpa@example.com:/var/git/myproject.git (push)

magit-list-remotes is non-interactive and only lists remote names.


texts:
I put together the function below but it doesn't work. The problem is get-text-property returns nil for every task.
Any idea how to get the CREATED property and fix the entire thing?
(defun jarfar/org-agenda-cmp-user-defined-created-date (a b)
  "Org Agenda user function to sort tasks based on CREATED property."
  (let* (
          (time-a (get-text-property 0 'CREATED a))
          (time-b (get-text-property 0 'CREATED b))
          (time-a (if time-a (org-time-string-to-time time-a) nil))
          (time-b (if time-b (org-time-string-to-time time-b) nil)))

    (if (and time-a time-b)
      (if (org-time< time-a time-b)
        -1
        (if (org-time> time-a time-b)
          1
          nil))
      (if time-a time-a time-b)
      )))

EDIT: Here is an example data file:
* Tasks
** TODO Task 1
:PROPERTIES:
:CREATED: [2020-07-23 Thu]
:END:

** TODO Task 2
:PROPERTIES:
:CREATED: [2020-06-15 Tue]
:END:

** TODO Task 3
:PROPERTIES:
:CREATED: [2020-05-22 Sat]
:END:

** TODO Task 4
:PROPERTIES:
:CREATED: [2020-06-01 Tue]
:END:

EDIT: Update to the function:
(defun jarfar/org-agenda-cmp-user-defined-created-date (a b)
  "Org Agenda user function to sort tasks based on CREATED property."
  (let* (
          (marker-a (get-text-property 0 'org-marker a))
          (marker-b (get-text-property 0 'org-marker b))
          (time-a (if marker-a (org-entry-get marker-a "CREATED") nil))
          (time-b (if marker-b (org-entry-get marker-b "CREATED") nil))
          (time-a (if time-a (org-time-string-to-time time-a) nil))
          (time-b (if time-b (org-time-string-to-time time-b) nil)))

    (if (and time-a time-b)
      (if (org-time< time-a time-b)
        -1
        (if (org-time> time-a time-b)
          1
          nil))
      (if time-a time-a time-b)
      )))


texts: gnus-group-make-group error: Duplicate folder name

texts:
I cannot use Gnus anymore because of the following error:

gnus-group-make-group: Could not create group on server: NO (ALREADYEXISTS) Duplicate folder name Agenda (Failure)

I couldn't find anything about this error on the Web and I have no idea where to remove this duplicate on my computer.


texts: lexical-binding only set at the buffer level?

texts: According to this, it seems to say setting lexical-binding only happens at the individual buffer level, i.e. I could not do (setq lexical-binding t) in my init file and have it apply to all subsequent buffers, right?


texts:
I would like to have a double nested list in Makrdown Fill mode. For this I write in my markdown file

* item 1
  * item 1.1:
    * item 1.1.1
    * item 1.1.2

Now I would like to add an * item 1.2: which should be aligned with * item 1.1:. However, emacs allows me, using tab, just the two positions, either:

* item 1
  * item 1.1:
    * item 1.1.1
    * item 1.1.2
    * item 1.2

or

* item 1
  * item 1.1:
    * item 1.1.1
    * item 1.1.2
* item 1.2

I would need to use spaces, but that doesn't make sense in my opinion. Why is emacs not allowing me to align them properly, i.e. leave the right indentation out?


texts: How to search word under cursor using counsel-git-grep

texts:
I am using counsel-git-grep to grep for a string in the current Git repository.
When I do M-x counsel-git-grep it opens following in the mini-buffer.
2    git grep:

3 chars more

Let say if the cursor on top of
def hello_word():
      ^
      |__cursor is here and when I entered `M-x counsel-git-grep`

I want following to open:
2    git grep: hello_word

3 chars more

[Q] How can I pass the word under cursor to the counsel-git-grep search?


texts:
It's similar problem Copy and Paste From PDF to Emacs as Plain Text When I copy text from pdf and yank to org mode I have to run manually unfill-paragraph function to remove unnecessary newlines & spaces. How I can automate the process?

I think condition would look like this -> If text is copied from pdf on yank run unfill-paragraph.


texts: Reliable method to get the command for last pressed key?

texts:
I'm writing some code where I have to identify the command for the last key pressed. Sometimes I need to look up a combination of this key with another one. I use the key-binding function for that. It works most of the time but not for all keys. For example it does not work for the backspace key:

(progn
  (read-key)
  (key-binding (vector last-input-event))) ;; > nil for backspace

I can work around this by checking for backspace manually but I wonder if there is a more reliable way that works for all/most situations?

I use last-input-event because it is after exiting a keymap through the default binding [t].

Edit:

Based on the accepted answer I'm using something like the following which seems to work very well:

(progn
  (read-key)
  (key-binding (kbd (edmacro-format-keys (vector last-input-event)))))


texts: How to write a helm function to select only from shell buffers

texts:
I recently switched from ido to helm. Now I'm using helm-buffers-list to select buffers.

Additionally I want to create a customised helm-buffers-list function which allows me only to select from shell buffers; let's call this new function helm-shell-buffers-list. From earlier times where I used ido I still have a function populating a list with all shell buffers - how can I use this list to create the function helm-shell-buffers-list?

I looked at the source for helm-buffers-list:

(defun helm-buffers-list ()
  (interactive)
  (unless helm-source-buffers-list
    (setq helm-source-buffers-list
          (helm-make-source "Buffers" 'helm-source-buffers)))
  (helm :sources '(helm-source-buffers-list
                   helm-source-ido-virtual-buffers
                   helm-source-buffer-not-found)
        :buffer "*helm buffers*"
        :keymap helm-buffer-map
        :truncate-lines helm-buffers-truncate-lines))

This leads me to believe I have to provide a new class similar to helm-source-buffers:

(defclass helm-source-buffers (helm-source-sync helm-type-buffer)
  ((buffer-list
    :initarg :buffer-list
    :initform #'helm-buffer-list
    :custom function
    :documentation
    "  A function with no arguments to create buffer list.")
   (init :initform 'helm-buffers-list--init)
   (multimatch :initform nil)
   (match :initform 'helm-buffers-match-function)
   (persistent-action :initform 'helm-buffers-list-persistent-action)
   (keymap :initform helm-buffer-map)
   (migemo :initform 'nomultimatch)
   (volatile :initform t)
   (nohighlight :initform t)
   (resume :initform (lambda () (setq helm-buffers-in-project-p nil)))
   (help-message :initform 'helm-buffer-help-message)))

However in that class I have no idea where to provide the list with buffers...

Any help greatly appreciated!


texts: How to install (and use) Sunrise Commander in Spacemacs

texts: I'm using Spacemacs and want to try Sunrise Commander (with its ALL plugins!). How to to it with Spacemacs? Is some layer ready for Spacemacs? If not, how to do it w/o layer?


texts:
It seems that whitespace is no longer visible while editing files, since this github issue.

Now I usually end up seeing the whitespace only after I have saved or even commited my files sometimes.

How can I see whitespace in spacemacs while editing, as was the case before ?
Are there any manual settings like save-hooks which remove the whitespace automatically ?
Any other manner in which I should proceed to prevent the annoying whitespace to be commited?

Any help would be appreciated. Thanks.


texts:
I noticed that Emacs has many font files open on my system. At least 95 .ttf and .otf files total. Why would it need to keep this many files open?

Here is a full list: https://gist.github.com/landaire/2a4346b97792f2987c4ac39bcd7295f6

Here's some info about my setup:

OS: darwin
Emacs: 25.1.50.1 (from a recent brew install emacs --HEAD --with-cocoa)
Spacemacs: 0.105.16
Spacemacs branch: master (rev. cf8563b)
Graphic display: t
Distribution: spacemacs
Editing style: vim
Completion: helm
Layers:

(auto-completion better-defaults emacs-lisp git org
                 (shell :variables shell-default-height 30 shell-default-position 'bottom)
                 syntax-checking version-control semantic c-c   d go rust swift yaml latex markdown gtags osx spacemacs-layouts themes-megapack
                 (colors :variables colors-enable-rainbow-identifiers nil))


texts: how to add a hook to a custom interactive command

texts:
I have a pipeline that opens an emacs client in notmuch-mode when new mail comes in, currently using (notmuch-show "thread:...").
I'd rather use tree view with the most recent message displayed. In two steps this is easy.

run notmuch-thread-view (automatic)
then manually run notmuch-thread-view-in-tree.

I'd like for it to be automatic, but I cannot seem to combine the functions. I imagine notmuch-thread-view-in-tree runs before notmuch-thread-view has filled the buffer. So I think a hook is necessary. But how?

(defun notmuch-thread-view ()
  (interactive)
  (notmuch-tree "thread:0000000000000384")
  ;(notmuch-thread-view-in-tree) ; doesn't work
)

(defun notmuch-thread-view-in-tree ()
  "Open the most recent message in a thread when in tree view.
   will not work for nested threads."
  (interactive)
  (goto-char (point-max))
  (notmuch-tree-prev-message)
  (notmuch-tree-prev-message)
  (notmuch-tree-show-message-in)
)

; not run?
(add-hook 'notmuch-thread-view 'notmuch-thread-view-in-tree)
; also not helpful
(add-hook 'post-notmuch-thread-view 'notmuch-thread-view-in-tree)


texts: Package `emacs-25' is unavailable, trouble installing things from repository

texts:
I understand this has been asked before... I've done some research and found that emacs25 is not worth the transition. However I can't install many packages because they depend on it.

Is there a way I can update the package repository to look at a repository that does not depend on emacs25?


texts: pdf-tools auctex question with split buffers

texts: I run auctex with the latex source on the left half buffer and corresponding pdf on the right half (using C-x 3 to split the buffer). I then split the left half buffer into 2 so as two work on different parts of the latex source file. Similarly I split the right hand buffer into two so as to view the two corresponding pdf parts. Is there some way of doing forward/reverse search between the top left latex source and top right pdf;  and a forward/reverse search between the bottom left latex source and bottom right pdf? This would help a lot when working on a large latex document. Right now, the top left and bottom left latex source do forward/backward search  with the top right pdf; the bottom right pdf seems to be ignored.


texts: Emacs: Error message when sending a region to a sql connection buffer: Wrong type argument: processp, nil

texts:
Based on the article here:
https://emacsredux.com/blog/2013/06/13/using-emacs-as-a-database-client/
I wish to have a .sql buffer to edit my queries and once prepared send it by (C-c C-r) to an already open sql connection buffer. My database is postgresql.
First of all I open a connection by M-x sql-postgres I enter username, database name and the server host accordingly. Everything works pretty well and I can run queries directly in the new psql shell without any problem. For the sake of this example
I renamed this psql shell to django_sql by M-x rename-buffer : django_sql

Just as an example, this could be my sql file which I wish to edit and run in Emacs by using (C-c C-r), that is by sending the region to the already open psql buffer (that is, django_sql), the file name is myscript.sql:

select
    t1.first_name,
    t1.last_name,
    t1.salary
from
    hr_employees as t1
where
    t1.department_id = 100;

Being inside myscript.sql, here is I how I proceed:

I run M-x sql-set-product and then I typed postgres
Afterwards I did M-x sql-set-sqli-buffer and I selected the name of the connection buffer (psql buffer that I named django_sql)
Then I simply selected my SQL query in the file myscript.sql and I did (C-c C-r) to send the selected region to psql buffer (django_sql)

But when I run this I got the following error message:

Wrong type  argument: processp, nil

Could you kindly tell me what did I do wrong, it seems that I proceeded exactly as the above article.

Edit (01):

As it was asked in the comments, I added the debug message so that it might be helpful:

Debugger entered--Lisp error: (wrong-type-argument processp nil)
  process-buffer(nil)
  sql-input-sender(nil "select\n    t1.first_name,\n    t1.last_name,*\n    t1.salary\nfrom\n    hr_employees as t1\nwhere\n    t1.department_id = 100;")
  sql-send-string("select\n    t1.first_name,\n    t1.last_name,*\n    t1.salary\nfrom\n    hr_employees as t1\nwhere\n    t1.department_id = 100;\n")
  sql-send-region(1 122)
  funcall-interactively(sql-send-region 1 122)
  call-interactively(sql-send-region nil nil)
  command-execute(sql-send-region)


texts: How can I implement Vim's `undo line` command in Emacs' evil-mode?

texts:
From the Vim User Manual: 02.5:

  There's a special version of the undo command, the "U" (undo line)
  command. The undo line command undoes all the changes made on the last
  line that was edited.  Typing this command twice cancels the preceding
  "U".

How can I get this functionality when using evil-mode in Emacs? U currently does nothing.


texts: what are the options to write a language grammar for a new major mode?

texts:
I am writing a major mode for a programming language that has a well-defined grammar: it has a BNF, formalised in some happy files.

I don't particularly want to re-implement the BNF as a series of forward / backward regex scans (as many major modes do), although I would not be opposed to translating it either manually or automatically.

I am aware of SMIE, are there any other options available to me in Emacs lisp that allow me to define the grammar of the language and have as much automatically generated as possible, e.g. faces, sexp commands, imenu population.

I am concerned primarily with simplicity and correctness of the mode, rather than its raw performance, but I'd certainly like to have a rough idea of what the trade-offs are (obviously if the performance is too low it'd be unusable and therefore not appropriate to use).

This is somewhat related to Writing a Major Mode although further advanced, as I am already aware of everything under "Major Modes" in the Emacs Lisp manual.

UPDATE: I have studied and spoken with the author of Semantic and it isn't able to generate the font-locks, it's more aiming to provide higher level tools and it's not something I am looking for.


texts: how can I fix incorrect character width?

texts:
Emacs is telling me that a certain character only takes up 1 column, even though it clearly takes up two? Is there a way I can fix this?

The reason is that I'm doing some calculations in order to "right-align" part of my mode-line. I do this by getting the window-total-width and subtracting from it the (string-width left-part), then appropriately padding based on this. This works great until I show a multi-column character like this. I purposefully made my math involve the amount of columns the string takes, but as shown above, this shows up incorrectly.


texts:
I have multiple overlays with 'help-echo strings covering the same region.
Can I make Emacs show all these strings in the mouseover tooltip? By default it only shows the one coming from the highest priority overlay.

EDIT: The context is FlyCheck: a checker reports errors and warnings for the same position in the buffer, and the tooltip for that position only mentions the errors.


texts:
In orgmode, how can I get below line wrap behavior:

for text (other than table), I wish line wrapped.
for table, I do not wish it's wrapped.

I can add below line in init.el

(global-visual-line-mode t)

But table will be wrapped also!

How can I line wrap except org tables?


texts:
Q: how can I convert a 2-item list to a dotted pair cons cell?

I can convert a 2-item list to a dotted pair with:

(let ((list '(1 2)))
  (cons (car list) (cadr list)))        ; => (1 . 2)

I'm blanking: is there a built-in function that does this, or
should I roll my own?


texts: virtualenv selection menu shows only the first few virtualenvs

texts:
I have a number of virtualenvs, currently 40, but when I try to select one via the drop-down menu in emacs, it shows only the first 30 or so. Is there a way to get a scrollbar attached to that menu, so I can find the later ones, too?
I have so far not managed virtualenvs with Emacs at all, it just picked up the pre-existing virtualenvs. I have Emacs 26.1, Elpy 1.28.0, and anaconda-mode 20200129.1718. I am not sure how they play together, but in python-mode, I get a drop-down menu with my virtualenvs, which shows the first few, and the rest just seems to hang off the bottom of the screen.


texts:
This is related to my previous question over here.

(replace-regexp "\\(\\[\\[\\)\\(zotero:.+\\]\\)\\(\\[.+，[《〈][^《〈]+[》〉]\\)?.+。\\(\\]\\]\\)" "\\1cite-\\2\\3\\4，頁")

I'd like to use the above code to shorten Chinese citation strings to author，title，page format.

Sample Data

Original String:

[[zotero://select/items/1_P36Y9V2B][周東平，〈《晉書·刑法志》校注舉隅〉，《中國古代法律文獻研究》，2016年，00期。]]

Expected Result (shortened string):

[[cite-zotero://select/items/1_P36Y9V2B][周東平，〈《晉書·刑法志》校注舉隅〉]]，頁

The code snippet [《〈][^《]+[》〉] correctly restricts the search to a single title element between ，s.

When joined with .+，, however, it fails to be non-greedy and ends up picking up both article title (between 〈〉s)  and journal title (between 《》s) at the same time.

This results in a shortened citation which is lengthier than expected.

[[cite-zotero://select/items/1_P36Y9V2B][周東平，〈《晉書·刑法志》校注舉隅〉，《中國古代法律文獻研究》]]，頁

How do we make \\3 non-greedy, as expected?

Update:

I just realize this could be an issue specific to the data string listed above, i.e.:

周東平，〈《晉書·刑法志》校注舉隅〉，《中國古代法律文獻研究》，2016年，00期。

Somehow, the 《晉書·刑法志》 nested in 《晉書·刑法志》校注舉隅〉 complicated matters.

Other simpler, but similarly structured data such as this worked as expected:

[[zotero://select/items/1_97XVI66Q][金春峯，〈周官之社會行政組織〉，收入《周官之成書及其反映的文化與時代新考》台北：東大，1993年。]]

Result:

[[cite-zotero://select/items/1_97XVI66Q][金春峯，〈周官之社會行政組織〉]]，頁


texts: Manage several git repositories from magit

texts:
I'm maintaining several git repositories using magit, and their
numbers keep growing. Is there a way to inform magit of
all these projects so that a single command would present a summary of
the status of each one instead of manually running magit-status on
each one of them ?


texts: How can I get the Latex compilation report by using AUCTeX in spacemacs

texts:
How can I get the compilation report by using AUCTeX in spacemacs?
For example, when I use WinEdt in Windows, i can obtain the following compilation report:

LaTeX Compilation Report (Pages:14)
Error:0 Warnings: 32 Bad Box: 19

Can anyone tell me how to achieve such info. in spacemacs with AUTeX?

Thanks in advance.


texts: Is there some pitfalls if I define aliases for `cdr` and `car` functions?

texts:
I'm often obliged to read the documentation before using cdr and car functions. Is there pitfalls I should be aware of before aliasing those functions in my init file? Like:

(defalias 'head 'car)
(defalias 'tail 'cdr)


texts: Clicking on a tag when a date is set in the heading causes "no link found"

texts:
I have a heading like so:

* First entry <2020-04-01>      :tag1:

Clicking on :tag1: doesn't work. I see the following error in the mini-buffer:

  user-error: No link found

Clicking on the date works as intended. Any idea how to fix that?


texts: How to efficiently merge 2 buffers which are partially overlapping?

texts:
Problem summary

Imagine, you have 2 shopping lists:

1 huge one with hundreds of entries - list A, copied into buffer A
1 containing dozens of entries - list B, copied into buffer B

Then:

75% of the entries of list B are already part of list A, but the other rest of list B not—and you don't have a clue or overview which specific entries of list B are the new ones compared to list A.
You want to extend list A by list B, so that the "new list A" contains all entries of list A and B without any doppler—so, each entry just 1 time.

To make a simple example:

  List A:        List B:      What you want—"new list A":

  * Tomato       * Garlic     * Tomato
  * Leek         * Tomato     * Leek
  * Garlic       * Cherries   * Garlic
  * Lentils      * Leek       * Lentils
  * Banana                    * Banana
  * Almond milk               * Almond milk
                              * Cherries

Question

How can that be done as efficient as possible?

Info:

I'm not able to program.
I'm very new to the emacs command "ediff", yet.
I'm relatively new to emacs, using it just for 1 year on a daily basis so far.
I'm getting familiar with using keyboard macros, and keyboard marcos built of a series of keyboard macros—like keyboard macro D(A + 7xB + 3xC)

Details on research:

I've already researched on it using web search engines and starting to turn to the emacs command "ediff".

What I've tried:

I tried M-x ediff-buffers, but the outcome wasn't very useful:
Both buffers were compared automatically, but not in a smart way; comparison wasn't content sensitive, but line by line, so it said "line 1, 2, 3,... are not the same", when I needed it to say "Cherries is different".

Next thing I've tried was M-x ediff-buffers3 for merging, but it had the same problem:

It just let me choose, if for example line 2 of buffer A or buffer B will be used for the merge version, when I wanted emacs to automatically figure out what entries of list B are the new ones for list A and then merging list A only with these new entries.

I see the possibility of taking list B and manually take each entry of it—one by one—and search for it in list A. This way I would figure out by what entries of list B the list A needs to be extended, but that's an arse full of work.

There gotta has to be a more efficient way with any emacs commands.


texts: "locate: illegal option --b" in HELM locate mode

texts:
Here is the screenshot

The mode is triggered by SPC-f-L .

I am using OSX and locate is already installed.

How can I solve this issue? Install a different version of locate or Change the behaviour of the mode?


texts: How do I set a variable in all programming modes?

texts:
I'd like tab-width to be set to 2 in all programming modes.  I use prelude (which might be one of the problems), but I have this in my custom.el (which is sort of the analogue to .emacs):

(setq my-tab-width 2)
(setq standard-indent my-tab-width)
(setq tab-width my-tab-width)
(setq c-basic-offset my-tab-width)
(setq js2-basic-offset my-tab-width)
(setq web-mode-attr-indent-offset my-tab-width)
(setq web-mode-code-indent-offset my-tab-width)
(setq web-mode-css-indent-offset my-tab-width)

How can I avoid all the duplication?


texts: How do I delete duplicate messages in mu4e?

texts: mu4e has the ability to hide duplicates, with the "V" key, but I see no way to delete the messages. I've tried tricks with marking messages in and out of the hide state, but nothing seems to work well. Searching the documentation and googling has turned up nothing.


texts: How do I disable the colored marks that appear next to changed lines when using git?

texts:
I am using orgmode and after I put my files under git I see some lines that appear next to lines that have changed. They are red, green or blue.

I would like to disable this but have no idea how they are called.


texts: Where is the canonical location for the BBDB manual?

texts: It seems development has been spread around over the years. The EmacsWiki still points to the manual on SourceForge but it seems very out of date. Configuration variables mentioned in the manual are no longer available in my MELPA installed package. Is there a more upto date version online?


texts: Display time in the mode line before the list of active (sub-)modes?

texts:
Currently my mode line looks the image below. But the time displaying will be pushed beyond the right window edge once too many sub-modes are enabled.
Wish to limit the size of the mode list part, or move it to behind the time display.


texts: how to change the font of only the minor-modes list in the mode line?

texts:
My main font doesn't render the minor modes glyphs correctly, they are smaller, so I wanted to force the glyphs of the minor modes list to use the default source code pro font which renders them at the right height, without changing the font of the entire modeline.

see here, minor modes are unaligned and smaller than they should be


texts: How do I move TODO entries to the bottom of a task list?

texts:
That is, how do I change this task list

* TODO A
* DONE B
* TODO C
* DONE D
* TODO E

into the following one?

* DONE B
* DONE D
* TODO A
* TODO C
* TODO E


texts:
Running Doom Emacs 2.0.9 on Emacs 27.1.
In my init.el I have org-roam enabled like so:
:lang
(org +roam +journal)

In my config.el I also load org-habits, hide it in initial agenda view and set-up a keyboard binding like so:
(after! org
  (map! :map evil-org-agenda-mode-map
      :desc "Save all org buffers"
      :m "s s" 'org-save-all-org-buffers)
  (add-to-list 'org-modules 'org-habit)
  (setq org-habit-show-habits nil))

When I start emacs, at times (and very often) it shows all tasks that are habits as if they are normal tasks. Multiple restarts sets this right.
The keyboard binding is never available. I need to select the region and evaluate it to get the keybinding.
Lastly, org-roam auto-complete does not work reliably. At times, it does not work. Again, a restart (or several restarts) sets things right.
What could be the trouble? How can I ensure that everything works as expected right form the word go?


texts:
I have a situation where I have a function that depends on other functions. So

(defun a ()
   (something))

and

(defun b ()
   (something-else))

are used by

(defun c ()
   (something-calling (a) (b))

Not wanting to do a blanket load of everything -- and not really wanting to rewrite to include a and b in a cl-flet block -- would I change c to use eval, or is there any trick to have c autoload what it is dependent upon? I've seen autoload, but I'm not sure if it's applicable here.

I guess I'd like to be able to talk to the elisp "live namespace" and tell it, "If you see this function called, go ahead and load/initialize these dependent functions/variables."


texts:
How can I insert a horizontal line (hline) in a bash/sh source code block?
My goal is to separate the header line from the rest.

#+begin_src sh
echo "header1,header2"
echo "???"  # placeholder for the magic value
echo "value1,value2"
echo "value1,value2"
#+end_src

The desired outcome would be

#+RESULTS:
| header1 | header2 |
|---------+---------|
| value1  | value2  |
| value1  | value2  |

In a Python src block I can insert a None-Value and get an hline. I hope there is a possibility.

Edit:
@jagrg answers solves the problem to separate the header from the rest I would also to insert a hline at any point in the table. Here is the expected outcome.

#+begin_src bash :colnames '("header1" "header2")
echo "value1,value2"
echo "value1,value2"
echo "???" # magic value
echo "value1,value2"
#+end_src

#+RESULTS:
| header1 | header2 |
|---------+---------|
| value1  | value2  |
| value1  | value2  |
|---------+---------|
| value1  | value2  |

I tried echo hline and echo "hline" with no success. I also looked in the code of ob-shell.el and it looks that a simple echo hline should do it but it doesn't.


texts:
Is it possible to include only certain columns of a table when
   using org-mode's #+INCLUDE directive? You can choose certain
   rows like

#+INCLUDE: "./paper.org::*conclusion" :lines 1-20


texts: Word wrap that preserves indent from previous line

texts:
This may really be a basic emacs lisp question, but I'm just starting to learn some Clojure -- tiptoeing along the first steps of the newbie's path -- and don't know any elisp yet.

How can one set Word Wrap mode to indent to the first character of the previous line?

Word-wrap visual line mode mode is good, but the indents are lost on wrap, making it harder to scan code by eye.

Ideally I'd want to indent up to a point, say, 30 characters max for example, to avoid overdoing it...

I'm guessing that to get this programmatically I'd need a conditional elisp statement in my emacs file.

It seems many people would have done this. Or is there a reason not to? How can it be implemented?

Thanks.


texts:
After running updates using list-packages, emacs keeps popping out the following messages when I open a tex file. I tried to reinstall the packages and commented out all settings related to auctex, but the warning still shows up. What can I do to fix the issue?
Warning (auctex): `font-latex-update-font-lock' should not be called.
It is obsolete and going to be removed.
If you have called `font-latex-add-keywords' and want to refresh fontification,
call `font-lock-flush' instead.
If you changed syntactic fontification, e.g., one of the variables
- `LaTeX-verbatim-macros-with-delims'
- `LaTeX-verbatim-macros-with-delims-local'
- `LaTeX-verbatim-macros-with-braces'
- `LaTeX-verbatim-macros-with-braces-local'
- `LaTeX-verbatim-environments'
- `LaTeX-verbatim-environments-local'
- `font-latex-syntactic-keywords-extra'
then call `font-latex-set-syntactic-keywords'.
Warning (auctex): `font-latex-update-font-lock' should not be called.
It is obsolete and going to be removed.
If you have called `font-latex-add-keywords' and want to refresh fontification,
call `font-lock-flush' instead.
If you changed syntactic fontification, e.g., one of the variables
- `LaTeX-verbatim-macros-with-delims'
- `LaTeX-verbatim-macros-with-delims-local'
- `LaTeX-verbatim-macros-with-braces'
- `LaTeX-verbatim-macros-with-braces-local'
- `LaTeX-verbatim-environments'
- `LaTeX-verbatim-environments-local'
- `font-latex-syntactic-keywords-extra'
then call `font-latex-set-syntactic-keywords'.


texts: JSON major mode complaining about valid JSON file

texts:
I am editing a dead simple JSON file:

{
   "foo": "bar"
}

Here's what I see:

Doing a C-h m I see the following minor modes running alongside JSON mode:

Enabled minor modes: Auto-Composition Auto-Compression Auto-Encryption
Column-Number File-Name-Shadow Font-Lock Global-Font-Lock
Global-Hl-Line Global-Linum Js2 Line-Number Linum Mouse-Wheel Openwith
Tool-Bar Tooltip Transient-Mark

The following problem is reported when the cursor is on : character:

missing ; before statement

The entire "bar" string value is also highlight red.
Is the problem related to js-lint running alongside JSON?


texts:
I often find myself with an incomplete or invalid emacs config, which breaks the normal behavior of kill-emacs such that it stops at an error.

In this case, I would like to forcefully kill emacs, without resorting to hunting down the PID and issuing a kill from the shell. Can I do this in pure Emacs Lisp?


texts: Use bind-key to bind a prefix key to an existing keymap?

texts:
By default, M-s a prefix key bound to search-map, containing commands like occur (M-s o) and isearch-forward-word (M-s w).

I thought I'd change my search-map prefix key to ESC M-s in order to use M-s for save-buffer (I'm on a Mac and I use ⌘ as my meta key).

I like the bind-key package, but I can't figure out how to bind a prefix key to a keymap with it. I naively tried:

(bind-keys ("M-s"     . save-buffer)
           ("ESC M-s" . search-map))

but that doesn't work because bind-keys expects an alist whose values are commands, but search-map is a keymap.

I've resorted to doing it without any of bind-key's helper functions:

(global-set-key (kbd "ESC M-s") search-map)

I see bind-key has the ability to bind keys within a particular map, and to define a new prefix map, but I don't see a way to bind to an existing map. Maybe there is no way to do this using bind-key macros, but I thought I'd ask in case anyone knows otherwise.

I'm not totally convinced I want to move the search-map onto a less convenient prefix key just to get saving bound to ⌘S, but I'd like to try it out.


texts: Spacemacs Latex: how to make view command tile vertically with emacs window?

texts:
I'm using Spacemacs Latex layer, which uses Auctex. If press space m v for the first time, the document viewer opens up in full screen over my emacs window. After, it only updates the window and keeps it under my emacs window. So to have the workflow that I want, I have to manually resize the emacs window to take up the left half of my screen and the Document Viewer window take up the right half.

There are two possible solutions that I can think of, I don't know how to do either or which is easier:

Get a pdf viewer for emacs and make the view command open the pdf in emacs in a new split window.

Make the view command somehow resize the Document Viewer window and my emacs window.

But presumably there is a standard solution to this problem? It's a pretty standard workflow so I expect someone to have figured it out.


texts: Behavior of universal-argument (C-u) changed between org 9.1.9 and org 9.4?

texts:
Running org version 9.1.9, when invoking C-u C-c C-t (org-agenda-todo) I get a completion list of my status values that I can select from.
In org version 9.4 the same call no longer allows me to select a status, it simply cycles to the next status value on my status values list. The C-c C-t keybinding still invokes org-agenda-todo so that leads me to think that the behavior of C-u has changed as applied to that function. I can invoke C-u <number> C-c C-t to get the desired status but then I have to remember the number for each of my status values.
How can I make org 9.4 resume that desired 9.1.9 behavior?


texts: Magit shows magit-diff with HEAD^ instead of HEAD when invoked from console

texts:
When I start a commit from console (zsh on mac os Terminal) using git commit -a, then Emacs opens two windows as emacsclient in my existing Emacs App Window. One is the correct COMMIT_EDITMSG. The other is a magit-diff window. However, magit uses HEAD^ instead of HEAD as revision. The title says "Changes from HEAD^ to working tree" and that is what is shown.

In contrast, when I run magit-commit from within Emacs, the correct magit-diff window is opened, showing HEAD agains my working tree.

Any idea why this is and how I can fix it?

Emacs from brew: GNU Emacs 25.2.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F1911)) of 2017-04-21
Magit 20180410.1528, Git 2.17.0, Emacs 25.2.1, darwin


texts: Search for text, print a message about it, and then return cursor to original position

texts:
I want to write an Elisp command that searches for a specific string in the backward direction, pauses the cursor there for a second, echoes a message about that occurrence, and then returns the cursor back to its original position. The purpose of the command is to examine the contents surrounding the search string. My text is structured like below:
\begin{myverse}
line one of verse
line two of verse ॥ 3.2 ॥ \\
\end{myverse}
\vspace{2mm}
Lots of text
below
over multiple
lines
cursor here

If my cursor is at the last line (cursor here), I would like the Elisp function to search backwards for the first occurrence of the text ॥, pause for a bit so that I can read the number (3.2), and then return the cursor back to its previous position. I have the following command:
    (defun fn ()
      "Retrieve verse number"
      (interactive)
      (setq test-str "॥")
      (save-excursion
        (search-backward test-str)
        (sit-for 1)))

How can this command be enhanced so that it that prints the verse number in the echo area (i.e. where I type M-x fn)?


texts:
Recently I updated Emacs to the newest version (26.2) which comes with new daemon functionality and Emacs server in combination with Systemd (Manjaro here).

Previously there were no issues with setting a server, but now I've got no idea what is going on.

I did what is recommended here (EmacsWiki) and here (StackExchange) so I have an emacs.service file and set systemctl --user enable emacs and
systemctl --user start emacs but my emacsclient GUI comes out shrunk.

What am I doing wrong?


texts:
I would like to prevent modes to add any custom keys to emacs.

For example this works for default key map:

(global-set-key (kbd "C-c") nil)

And this works for ensime:

(eval-after-load "ensime-mode"
  '(define-key ensime-mode-map (kbd "C-c") nil))

But same doesn't work for yas:

(eval-after-load "yas-minor-mode"
  '(define-key yas-minor-mode-map (kbd "C-c") nil))

So in the end it looks for me like this:

Is it possible to remove all keys from packages/modes?


texts:
I am customizing emacs X11 on a Linux box. By default, C-x C-s is bound to save-buffer, and C-x C-s shows as the keyboard shortcut in the File->Save menu. If I put into my .emacs file the following line:

(global-set-key (kbd "s-s") 'save-buffer)

then both C-x C-s and s-s are bound to save-buffer, but C-x C-s shows in the menu as the shortcut. If I put into .emacs:

(global-unset-key (kbd "C-x C-s"))
(global-set-key (kbd "s-s") 'save-buffer)

then only s-s is bound to save-buffer and it shows in the File->Save as the keyboard shortcut. Now if I put into my .emacs the following lines:

(global-unset-key (kbd "C-x C-s"))
(global-set-key (kbd "s-s") 'save-buffer)
(global-set-key (kbd "C-x C-s") 'save-buffer)

only s-s ends up being bound to save-buffer (and it shows in the File->Save menu as the keyboard shortcut), while C-x C-s ends up being unbound - as if the third line was not there. I was not expecting this behaviour. What am I missing?


texts:
I'd like to define a function to do a query-replace-regexp with a pattern I often use. When not using capture groups, it works:

(defun my-replace ()
    (interactive)
    (query-replace-regexp "[[:nonascii:][:ascii:]]*xxx" "replacedText" nil (point-min) (point-max)))

But I couldn't figure out how to use capture groups -- neither '\(\)' nor '()' works:

(defun my-replace ()
  (interactive)
  (query-replace-regexp "([[:nonascii:][:ascii:]]*)xxx" "\1replacedText" nil (point-min) (point-max)))

(defun my-replace ()
    (interactive)
    (query-replace-regexp "\([[:nonascii:][:ascii:]]*\)xxx" "\1replacedText" nil (point-min) (point-max)))

But when invoked with M-x query-replace-regexp, \([[:nonascii:][:ascii:]]*\)xxx would work.


texts: Is there a way to undo hook attached to major modes in spacemacs?

texts:
In my .spacemacs file I set the following hooks to run:

(add-hook 'js-mode-hook 'prettier-js-mode)
(add-hook 'web-mode-hook 'prettier-js-mode)

I, however, have projects where I don't want these to run. I'd like to unset them in a .dir-locals.el file. However, I've yet to be able to do that. I found this stackexchange question about adding hooks.

Based on that I tried this in my .dir-local.el file:

((js-mode
  (eval remove-hook 'before-save-hook 'prettier-js-mode nil f)))

This, however, failed to toggle off the prettier-js-mode. It occurs to me that the problem here is that .dir-locals.el may be better suited to setting variables than setting/un-setting hooks.

If that's the case, what is the right strategy for unsetting hooks for particular project(s)?


texts:
Newbie question here.

In intellij there is Ctrl-Shift T to go to the corresponding test file. (For java at least.) I would like something similar in emacs. Something like this:

For a language (or project) there need to ba a mapping between source code and corresponding test code. In Ruby it could be lib and spec and in Java/Maven it would be src/main/java and src/test/java.

For a language (or project) there need to be a mapping between file names. In Ruby it could be bits_of_code.rb maps to bits_of_code_spec.rb and in Java i might be BitsOfCode.java maps to BitsOfCodeTest.java.

This (the easy part for me now - some progress at least) should be mapped to a shortcut. T seem to be taken already for character swapping so input on what mapping that would be a natural choice for an emacser is also appreciated.


texts: How to map or iterate over a list of files and set the result to `org-agenda-files`?

texts:
looking for a little help with my function. I'm trying to create a loop-while that'll return a list of files back to org-agenda-files. It's just not working though and i keep getting errors. Any ideas how I can get this to work? Any using a loop-while could be completely wrong, i'm just looking for something that'll work.
(setq org-gtd-task-files '("next.org" "coding.org" "personal.org"))
(setq org-gtd-folder '"~/.org/gtd/")

(push (format "%s%s" org-gtd-folder (loop-while org-gtd-task-files (pop org-gtd-task-files))) org-agenda-files)

Another method I tried was:
 (let ((files org-gtd-task-files)
       (dir org-gtd-folder))
   (loop-while files
     (setq org-agenda-files (list (format "%s%s" org-gtd-folder (prog1 (car org-gtd-task-files) (setq org-gtd-task-files (cdr org-gtd-task-files)))))))
   (org-agenda nil "t")
   (print org-agenda-files))


texts: How to open the agenda overview when open an orgmode file automatically?

texts:
I have a personal orgmode file where I organize my life. Always when I open it I have to press:

C-c a a

That opens my agenda and shows to me my habits, the scheduled and deadline tasks. But it's annoying to remember it and make manually. I'd like to open my orgmode file and automatically opens my agenda overview.


texts: error in process sentinel: Invalid file-name during replacing words

texts:
I am getting following error error in process sentinel: Invalid file-name due to generated _flymake.py files, when I am following approach for the recursively find and replace in text files not already open. Please note that, files (*flymake.py) are generated when find-name-dired is used, I think right after Q is pressed for Query-Replace in Files.

Is there any way to prevent this error from happening? Could I ignore files ending with _flymake.py during replacement?


texts: Prevent Tramp from asking for a password for passwordless sudo

texts:
Opening /sudo::/etc/hosts with tramp prompts for a password even though I have passwordless sudo. I use ido.

$ sudo grep NOPASSWD /etc/sudoers
%wheel ALL=(ALL) NOPASSWD: ALL

Is there any way to fix this?


texts: How to activate semantic-mode for specific major modes only?

texts:
I've seen this question a lot. But none of the replies fixed my issue: the minor mode stays on in others modes.

So far, I have tried:

(use-package stickyfunc-enhance
  :config
  ;; (add-to-list 'semantic-default-submodes 'global-semantic-stickyfunc-mode)
  ;; (defun turn-on-semantic () (semantic-mode 1) (require 'stickyfunc-enhance))
  ;; (add-hook 'python-mode-hook 'turn-on-semantic)
  (add-hook 'python-mode-hook
            (lambda ()
              (add-to-list 'semantic-default-submodes 'global-semantic-stickyfunc-mode)
              (semantic-mode 1)
              (require 'stickyfunc-enhance))))

My issue with those 2 approaches is that semantic-mode will stay on in all major modes once I visited a Python buffer.

How can I turn off semantic-mode in all other modes? Do I have to manually turn it off on prog-mode-hook?

Trying kaushalmodi's solution:

(use-package stickyfunc-enhance
  :init
  (add-to-list 'semantic-default-submodes 'global-semantic-stickyfunc-mode)
  :config
  (defun me/enable-semantic-maybe ()
    "Maybe enable `semantic-mode'."
    (if (derived-mode-p 'python-mode)
        (lambda ()
          (semantic-mode 1)
          (require 'stickyfunc-enhance))
      (semantic-mode -1)))
  (add-hook 'change-major-mode-hook #'me/enable-semantic-maybe))

Yields me:

Making python-shell-interpreter local to  *Python Internal [792caf12c778150badeeede64c068cee]* while let-bound!
Making python-shell-interpreter-args local to  *Python Internal [792caf12c778150badeeede64c068cee]* while let-bound!


texts: Launch ncurses application and cleanup once it exits

texts:
I'd like to occasionally use hg split and hg commit --interactive from Emacs, but those commands bring up a GUI. At the moment I either use a separate terminal or ansi-term for those, but would like to do it in more organic way.

Probably the minimal ideal interface would be a function like this:

(defun run-terminal-app cmd args &optional callback)

I have rough ideas how to implement this, e.g.:

put a command with args into a temporary shell file
launch (ansi-term temp-shell-file some-special-buffer-name)
add a term-exec-hook to wait for exit in a some-special-bufer-name, then running a callback, killing a buffer, and removing a hook

But maybe I am just missing something and this is already implemented in some package, or even out of the box?


texts:
Since I tried creating my own Lisp interpreter (just for learning purposes, as I knew it wouldn't get too far), I have read and tried to understand the internal workings of the Elisp interpreter and always wondered how Emacs does its garbage collection.

I know that the main idea in a Lisp interpreter is that every object that is not reachable from the stack or is the variable or function value of a symbol (basically accessible from the obarray), is considered garbage and is collected when new memory is needed. But what happens when the only reference to an object is in the stack?

How does Emacs know which block of data corresponds to a Lisp object? After all, they are mixed with the complete C/computer stack with function return addresses and C variables not necessarily used inside the Elisp side of Emacs.

After reading the Emacs source file alloc.c, I understand this is done through a tree which holds the address of all allocated memory blocks, and that should in theory solve the problem, but what happens when by pure chance a block of memory stores a valid Elisp object even when it is not supposed to be one? So, could someone please explain to me how Emacs marks/uses the C stack for Elisp function calls?


texts: Using 'jk' to exit insert mode with key-chord or anything else

texts:
I'm trying to transfer over from vim to Emacs. I'm using evil to emulate vim modal editing. In vim, I've remapped jk to get me out of insert mode and back into normal mode using inoremap jk <esc>. At the moment, I'm using

(key-chord-define evil-insert-state-map "jk" 'evil-normal-state)
(key-chord-define evil-replace-state-map "jk" 'evil-normal-state)

to do this in Emacs.

However, when I'm in insert mode and want to type, say, jump, I end up with just mp, and j u is undefined appears under the mode bar.

Is there any way to fix this behaviour? Preferably, the solution would even allow me to type jk by typing j, waiting, and then typing k (like in vim).

UPDATE

To clarify, I was only using key-chord as a temporary solution to get me  into normal mode; I am very willing to accept any solution that fixes the problem, regardless of whether it involves key-chord.


texts:
I wonder if it is possible to write a bash oneline to export org-files to pdf. Something like this

emacs -q --eval 'org-latex-export-to-pdf manual.org'

I'm aware of the pandoc project. I would like to do it with emacs, as I also want to add some style options for the export.

I have a document where I will occasionally work with others. To make it easy for them I would like to add a Makefile to generate the pdf.

EDIT

Solution from the comments

emacs --batch -q --eval '(progn (find-file "manual.org") (org-latex-export-to-pdf))'


texts: How do I set up hunspell on a Windows PC?

texts:
I have my hunspell dictionaries at C:\hunspell\. It contains .dic and .aff files for three languages: en_GB, en_US, and nb_NO. The descriptions I find on the web about how to make hunspell work in Emacs make me confused.

What is the minimum code I need in my init file to be able to use these three hunspell dictionaries in Emacs?

I have tried the following code suggested by one web site:

(add-to-list 'exec-path "C:/hunspell/bin/")
(setq ispell-program-name (locate-file "hunspell"
                       exec-path exec-suffixes 'file-executable-p))

But when wanting to change dictionary by M-x ispell-change-dictionary, I get the following message:

  ispell-phaf: No matching entry for nil.


texts: Replace ugly scroll-bar with vertical line characters

texts:
Let's face it, the scroll bars for the graphical emacs are both ugly and, if you're sufficiently experienced, entirely unnecessary. Here's a picture of terminal emacs (which uses the | character to separate horizontally aligned buffers) adjacent to the graphical emacs on OS X (which *shudder* uses scroll bars:

My question is this: how can I get the graphical emacs to look more like the terminal emacs and eliminate the scroll bars? I don't need it to look exactly the same, but something closer than what I've got now would be rather nice.

Oh, I should also point out that simply using (scroll-bar-mode -1) leaves me with an empty space where the scroll bar used to be, which I don't like. I still like to be able to see where one buffer ends and the other begins.


texts:
Historical Perspective

On Unix like operating systems, it is common practice to redirect IO between shell commands using pipes.

For example, the command below would insert all the lines that didn't match "10.1.2.3" into the *scratch* buffer in emacs.

 `cat /tmp/ip-addresses.txt | grep -vi "10.1.2.3" | emacs --insert /path/to/stdin`

There are numerous ways to do this same task inside of emacs too. One of the easiest methods is probably something like the example below:

M-! cat /tmp/ip-addresses.txt | grep -vi "10.1.2.3"

The output from the command would be displayed in new buffer named *Shell Command Output*

One of my favorite features, is to run shell commands asynchronously inside of emacs.

M-& tail -f /tmp/ip-addresses.txt | grep -vi "10.1.2.3"

The output from the command would be displayed and be automagically refreshed in new buffer named *Async Shell Command*.

Problem

Unfortunately, when I run the asynchronous command outside of emacs the *scratch* buffer will never refresh when the file is updated by another process.

tail -f /tmp/ip-addresses.txt | grep -vi "10.1.2.3" | emacs --insert /path/to/stdin

Question

Is there some way to continue reading from a STDIN file descriptor when data is PIPED to Emacs on Command-line?

  Note: I'm looking for an answer that shows how to continue reading the  redirected IO from the PIPE by modifying the emacs command-line.

  For example, to update the destination buffer from *scratch* to a buffer named STDIN I would modify the original command-line like so:

  cat /tmp/ip-addresses.txt | grep -vi "10.1.2.3" | emacs --eval "(set-buffer (generate-new-buffer \"STDIN\"))" --insert /path/to/stdin

Thanks for your help!

  GNU Emacs 24.5.1 (x86_64-unknown-cygwin, GTK+ Version 3.14.13)


texts:
I have moved to Emacs due to its diversity and yes...it simply Rocks! I have one final thing to resolve. I mostly program in python and it is a great feature to auto complete a function with its parentheses and the arguments "pre-entered", then just tab through them to fill in the right variables. Also what I really like is the documentation pop-up while auto completing. The last desired feature is the function lookup in a library (eg. os.path.j will find join) I have achieved all features: documentation pop-up and library function lookup via Jedi or Anaconda. The function completion with parentheses and arguments via Gtags. The problem is this:

The top line is from Gtags (full auto complete with parentheses and arguments, no documentation pop-up). The second line is from Jedi (documentation, but no full auto complete). I have been searching the web for several hours with no luck so far.

The question is: can Company or Auto-complete be smarter about it and realize that they have the same function completion data and merge them into a single line providing documentation and full completion? Thus providing a smarter and better user experience?

Sub-question: Is there a way to store all the gtags files generated per project all in one place, rather than those files existing in every project?


texts:
I'm trying to build Emacs 26 from source but make fails

./temacs --batch  --load loadup bootstrap
./temacs: error while loading shared libraries: libjpeg.so.9: cannot open shared object file: No such file or directory

If I search for libjpeg.so I have

$ locate libjpeg.so
/home/boffi/Downloads/processing-3.3.5/java/lib/amd64/libjpeg.so
/home/boffi/lib/miniconda3/lib/libjpeg.so
/home/boffi/lib/miniconda3/lib/libjpeg.so.9
/home/boffi/lib/miniconda3/lib/libjpeg.so.9.2.0
/home/boffi/lib/miniconda3/pkgs/jpeg-9b-habf39ab_1/lib/libjpeg.so
/home/boffi/lib/miniconda3/pkgs/jpeg-9b-habf39ab_1/lib/libjpeg.so.9
/home/boffi/lib/miniconda3/pkgs/jpeg-9b-habf39ab_1/lib/libjpeg.so.9.2.0
/usr/lib/x86_64-linux-gnu/libjpeg.so
/usr/lib/x86_64-linux-gnu/libjpeg.so.62
/usr/lib/x86_64-linux-gnu/libjpeg.so.62.2.0

and it seems to me that Emacs is not looking at the system libraries...

Grepping the output of configure I have another suspicious line

$ ./configure | grep miniconda
  Does Emacs use a png library?    yes -  L/home/boffi/lib/miniconda3/lib -lpng16

My question is, how can I screen the libraries installed by the Anaconda Python Distribution for its own use, so that ./configure does not mess with them?

Or, on the other hand, how can I have temacs and later Emacs find the library they expect to load?


texts:
I want to pass a buffer's content into a list.
I figured out how to read the content of the buffer I want to use but cannot figure out how to correctly capture the content and then use it as a list.
Let's say I have a buffer called "test" whose content is
"A" "B" "C"
I've written the following to extract the content
(with-current-buffer "test"
(setq list-of-variables  (buffer-substring-no-properties (point-min)(point-max)))
)

(message "%S" list-of-variables)

The output I got so far literally is
" \"A\" \"B\" \"C\" "
which is clearly useless as it is not recognized as a proper list...


texts: xclip-mode returns "Unknown upattern" and does not work

texts:
The command M-x xclip-mode returns the following info in *Messages*:

Eager macro-expansion failure: (error "Unknown upattern `(quote pbpaste)'") [2 times]
Xclip mode enabled

I cannot yank text from X11 clipboard. If I add (xclip-mode t) to my .emacs file, I get the same message and the killed text cannot be yanked using C-y.

Here is the related content in my .emacs file:

(setq save-interprogram-paste-before-kill t) ;; Save clipboard strings into kill ring before replacing them
;; (setq x-select-enable-primary t) ;; Emacs commands C-w and C-y to use the primary selection.
(setq x-select-enable-clipboard t) ;; Emacs commands C-w and C-y to use the clipboard selection.
(setq select-enable-clipboard t)
(xclip-mode t) ;; the usual kill/yank commands will use the GUI selections according to select-enable-clipboard/primary.

and version info:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 9.6 (stretch)
Release:    9.6
Codename:   stretch
$ emacs -version
GNU Emacs 24.5.1
$ xclip -version
xclip version 0.12
xclip-1.5$ ls
xclip-autoloads.el  xclip.el  xclip-pkg.el  xclip-pkg.elc


texts: Looking for hex values of the default colorscheme

texts:
I don't know if it's the default colorscheme in every version, but the version I'm using, Emacs-26.3 downloaded from GNU ftp mirror, has this colorscheme by default. I don't know how to get the values of the colors used in this scheme. I want to use this exact color in a terminal.

  So, if anyone knows how I can find out the hex values of the default colorscheme, please let me know.


texts: How to quickly copy/move file in Emacs Dired?

texts:
In Dired mode, I can m mark files and R to move them to a destination.

Some times the destination path is too long. With the destination open in a split window, is there a way to move files quicker?

When I see the two dired windows on the screen, I missed the drag-and-drop function in a GUI file manager.


texts: Exporting Org to PDF while displaying Regex literal strings

texts:
I've been searching for the past couple of days to a solution to an issue I'm having. Hoping somebody who is more apt with emacs/exporting could provide some insight.

Upon exporting an .org file (C-cC-elo/p) to LaTeX followed by PDF, my Regex text within the PDF document is handled (assuming) as a math equation. E.g. instead of displaying [^ABC] within the PDF, it is displayed as [ABC].

I have attempted to use \usepackage{verbatim}, with something like \verb/[^ABC]/, but I get different results. E.g. [(^{\text{ABC}})].

Is there a specific reason I'm missing that could be causing this? Or, something that I have not included within my init.el? For reference, here is the section of my init.el that is handling org-latex-classes:

(add-to-list 'org-latex-classes
             '("adarticle"
               "\\documentclass{article}
\\usepackage[utf8]{inputenc}
\\usepackage{verbatim}
\\usepackage[T1]{fontenc}
\\usepackage{graphicx}
\\usepackage{longtable}
\\usepackage{hyperref}
\\usepackage{natbib}
\\usepackage{amssymb}
\\usepackage{amsmath}
\\usepackage{geometry}
\\geometry{a4paper,left=2.5cm,top=2cm,right=2.5cm,bottom=2cm,marginparsep=7pt, marginparwidth=.6in}"
               ("\\section{%s}" . "\\section*{%s}")
               ("\\subsection{%s}" . "\\subsection*{%s}")
               ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
               ("\\paragraph{%s}" . "\\paragraph*{%s}")
               ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))

Edit: As suggested, wrapping expressions with '=' seems to do the trick for cases such as [^ABC] and \u{FFFF}.


texts: Company-mode complete custom matches not necessarily prefix

texts: If I type character a, can completion-at-point be used to show possible matches from this list a ɑ æ ɐ ɑ̃, even without matching a prefix?


texts: setting csharp mode indentation to 2 spaces

texts:
Complete emacs/lisp newbie trying to switch from vim.

I noticed that emacs indents C# files to 4 spaces, which is normally great, but I'm working on a project that requires 2 space indentation.

I've been searching and tried a few things, but it's not working for me. Here's my .spacemacs relevant sections:

(defun my-setup-indent (n)
  (message "Setting up indentation!")
  ;; java/c++
  (setq substatement-open 0)
  (setq c-basic-offset n)
  (c-set-offset 'substatement-open 0)
  (setq tab-width n)
  (setq indent-tabs-mode nil)
  ;; web dev
  (setq javascript-indent-level n)
  (setq js-indent-level n)
  (setq js2-basic-offset n)
  (setq web-mode-markup-indent-offset n) ; web-mode, html tag in html file
  (setq web-mode-css-indent-offset n) ; web-mode, css in html file
  (setq web-mode-code-indent-offset n) ; web-mode, js code in html file
  (setq css-indent-offset n) ; css-mode
  )

(defun dotspacemacs/user-init ()
  "Initialization function for user code.
It is called immediately after `dotspacemacs/init', before layer configuration
executes.
 This function is mostly useful for variables that need to be set
before packages are loaded. If you are unsure, you should try in setting them in
`dotspacemacs/user-config' first."
  )

(defun dotspacemacs/user-config ()
  "Configuration function for user code.
This function is called at the very end of Spacemacs initialization after
layers configuration.
This is the place where most of your configurations should be done. Unless it is
explicitly specified that a variable should be set before a package is loaded,
you should place your code here."
  (global-linum-mode) ; Show line numbers by default
  (my-setup-indent 2) ; indent 2 spaces width
  )

;; Do not write anything past this comment. This is where Emacs will

The only csharp "layer" I have added is csharp.


texts: In org-mode, how to always display inline images at Emac's startup?

texts:
On Emacs (Mac) I have saved a desktop which opens two .org files (one of this has an image - jpg) and whenever I open up Emacs, I have to always type y to:

display /route/to/image/Logo.jpg? (y or n)

How can I make y the default? Haven't found a way to do it, so here I am.

Thanks in advance.


texts: solution for html "intellisense" style completion for emacs like Atom or Brackets have

texts:
I've started taking an html course and I'm trying to figure out how to add functionality to emacs that exists in programs like atom or brackets. I've seen a few modes web-mode.el and nxhtml mentioned but they don't seem to have the same degree of completion.

Specifically for instance in either atom or brackets you can type for example <img and a context-popup will give you options for it such as "src= " "alt= " and the complete list of attributes etc. Is there similar autocomplete functionality somewhere?


texts: Saving open file list and buffer command history in between sessions

texts:
I've discovered desktop-save-mode which allows Emacs to be closed and when it reopens, it appears with the same files that were open before.
I want to take this a bit further and I was wondering if I could also:

Save the history of files I've open with C-x C-f. I often end up opening the same files, so it'd be great to easily find those. If not possible to save this, maybe some bookmarks would help?
Save the history of buffer commands executed via M-x or M-:, is this possible? If not possible, maybe I could keep some snippets around to do this?


texts: org-capture files entry under wrong datetree

texts:
My org-capture setup:

(setq org-capture-templates
 '(("t" "Todo" entry (file+headline "~/org/gtd.org" "@computer")
        "* TODO %?\n %i\n")
   ("j" "Journal" entry (file+datetree "~/org/gtd.org" "Journal")
        "* %?\nEntered on %U\n %i\n")))

When I file a note via org-capture as a journal entry, it is not saved in the dateree below "Journal" but in the first "2014" node of the document (which does not have a "Journal" parent node).

Does anybody have an idea why this happens or how I can prevent this?


texts: elisp - simplify a stranger data structure

texts:
I wish to define a variable to replace the hardcode string below:

(setq org-publish-project-alist
      '(
        ("blog" :components ("org-blog-docs" "org-blog-static"))

        ("org-blog-docs"
         :base-directory "~/myblog/_org"
         :base-extension "org"
         :publishing-directory "~/myblog/_posts"
         :recursive t
         :publishing-function blog-html-publish-to-html
         :headline-levels 4
         :html-extension "html"
         :body-only t
         )

        ("org-blog-static"
         :base-directory "~/myblog/_org"
         :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
         :publishing-directory "~/myblog/assets"
         :recursive t
         :publishing-function org-publish-attachment
         )))

For example:

(setq base-dir "~/myblog/_org")
...
:base-directory base-dir
...

But such a replace doesn't work.

What's this data struture? is it a association or alist?
How can I replace the string with a variable?


texts: How to show page number using pdf-tools in emacs mode line?

texts: As title said, is there a way to have page number shows up in the mode line of emacs? I am not using any fancy power-line, this is stock emacs mode line.


texts: Is there an equivalent of `M-x check-parens` for finding unmatches braces or ['s in any buffer (not a particular mode)

texts:
M-x check-parens finds unmatched parentheses in a buffer.
I am wondering if there is a similar command which finds unmatched { or [.


texts: Default face doesn't specify all attributes?

texts:
In the elisp manual, it says the default face must specify all face attributes. However, running

#+BEGIN_SRC emacs-lisp :results pp
  (face-all-attributes 'default)
#+END_SRC

#+RESULTS:
#+begin_example
((:family . unspecified)
 (:foundry . unspecified)
 (:width . unspecified)
 (:height . unspecified)
 (:weight . unspecified)
 (:slant . unspecified)
 (:underline . unspecified)
 (:overline . unspecified)
 (:strike-through . unspecified)
 (:box . unspecified)
 (:inverse-video . unspecified)
 (:foreground . unspecified)
 (:background . unspecified)
 (:stipple . unspecified)
 (:inherit . unspecified))
#+end_example

If we using the face-attribute function, however, we get

#+BEGIN_SRC emacs-lisp
  (face-attribute 'default :family)
#+END_SRC

#+RESULTS:
: Ubuntu Mono

Is this a bug?


texts: Is it possible to have conditional font locks?

texts:
For example, I want to use font-lock-add-keywords highlight some keywords in source code. But the font lock system would also highlight the same words (anywhere) in the comments/docs/strings part of the source file.

Since there are functions that detects the environment of a given position, e.g. python-info-docstring-p, my question is that is it possible to use these kind of functions to have conditional font lock highlights?

Thanks in advance.


texts: Is it possible to sort dired tabs in tab bar-mode by directory structure?

texts:
I am using tabbar-mode and I love it. I have only one thing which is irritating me: the sorting order of tabs of fired windows.

As in other modes, they seem to be sorted by time opened. But in case of the dired buffers, I would prefer a sorting based on the directory structure, so that lower directories are further left, an directories higher in the directory structure further to the right. As an example, the tabs could be sorted like this:

/ | home | Username | DirectoryInUsernamesHomeDirectory | SecondUsername | ...

I am aware, that it is not possible to project a two-dimensional tree structure into a one dimensional tab-bar, but any logical sorting based on the tree structure would be favourable to a time-of-opening sorting as it is now.

Is there any way (sure there is - but my elisp knowledge is not sufficient to write it) to achieve this? I guess a custom function tab-bar-add-tab needs to be defines as here?


texts: Monkey patch and restore builtin set-window-dedicated-p during advice

texts:
I would like to make set-window-dedicated-p a NOP when called from xref--show-pos-in-buf. Below is an attempt to do so using advice. It doesn't work, I think because fset is not really copying the original function definition, just pointing things at each other. How can I either fix this approach to make it work, or use an alternative approach to accomplish my overall goal?

Overall goal: The way I have things set up, when I run an xref command like xref-find-references, buffer *xref* is shown in a full window which is how I like. But, when I hit RET to visit a reference, the location opens in a new frame. From what I can tell, this is because xref--show-pos-in-buf dedicates *xref* which seems to cause display-buffer to think the best solution is to display the buffer in a new frame. I never want a new frame, so my overall goal here is that *xref* and anything I select in it always open in the same frame I am already using.

(defun sham-set-window-dedicated-p (win flag)
  "Don't dedicate WIN, only return FLAG."
  flag)

(fset 'original-set-window-dedicated-p (symbol-function 'set-window-dedicated-p))

(defadvice xref--show-pos-in-buf (around my-xref--show-pos-in-buf activate)
  "Monkey patch set-window-dedicated-p so it doesn't do anything."
  (fset 'set-window-dedicated-p sham-set-window-dedicated-p))
  ad-do-it
  (fset 'set-window-dedicated-p (symbol-function 'original-set-window-dedicated-p)))


texts: What is the regex to match a newline character?

texts:
In Emacs regex, \n doesn't match a new line character \n.

Am I correct that $ matches the position between a new line
character and the character right before the new line character.
e.g. for a string abc\n, $ matches the position between c and
\n?
What is the regex that matches \n?


texts: Emacs freezes with any org-babel snippet using `:session`

texts:
I removed my .emacs and .emacs.d, then created a new .emacs consisting of only the essential to use R and a shell with org-babel to make sure my configs weren't causing this:

(require 'org-install)
(org-babel-do-load-languages
 'org-babel-load-languages
 '(
   (sh . t)
   (R . t)
   ))

When I try to run the following snippet:

#+begin_src R :results output verbatim
(any R code)
#+end_src

It runs just fine. However, if I add :session or :session name to the #+begin_src header, Emacs freezes. I can't move the cursor nor do anything. I can see both R and Emacs on htop, none using any CPU. The only way to get out is to send SIGTERM to Emacs.

When running the snippet with C-c the minibuffer says:

ESS (*R*, R (newest)) starting data directory? pwd (I say yes)
Cannot read history file pwd/.Rhistory

This is normal, I get it on other computers where Emacs doesn't freeze. Then hangs forever on

ess-tracebug mode enabled

Also normal. Except the hanging forever part.

A similar issue occurs with sh snippets:

#+begin_src sh :results output verbatim
echo
#+end_src

Works fine. So with :session. However, with :session name it hangs forever just like R. All the minibuffer says is

Wrote /tmp/babel-XXXXX

And then hangs forever on

executing sh code block...

All packages (emacs, ess, org-mode) are the latest version from Debian stable repos. I have other computers with the same setup that work just fine. emacs --version returns GNU Emacs 24.4.1. The same happened in previous versions, and I also tried downloading Emacs 24.5.1 from a GNU mirror and compiling it. The exact same thing happens. I'm completely lost as to what could be causing this.

P.S.:

Also tried downloading latest stable ess and org-mode from the respective websites and installing and configuring for the compiled emacs. Added

(add-to-list 'load-path "/path/to/emacs-24.5/b/share/emacs/site-lisp/ess")
(load "ess-site")

To .emacs as per ess' README


texts: View multiple emails at the same time with mu4e

texts:
I use mu4e to read my emails. I often find myself wanting to see the content of two or three emails at the same time, in different windows in the same frame. However, mu4e doesn't seem to allow for this.
Specifically, what I'd like to do is:

from the Headers view, open a message. This will split the frame into two frames, the headers and the individual message view.
Then, I'd like to see a second email beside the first. I try moving point to the message view, splitting the window vertically, and then selecting the second message from the headers window
I'd like for one of the two windows showing the first email body to be replaced by the body of the second email
what happens instead is that the two message windows are both closed, and replaced by a single window showing the body of the second window.

The exact details aren't crucial here. What I need is a way to simultaneously display the body of two emails at the same time, in different windows in a single Emacs frame. Is this possible?


texts: Am I missing some spot, where the coordination/development of new Emacs versions happens?

texts:
Lately I was impressed by the new/improved things that are included with Emacs 25. Then I started thinking about the entire process behind it. I would like to share my thoughts with you.

Keeping it up with the latest requests, many bug fixes, maintaining, extending the Emacs core/dev and whatever, it must be a hell of work, no doubt about that.

When I check out what many changes and improvements are implemented in Emacs 25, many development hours must be spent on it.

It requires pretty big coordination. It's like there must be a large company behind all these changes to push Emacs further.
But it's not a profitable thing, it's all free software and GPL-licensed.

So it's from the volunteers who are willing to spend their time to push Emacs further, next to their regular job. That requires some sort of coordination.

When I checked the mailing lists of Emacs-dev, it seems there is not much coordination, not many people are participating.

And forgive me, I personally consider mailing lists a thing from the 90s. Nowadays you have more pretty alternatives, like GitHub issues tracker and regular communities.

When I look around on the web, you have the regular blogs (Endless Parentheses, Sacha Chua, Redux, OrEmacs, etc.) and Emacs communities (like this Emacs Exchange, and - presumably the largest community -  reddit.com/r/emacs) and collections like emacs.zeef.com and wikiemacs.

But not a spot for development of new releases of Emacs, which requires many people and coordination.

Somewhere I got a feeling like this is all underground, where new versions of Emacs are being secretly developed... funny thought.

This all makes me to wonder if I'm missing sort of big hotspot on the web, where all the magic happens?


texts: Dired+ not loading from the init file on Windows

texts:
I use Emacs 24.4 on Ubuntu and Windows with virtually identical init files. The following snippet is not loading correctly on Windows:

(require 'dired+)
(diredp-toggle-find-file-reuse-dir 1)

The intent is to use the same buffer while navigating folders in dired+. It is working as expected on my home machine running Ubuntu, but it gives the following error on the work computer running Windows:

File error: Cannot open load file, no such file or directory, dired+

I do have dired+ installed, and it runs when evaluating the same section in Emacs after it has opened. However, it's not being recognized during startup. Has anyone faced this problem with dired+, and is there a way to load it properly on Windows?


texts: `:cache yes` makes the settings on `#+RESULTS` erased whenever executing the block

texts:
:cache yes makes the settings on #+RESULTS be erased whenever execute the block.

For example, I want an image file be resized into width 12cm for LaTeX -> PDF exporting. However, #+ATTR_LATEX: :width 12cm :float c on top of #+RESULTS[fce2...]: will be erased (if the image is need to be updated after compared the SHA1) when evaluate the block...

#+tblname: standard
| Standard Conc(ppm) | Value |
|--------------------+----------------|
|                  0 |              0 |
|                 10 |          0.264 |
|                 20 |           0.52 |
|                 30 |          0.739 |

#+begin_src gnuplot :cache yes :var standard=standard :file plots/standard.png
reset
set terminal pngcairo size 800,800 enhanced font 'WenQuanYiZenHei,14'
set xlabel "Standard Conc.（ppm）"
set ylabel "Value"

set style up points
set grid
set pointsize 5

stats standard using 1:2 name "STD"

# f(x)=a*(x)+b
line(x)=STD_slope*(x)+STD_intercept

set xrange [0:40]
set yrange [0:]
set xtics 0, 10, 40
set ytics 0, 0.1, 1

unset key
set label 1 sprintf("r = %4.4f\nR^2 = %4.4f\ny = %4.4f x + %.4f",STD_correlation, STD_correlation**2, STD_slope, STD_intercept) at graph 0.1, graph 0.9
plot standard u 1:2 notitle,\
     line(x) title 'Linear Fit'
#+end_src

#+ATTR_LATEX: :width 12cm :float c
#+RESULTS[fce2bedf80238d089cc3e5d79570ccf6520eddaf]:
[[file:plots/standard.png]]


texts: Initialization error related to tramp scp function

texts:
When I open emacs, I get an initialization warning:

Warning (initialization): An error occurred while loading
`/Users/myusername/.emacs':

Invalid function: ([scp myusername 128.my.ip.addr nil nil] (locale
LC_ALL=en_US.utf8) (uname Linux 4.4.0-93-generic) (test test) (remote-path
(/bin /usr/bin /sbin /usr/sbin /usr/local/bin /usr/local/sbin))
(remote-shell /bin/sh) (~ /home/myusername) (ls /bin/ls --color=never)
(ls-dired t) (stat \stat) (file-exists test -e) (id /usr/bin/id)
(gid-integer 1002) (gid-string myusername) (perl-file-spec t)
(perl-cwd-realpath t) (perl \perl) (readlink \readlink) (git \git))

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the `--debug-init' option to view a complete error backtrace.

(My username and IP address are anonymized above.)

The offending function appears to be the first entry in my .emacs.d/tramp file. I tried deleting the tramp file. Upon immediately restarting emacs, there was no warning -- good. However, upon starting my next emacs session, I got the same warning, but pertaining to a different scp connection (the one that now happens to be the first entry in my tramp file).

I would like to figure out a couple things:

Why is the function invalid?
How can I prevent this warning message from appearing every time I open emacs?


texts: web-mode sql detection doesn't activate syntax highlighting

texts:
we edit freemarker template engine files with web-mode.
The files also contain a lot of SQL.
I added

    (defun my-web-mode-hook ()
    "Hooks for Web mode."
    (setq web-mode-enable-sql-detection t)
    )
    (add-hook 'web-mode-hook  'my-web-mode-hook)

to .emacs file, but don't geht syntax highlighting for the SQL.

Is it possible to highlight freemarker as well as SQL-Code?

Thanks for any suggestion

Meikel


texts: Redirect compilation mode hyperlink to external tool

texts:
I have a working compilation error matcher, that contains the path to a file. The compilation buffer correctly adds a hyperlink to that file and I can open it in emacs. However, the file in question is an html report which I would like to open using an external browser. I already know how to modify the file element, so I could change it to give emacs a hint to open it with system tools. I think of something similar to a trump prefix for find-file, but in this case for overlay hyperlinks. Does such a prefix exist?

As a bonus question: I would like to not use the system default browser but a specific one, say firefox. How could that be done?

Note: I think as a last resort to try something like openwith, but this would smell more like a hack, because in general I want to open end edit html file in emacs.


texts: Binding a key sequence to a key sequence instead of a command

texts:
In my .emacs, I tried to use

(global-set-key (kbd "M-r") (kbd "C-x r j")

so I can use M-r to jump to a register. However, doing this and using the command gives

After 0 kbd macro iterations: Args out of range: [], 0

as an error in the minibuffer. Looking up the shortcut with C-h k shows that the keyboard shortcut is bound to jump-to-register. Then, using

(global-set-key (kbd "M-r") 'jump-to-register)

gets the desired behavior, and my shortcut works.

My question is: why doesn't my first attempt work, esp. if it just really seems to be calling the same function?


texts: I'm using Quitter or Twitter to send out short messages. Most of my Queets/Tweets go out through the web interface. However I'd like to use Emacs for it. Does anyone a good method/mode to use with Quitter or Twitter?


texts: Workflow to collect TODO notes from various files into an org agenda

texts:
I often want to add TODO notes inside of my latex files I am currently working on or inside of other source code files scattered around in my filesystem.
The problem with this is that those TODO notes doesn't appear in my org agenda file obviously.
So is there any clever way to make TODO notes inside non org files (in my case mainly latex and python but I guess that shouldn't matter) and then collect them in my org agenda? In particular it would be great if the TODO notes could also contain timestamps as in regular org files.
Is there an alternative workflow I should consider for this?


texts:
How do you execute multiple actions on a single org-link?

Org-mode has links that can initiate actions, such as elisp: and
  shell:. It would be nice to initiate several such actions on
  following a single link.

Just creating a shell-file containing the tasks is possible, but
  seems inelegant.

How is this best done?


texts: Which mode is best for a special configuration file, specifically logstash

texts:
I'm using logstash and its configuration file (documented here) looks like this:

input {
  file {
    path => "/some/path/to/file"
    option => 1
  }
}
filter {
  if [var] == "string" {
    action {
      array_option => [ "val1", "val2", "val3" ]
      object_option => {
        str_option => "string"
      }
    }
  }
}
# this is a comment
output {
  stdout
}

I'm looking for a helpful emacs mode that works well with files like this. The conf-mode does good highlighting, but I can't get it to indent properly. Any suggestions?


texts: How to insert current time (hh:mm) in org mode without date

texts: How can I insert the current time (format hh:mm) in org-mode without a date, i.e. just the time?


texts: How to change projectile-bookmarks.eld saving path?

texts:
emacs keeps generating file called projectile-bookmarks.eld in home directory.
How could I make it to save that file under ~/.emacs.d/tmp or a different path?

I also keep seeing Reverting buffer ‘projectile-bookmarks.eld’. whenever I open a new buffer.

As solution I have been told that:

you can modify the variable projectile-known-projects-file

I have done: (setq projectile-known-projects-file "~/.emacs.d/tmp/projectile-bookmarks.eld")
Now the file is generated under ~/ and ~/.emacs.d/tmp/. How can I prevent it to saved under the home directory?


texts: Error while trying to set a slot of a cl-struct

texts:
Using Emacs 25.1.50.1

To set the slot of a structure, I believe the elisp manual says to use setq along with the accessor function for the slot. Though I am having trouble.

The following code results in an error on the fourth line.

(require 'cl)
(cl-defstruct foo name)
(setq bar (make-foo :name 'john))
(setq (foo-name bar) 'jim)

Message:

eval: Wrong type argument: symbolp, (progn "Access slot \"name\" of    `foo' struct CL-X." nil (or (progn nil (and (vectorp bar) (>= (length bar) 2) (memq (aref bar 0) cl-struct-foo-tags) t)) (signal (quote wrong-type-argument) (list (quote foo) bar))) (aref bar 1))

Also there is no cl tag to use for the Emacs Common Lisp Emulation Library... don't know what else to put it under, just going to put it under common-lisp for someone to help me find the right tag.


texts: tangle the same src block to different files

texts:
I would like to tangle a single src block to several files, rather than just one. Ideally I would write something like

#+BEGIN_SRC conf :tangle one.conf two.conf three.conf

but this produces one file names “one.conf two.conf three.conf"

I can make it work by creating a named reference with noweb and then creating three different source blocks each tangled to the corresponding file but this seems to be a bit baroque (and error-prone)

Is there a clean way to do what I want?

Use-case: creating conf files for slightly different situations without code duplication.

Thanks in advance


texts: Completions buffer messes up window sizes

texts:
I am not sure what to search for. I have used emacs for 25+ years, but I am not a guru. I use it as a tool, and I don't want to spend much time changing it.

I generally like to have one window, or two windows that are each half height. I don't like it when some command or mode changes the height of one of the windows to more or less than half.

For example, when I'm in a shell buffer and use tab completion, the buffer with completion options changes the window sizes, and I have to manually restore them to a 50-50 split.

I seem to remember fixing this in the past, but I don't remember how. I don't know what command or mode is doing this now, but seems to be very often since the last major release. Can someone fix this or tell me how?

Sorry if my tone is not pleasant. This is pissing me off much more than it should.


texts:
Following one of the answers from here for managing two distinct indexes, I need to call

makeindex -t mydoc.plg -o mydoc.pnd mydoc.pdx
makeindex -t mydoc.slg -o mydoc.snd mydoc.sdx

when I want to update my indexes. How can I tell Auctex to call these two lines in an automatic way? Should I do something like "override" the Index command from Auctex?


texts: elpy with ipython as rpc -- how to get good autocompletion

texts:
I'm using elpy with emacs and python3.  Here's the relevant part of my .emacs:

;; PYTHON
(elpy-enable)
(setq elpy-rpc-python-command "python3")
(elpy-use-ipython "ipython3")
(autoload 'jedi:setup "jedi" nil t)
(add-hook 'python-mode-hook 'jedi:setup)
(add-hook 'pyvenv-mode-hook 'jedi:setup)
(setq jedi:setup-keys t)
(setq jedi:complete-on-dot t)

Now, if I create a class in a python file, auto completion works perfectly.  Then I try C-c C-c, and the class is loaded up in my ipython buffer, and I can play around with it.  So far so good.

Unfortunatly, this is where I really want auto-complete, but my autocomplete experience here is a little unsatisfactory.  Out of the box I can use tab to get completions in another window, but I'd like the "on dot popup" I get in python mode.   Executuing jedi:setup gives me popups, but it's just builtins, and not my class methods.

How can I get the same auto complete behavior in my ipython rpc buffer as I get in my python editing buffer?


texts:
I'm new to emacs and AUCTeX and I'm having a problem with document preview (C-c C-p C-d). My LaTeX file is the following

\documentclass[11pt, a4paper]{report}
\usepackage{cite}

\begin{document}
\tableofcontents

\chapter{Introduzione}

\emph{This is important}

$$
e^{\pi i}+1=0
$$

\cite{Col73}

\bibliography{bibliography}{}
\bibliographystyle{plain}
\end{document}

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% End:

and, of course it compiles. When I try to preview it I get the following messages:

Running `Preview-Ghostscript' with ``/usr/bin/rungs -dOutputFile\=\(pippo.prv/tmp6365EzV/pr1-\%d.png\) -q -dDELAYSAFER -dNOPAUSE -DNOPLATFONTS -dPrinted -dTextAlphaBits\=4 -dGraphicsAlphaBits\=4 -sDEVICE\=png16m -r99.0866x99.0685''

Preview-Ghostscript exited abnormally with code 1 at Thu Feb 15 11:11:16
Unable to read environment locale:exit now.

Preview-Ghostscript exited abnormally with code 1

My emacs version is 25.3.1, GS is 9.22. I read around that there were some incompatibility between such versions.
Do you know how to solve the problem?


texts: Accessing square bracket in Emacs with German Keyboard on Macbook with OS X

texts:
With the Germany keyboard layout you need to press ALT aka M to reach certain character one needs for programming C,C++, Java, JS, etc. For instance to reach square brackets [, ] you need to press M-5 or M-6. But when I press alt-5 (M-5) on my Apple Powerbook keyboard my Emacs/Spacemacs responds: No window numbered 5.

What would be a good way to either remap another key like fn as Meta-key or change the keyboard layout on my Macbook Pro for some characters.


texts: Differentiating between raw prefix arguments

texts:
Is there a way to differentiate between different numbers of raw prefix arguments (e.g. C-u vs. C-u C-u) aside from checking whether the argument is (4), (16), etc.?

This seems to be what packages like Smartparens do, albeit with thin wrapper functions.


texts: emacs as python IDE vs pycharm: spacemacs and code navigation

texts:
[2016.12.23]:
I'm trying to make emacs be usable for working with python code.
By 'usable' I mean I could rely on it with code navigation and completion.

I'm using spacemacs + anaconda-mode for it, but I'm not 100% satisfied.

For example, when I try to visit definition of 'get' function with M-. (anaconda-mode-find-definitions), I end up with message: "no definitions found". On the other hand, PyCharm does the job with it.

#!/usr/bin/env python

from avocado import Test

class MyTest(Test):   # M-. on 'Test' ends up in test class. This is fine.

    def test_mine(self):
        myParam = self.params.get(key='myParm', path='/', default=None)  ## M-. on 'get' fails. PyCharm does the job.

if __name__ == "__main__":
    main()

I also tried to use elpy+jedi, but no luck as well.

What is Your experience with this simple example?

The code above uses avocado testing framework.

regards

[2016.12.27]:
Below is another example, yet one I need, but hopefully also using more maintainable library, scapy: the packet forging library. All three imports are legal to execute the code, but only the last one makes emacs be able to jump to definition

#from scapy.all import *     # imports all from scapy.layers.all, but it is not enough for emacs to see IP() def.
#from scapy.layers.all import * # gets all from scapy.layers.inet, but it is not enough for emacs to see IP() def.
from scapy.layers.inet import *   #. ok with this.

packet = IP()
print packet.mysummary()

Question is is it possible to make emacs jump to definition when either first or second header is used instead of third one?

[2016.12.28]:
Here is another example where my emacs python environment neither completes nor jumps to definition, although the code runs without error. it requires "pip install pyvim pyvmomi".

from pyVmomi import vim

vim.vm.CloneSpec()

How about Your emacs environments, do they handle such cases?


texts:
I'm using emacs-lsp with company-capf. While editing an elisp file, it works fine. However, once I run eval-buffer, I get the following error when trying to use completion:
Company: backend company-capf error "The connected server(s) does not support method textDocument/completion.
To find out what capabilities support your server use ‘M-x lsp-describe-session’

My emacs-lsp config is:
(use-package lsp-mode
  :hook ((c-mode          ; clangd
          c++-mode        ; clangd
          c-or-c++-mode   ; clangd
          python-mode     ; mspyls
          ) . lsp)
  :commands lsp
  :config
  (setq lsp-auto-guess-root t)
  (setq lsp-diagnostic-package :none)
  (setq lsp-enable-symbol-highlighting nil)
  (setq lsp-enable-on-type-formatting nil)
  (setq lsp-signature-auto-activate nil)
  (setq lsp-modeline-code-actions-enable nil)
  (setq lsp-modeline-diagnostics-enable nil)
  (setq lsp-enable-folding nil)
  (setq lsp-enable-imenu nil)
  (setq lsp-enable-snippet nil)
  (setq lsp-enable-completion-at-point nil)
  (setq read-process-output-max (* 1024 1024)) ;; 1mb
  (setq lsp-idle-delay 0.5)
  (setq lsp-prefer-capf t)


texts:
I'm curious how I get my emacs to use the git org-mode repository. I have followed the instructions here. Now I have a ~/elisp/org-mode/ directory but I'm not sure how to get emacs to use this version of org. Issuing M-x org-version yields

Org mode version 9.0 (9.0-elpa @ /home/brian/.emacs.d/elpa/org-20161102/)

So, my emacs is using the org package from elpa. How do I get my emacs using the git version and not the elpa version?


texts: Hanging my emacs with a while loop. How to recover?

texts:
The following loop hangs my emacs (even when called with -q) to the point that I have to force quit it.

(let ((buffs (buffer-list)))
  (while buffs
    (delq (car buffs) buffs)
    (print (cadr buffs))))

I don't understand why this should happen, but is there something I can do to recover from a hanging Emacs?


texts:
How do I make Emacs give me live feedback on my syntax?

Like, after I finish typing a line of code, how can I make it so that Emacs tells me if that line isn't using correct syntax?

For example, in Eclipse, it'll tell you before you compile when a line is not correct (in Java, at least). How can I mimic that behavior in Java, C, etc. for Emacs?

Thanks!

Running Emacs 24 in Terminal by the way. Installed via HomeBrew on OSX.


texts: How to show commit authors in Magit section "Recent commits"?

texts: The "Recent commits" section in the status view shows short commit checksums plus the subject of the commit.  How can I also show the author of each commit?


texts: elisp: call org-todo, then find the resulting :LOGBOOK: drawer in the same function

texts:
Suppose I have the following setup:
(setq org-todo-keywords '((type "TODO(t!)" "IN-PROGRESS(i)" "WAITING(w)" "|" "DONE(d)")))
(setq org-log-into-drawer t)

So when I change the status of an item to TODO, the state change would be logged into the :LOGBOOK: drawer. the drawer would be created if it doesn't exist.
I'm trying to make use of this to create the :LOGBOOK: drawer by calling (org-todo "TODO")
I have this function:
(defun org-todo-test()
  (interactive)
  (org-todo "TODO")
  (search-forward ":LOGBOOK:"))

I put my cursor on a heading and call this function, I always get an error saying "search failed" even though the :LOGBOOK: drawer is created. It is as though the drawer isn't available in the buffer until (org-todo-test) has completed running.
Using (org-todo) to generate the drawer is probably a bad idea. But I'm still curious to know what the problem is here. Also if someone can share a better way to create the drawer it'd be great.


texts: Forcing the left-to-right order in all buffers

texts: How can I force all the letters go left to right including the characters from right-to-left languages in all buffers? Currently it displays the lines with right-to-left characters bidirectionally.


texts: mutt (and others) in ansi-term - terrible refresh rate

texts: I'm trying to run mutt in ansi-term in the GUI on OS X. The refresh rate is really slow for some reason, so when I try to navigate between emails the result is pretty much unreadable. Has anyone found a workaround for this / is there a dedicated emacs mutt front end? Also, apparently this problem is way old. https://www.reddit.com/r/emacs/comments/bk8pd/best_emacs_mail_client_for_a_mutt_user/


texts: I recently installed the latest version of emacs and Rust-analyzer, and downloaded the lsp-mode package as well, but when I activate the rust-analyzer with the "lsp" command it simply returns an error saying that the rust-analyzer keep loading


texts: Treemacs with Scala Metals/LSP: "Creating Pipe: Too Many Open Files"

texts:
I'm on spacemacs develop, emacs version 27, OSX Mojave 10.14.

After adding the lsp layer and the snippet from the metals documentation here:  to my .spacemacs file, treemacs will refuse to expand a directory and display its contents, giving the error "Creating pipe: too many open files"

My ulimit setting are:

$ ulimit -a
-t: cpu time (seconds)              unlimited
-f: file size (blocks)              unlimited
-d: data seg size (kbytes)          unlimited
-s: stack size (kbytes)             8192
-c: core file size (blocks)         0
-v: address space (kbytes)          unlimited
-l: locked-in-memory size (kbytes)  unlimited
-u: processes                       1418
-n: file descriptors                256

I suspect this is related to either metals or lsp-mode creating some large number of files in the compilation process. Though checking lsof:

$ lsof | grep -iE "sbt|ivy2" | wc -l
    1585

doesn't show too many open files related to sbt or ivy.

Running list-buffers I show only 10-20 buffers; nothing unusual.

When this happens, I cannot even exit Emacs and have to kill -9 the process.


texts: CIDER inspector unable to refresh a modified atom

texts:
With the CIDER inspector I'm able to view the contents of an atom. I can do C-u C-u C-c M-i and input the atom with an @ prefix and the value displays correctly. Now, if I keep the inspector window open and modify the atom, then upon refreshing (g) I would expect the modify value to appear. However, this is not the case.

Which made me think... At the top of the inspector window I can see the following type information: Class: clojure.lang.PersistentVector. So probably what gets passed to the inspector is the raw value after dereferencing the atom, i.e. the inspector does not know it's dealing with an atom.

Am I missing something important here? I mean, shouldn't the correct behavior be for the inspector to deal with the whole extent of inspected entity - in this case to recognize the atomicity of passed expression?


texts: "TeX-insert-quote" does not work anymore

texts:
Emacs "suddenly" stopped automatically inserting the correct quotes once I hit the " key. It seems to me that this is due to a duplicate installation of some package, but I can't put my finger on it.

There are some commands that seem to duplicates, so far I stumbled over the following:

latex-mode
LaTeX-mode
tex-insert-quote
TeX-insert-quote (")
tex-insert-braces
TeX-insert-braces (C-C {)

Sadly, even though helm tells me that TeX-insert-quote is bound to ", it does not seem to trigger. And even if I call it manually, it simply inserts " into my text instead of ``correct'' quotes.

Can anybody point me out where to start diagnosing this behaviour?

Edit: After running C-h k " emacs tells me that it's indeed bound to TeX-insert-quote. So the trouble is not the binding, but something else.


texts: How can I define the syntax of a C-defined function with with module_make_function?

texts:
I've tried

#define DEFUN(lsym, csym, amin, amax, doc, data) \
  bind_function (env, lsym, env->make_function(env, amin, amax, csym, doc, data))

DEFUN("libgit2-core-status", Flibgit2_status, 1, 1, \
  "\\(fn PATH) libgit2 status test return branch \\(fn PATH)", NULL);

but I still get this for C-h f libgit2-core-status:

libgit2-core-status is a Lisp function.

(libgit2-core-status &rest ARGS)

\(fn PATH) libgit2 status test return branch \(fn PATH)


texts: Prevent abbrev expansion on capitalization

texts:
Is there a way to get abbrev expansion on a lower case abbrev but not on its upper case version?

E.g.: I have "r" expanding to "are". I'd like "R" to stay "R".

I don't necessarily want to get rid of capitalization completely, so I'd still like "Btw" to expand to "By the way", but if there is no other option I'd take it.


texts: Sort of autoreply for specific messages in minibuffer

texts:
Every time when I call M-x projectile-regenate-tags I get bothered with the message

Tags file a:/foobar/TAGS has changed, read new contents? (y or n)

which is quite cumbersome. Especially when I wanted to add the command to a after-save-hook.

So I was thinking about a defadvice, or command to press y in the minbuffer that I could do in a function same with (projectile-regenate-tags).

Any idea in order to do so?