texts: Enable .dir-locals.el variables inside just opened buffer

texts:
I'm programmtically create a new buffer as a result of shell command

(defun jira-ticket-view (&optional jira-ticket)
  "Open Jira Ticket Inside Emacs"
  (interactive)

  (setq jiraURL (get-jira-url))
  (setq jiraPrefix (get-jira-prefix))

  (if (not jira-ticket)
    (setq jira-ticket (get-jira-branch)))

  (setq buffer jira-ticket)
  (let ((b (get-buffer-create buffer)))
    (switch-to-buffer b)
    (markdown-mode)
    (insert (
        concat "## Open in Jira: [" jira-ticket "](" jiraURL "/browse/" jira-ticket ")\n"))
    (insert (
        concat "## Kanban Board: [Open Board](" jiraURL "/browse/" jiraPrefix ")\n"))
    (insert (
        concat "## My Open Issues: [Open Issues](" jiraURL "/projects/" jiraPrefix "/issues/" jira-ticket "?filter=myopenissues)\n\n"))
    (insert (
        shell-command-to-string (
            concat "j view " jira-ticket "  | dos2unix")))))

however when I'm in this buffer and trying to run a custom defun  that expects some local variables to be set - such command fails with

list: Symbol’s value as variable is void: jira-project-users

this is my

.dir-locals.el

((nil . ((jira-project-prefix . "PROJ")
         (jira-url . "https://domain.atlassian.net/")
         (jira-project-workflow-states . ("Cancel" "Ready For Development" "In Progress" "Ready for Code Review" "Ready for QA" "Back to Backlog" "Stop Development"  "Reopen"  "Verified" "Accepted"))
         (jira-project-users . ("User1" "User2" "User3"))
         (projectile-project-test-cmd . "npm run unit")
         (projectile-globally-ignored-files . ("node_modules"))
         (projectile-register-project-type 'npm '("package.json")
                                           :compile "npm install"
                                           :test "npm test"
                                           :run "npm run start"
                                           :test-suffix "unit.js")
         )))

and the following command fails if called in this buffer

list: Symbol’s value as variable is void: jira-project-users

(defun jira-ticket-assign (username &optional jira-ticket)
  "Assign ticket to a user"
  (interactive
   (let ((completion-ignore-case  t))
     (list (completing-read "Assign to: " jira-project-users nil t)))
  (message "You chose `%s'" username))

  (if (not jira-ticket)
    (setq jira-ticket (get-jira-branch)))

  (setq result (shell-command-to-string (
            concat "j assign " jira-ticket " " username)))
  ;(my-message "Result %s" result)
  ;(message "%s" (propertize result 'face '(:foreground "#A8E4A0"))))
  (message (colorize-ok-error-message result)))


texts: How to align based on capitalized words?

texts:
I have some SQL code in the following style:

"CREATE TABLE IF NOT EXISTS test ( \n\
\  id INTEGER PRIMARY KEY, \n\
\  symbol TEXT NOT NULL, \n\
\  date TEXT NOT NULL, \n\
\  val DECIMAL(10, 2) NOT NULL, \n\
\"

I'd like the datatypes to be aligned. In other words:

"CREATE TABLE IF NOT EXISTS test ( \n\
\  id     INTEGER PRIMARY KEY, \n\
\  symbol TEXT NOT NULL, \n\
\  date   TEXT NOT NULL, \n\
\  val    DECIMAL(10, 2) NOT NULL, \n\
\"

I thought using align-regexp with the pattern [A-Z]+ would work, but it does not. Using C-u M-x align-regexp with \(\s-*\)[A-Z]+ doesn't work either. Instead, it replaces the two spaces before the column names with a single space. I do not understand why this is.

So, my questions:

Why doesn't align-regexp with [A-Z]+ work? Searching based on the same pattern correctly identifies the text.
What is the right regexp that would get this alignment?


texts: How can I tell emacs to ignore the XF86AudioFoo keys?

texts:
Using 24.5.1 on OpenBSD 5.9. OpenBSD's sndiod listens for XF86AudioLowerVolume and the rest, but if emacs is running in graphical mode with either GTK2 or GTK3 (I haven't tried lucid/AWT, but I will if somebody thinks that will make a difference) instead of sndiod receiving that keypress, emacs writes "<XF86AudioLowerVolume> is undefined" in the echo area and sndiod never receives the key, so if I want to change the volume I have to un-focus emacs (which can be problematic in a tiling wm). It works fine in terminal mode, presumably because the controlling terminal knows to ignore the event.

Is there a way to tell emacs to ignore certain keypresses when it has focus?


texts: How can I prevent python-mode from occasionally highlighting everything as string

texts:
I use python-mode for my Python code, and every once in a while the syntax highlighter gets confused and thinks everything in the buffer is a string literal. This typically seems to happen when I create a docstring; for a few seconds after I type the quotes, everything after the cursor is highlighted as a string.

Is there any way to prevent this entirely? Or, if not, is there some way to make emacs/python-mode recover more quickly?

ed: To be clear, the incorrect highlighting persists even after the quotes have been closed and the buffer saved. But again, this is not every time, just sometimes.


texts: How do I stop a process with Ctrl-C in Term?

texts:
I'm very new to Emacs. I've opened a terminal with M-x term, and started a server running on localhost. It says Press CTRL+c to quit. However, Ctrl-C appears to be mapped to Emacs commands.

How can I use regular terminal shortcuts within Emacs?

Note that I am using DOOM Emacs (evil-mode).


texts: How to bring up the OS X `accented-characters` dialogue in Emacs on OS X?

texts:
Normally on OS X if you hold down a key, e.g. the a you get a menu after a little while that allows you to input an accented character. It looks like this:

Is it possible to activate this input dialogue from Emacs? Doing it the same way as on other OS X apps (by holding down a key) would be great, but I'd accept just being able to bind it to a key combination.

Edit: I install Emacs from http://emacsformacosx.com


texts: How to save all modified buffers and kill emacs

texts:
I use the well known key-binding C-x C-c to quit emacs. However this command asks y/n confirmation to save modified buffers and if there are process buffers (eg. Shell) it also asks for yes/no confirmation before to exit.

I'd like a command that save all modified buffers, then kill emacs. Is there any function that does do this?


texts:
I have a co-worker to edit LaTeX document.

The co-worker uses LaTeX \color and \sout command to make the changs visible in pdf file.

For example, Hello world becomes Hell{\color{red}\sout{o}a} world. What I do is remove the tags to make it Hella world. Can I make the process automatically?

What I want to do is that if I put a cursor on { and press assigned key, emacs will remove everything \color{red}\sout{...} including the outer brackets to leave only a.


texts: Find a version controlled project's root?

texts:
Trying to deduce a project root, using vc I'm getting errors, involving strange non-ASCII characters. I.e. invoking

(vc-find-root (expand-file-name (buffer-file-name (get-buffer "fname"))))

I get

eval: Wrong number of arguments: #[(file witness)
" ...several non-ASCII characters ..."
)" [vc-ignore-dir-regexp locate-dominating-stop-dir-regexp file witness locate-dominating-file] 3 2751734], 1

in the Message buffer. I'm not sure if this is a problem related only to vc.el or more generally to my setup/machine.


texts:
I have had (setq org-footnote-auto-label 'plain) in my init.el
to get footnote labels of the form[1].  But after updating to
version 9, I see this option is no longer supported?  Does
this really mean that there is no longer any way to get plain
footnotes??  (Surely there is no reason to prefer[fn:1] in documents that have no chance of containing false positives? which is true of all my documents.)


texts: Can I have a separate shell switch when compiling?

texts:
Whenever I use M-x compile, I like to have the shell that's running to be configured with bash -ic so that I can easily type the compilation command (I switch between languages often, so the building mechanism varies and I need have an interactive shell for appropriate auto-completion and language-specific bash aliases to be activated).

The "easy solution" would be putting the following at the top of my init.el:

(setq shell-file-name "bash")
(setq shell-command-switch "-ic")

However, having an interactive shell messes up a lot of important background tasks when launched by emacs (most importantly, emerge doesn't play nicely with it). Furthermore, interactive mode needlessly slows things down.

Is it possible to have one shell-command-switch when running M-x compile, and another for everything else? As a hacky first step, is it possible to redefine compile to first copy the old shell-command-switch value, set it to -ic, then evaluate the old compile, and finally switch the value back?


texts: iedit: replace from line to the end down

texts:
Windows 10, Emacs 25.1, package iedit

Suppose I has text:

1.aaa_1111_hello

2.aaa_2222_hello

3.aaa_1111_hello

4.aaa_4444_hello

5.aaa_1111_hello

6.aaa_5555_hello

7.aaa_1111_hello

8.aaa_1111_hello

...

100.aaa_1111_hello

I want to replace all (100 lines) "_1111" by text "_zero"

Steps:

Select text "_1111"

M-x iedit-mode`
M-D (to delete all find text _1111)
Input new text _zero

Here result.

1.aaa_zero_hello

2.aaa_2222_hello

3.aaa_zero_hello

4.aaa_4444_hello

5.aaa_zero_hello

6.aaa_5555_hello

7.aaa_zero_hello

8.aaa_zero_hello

...

100.aaa_zero_hello

OK.

But now I want to replace text ONLY from line "5.aaa_1111_hello" and to the end down.
So as result I need to replace 98 lines.

The result must like this:

1.aaa_1111_hello

2.aaa_2222_hello

3.aaa_1111_hello

4.aaa_4444_hello

5.aaa_zero_hello

6.aaa_5555_hello

7.aaa_zero_hello

8.aaa_zero_hello

...

100.aaa_zero_hello

Is it possible by iedit?


texts: Programmatically replace all instances of regex with capture groups and sub-matches in buffer

texts:
It is clear to me how to programmatically replace all instances of regex in a buffer with some text, something like (pardon my naive code):

(defun my/regex-global-replace (regex subst-text)
 "Globally replace `regex' with `subst-text' in current buffer"
 (goto-char (point-min))
 (while (re-search-forward regex nil t)
 (replace-match subst-text)))

But I can't figure it out how to do a similar global replace when using capture groups and sub-matches.

I am aware of this answer and the Cookbook entry, but it does not help me much, since it is not clear how I could use the sub-matches to replace text globally.

How could one write a broader version of the code above, so that it deals with sub-matches, something like:

(defun my/regex-global-replace (regex1 regex2)
 "Replace `regex1' with `regex2' in a buffer."
 (goto-char (point-min))
 (while (re-search-forward regex1 nil t)
 (replace-match regex2)))

Where regex1 may contain a certain number of capture groups, like,

(setq regex1 "some text \\([[:digit:]]+\\)")

and regex2 a related sub-match, the equivalent of PCRE's $1 or \1?

Example

As an example, say I have a buffer with content,

Some text 123
Some more text 456

I would like to programmatically run a global search-and-replace that would, as example, change text but keep the numbers,

Changed text, keep digits 123
Changed text, keep digits 456

In some other languages (Perl comes to mind), I would create a search regex with a capture group, and a replace expression using the sub-matches, something like

s/(\w+\s+)+(\d+)\n/Changed text, keep digits \2\n/gim


texts:
Am about to give up on getting this package working have tried the following options:

From the prettier docs, installed the package from melpa and added the following to init.el:

(require 'prettier-js)
 (add-hook 'js2-mode-hook 'prettier-js-mode)

Running M-x prettier-js results in the error: Searching for program: No such file or directory, prettier
Tried the use-package configuration from the answer: activate prettier-js-mode after every save

Running M-q results in the error: Autoloading failed to define function prettier and using M-x prettier-js again results in Searching for program: No such file or directory, prettier.

Really not sure what the problem is here, the package is downloaded and present in my elpa directory. Any help is greatly appreciated.


texts: Why is the Projectile Git repository being set to the most recently cd'd directory?

texts:
When I run projectile-find-file in GUI (non-terminal) Emacs, the project directory is set to the directory I most recently cd'd to in a terminal window.

Let's say that I have a home directory not under version control, as well as two Git projects, ~/foo and ~/bar. If I do the following

Open a file in ~/foo in Emacs.
Open a terminal window and run cd ~/bar.
Run M-x projectile-find-file.

it will show me the files in ~/bar.

And if I cd to the home directory in iTerm, I get this message:

fatal: Not a git repository (or any of the parent directories): .git

The expected behavior is that it would show the files in ~/foo regardless of what directory was most recently cd'd into.

When I run projectile-project-info, it shows the correct project directory (e.g., Project dir: /Users/pat/foo ## Project VCS: git ## Project type: emacs-cask).

I don't know whether this is a bug or I configured something wrong. It used to work correctly. I'm using Emacs 25.1 and Projectile 20160921.902.


texts: How to require/provide a package name with the value of `user-login-name`, without hard coding it?

texts:
I am trying to load package depending on a user's login name
For example:

If a user's login name is "user_foo", I would like to (require 'user_foo). I don't want to hard code the user's login name.

I tried:

(require user_login_name)

I got `wrong type argument: symbolp, "user_foo"
What's the right way to do it?


texts: shell-mode `alias` keyword is not recognized as font-lock-builtin-face type

texts:
In shell-mode; alias keyword is not recognized as font-lock-builtin-face type and remain as white color (with the current theme I am using it should be in different color)
=> Is it possible to add alias keyword into font-lock-builtin-face class?

This issue occurs in Ubuntu machine; with the same configuration it does not occur in a mac machine.


texts: How can I invert a helm-swoop match, i.e. how can I show all lines not matching the pattern?


texts:
How can I create a keyboard macro where a file myfile is opened by executing M-x openmyfile. The main part should look like

(fset 'openmyfile
   [?\C-x ?\C-f <dir of myfile> return])

but I don't want to enter the whole dir to myfile by writing every single char using ?/ ?d ?i ?r ... and so on. How to insert the dir string into the macro definition?


texts:
I'm hoping this is possible. I work in a variety of environments and languages. Right now it's mostly django and Node.js, but there have been others. What I would like to do is set the web-mode engine based on the project I am currently working on, and not the file extension. I know I could use .djhtml as the file extension, but that messes things up for others who aren't using Emacs because, for example, Pycharm doesn't know what to do with a .djhtml file. I would prefer to keep my .html if at all possible.

I am wondering if there is any way to set the web-mode engine based on the project I'm working in. I'd rather not have to put -*- engine: django -*- into each of my files either, if I can avoid it.

UPDATE:

I've tried adding the following to a .dir-locals.el file, but it doesn't seem to make a difference. I get prompted to allow the variable change, and the value of the variable web-mode-engines-alist has changed to (("django" . "\\.html\\'")), but django is not set as the template engine when I open a .html file.

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

UPDATE 2

To clarify, I can set all .html files to open with the django engine by putting the following in my .spacemacs file:

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

That works just fine, but sets it globally, meaning I'll get the django engine in any .html file, regardless if it's a django project or another language.

SYSTEM INFORMATION

Emacs: 25.2.1
OS: Windows 10

I found this bug reported in web-mode (https://github.com/fxbois/web-mode/issues/799), but it's just referred to be asked as a question here.


texts:
I have a early-init.el file with:
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")

(unless (require 'el-get nil 'noerror)
  (require 'package)
  (add-to-list 'package-archives
               '("melpa" . "http://melpa.org/packages/"))
  (package-refresh-contents)
  (package-initialize)
  (package-install 'el-get)
  (require 'el-get))

(add-to-list 'el-get-recipe-path "~/.emacs.d/el-get-user/recipes")
(el-get 'sync)

If I don't put the last line (el-get 'sync)then I have no problem getting those commands Inserting Frequently Used Commands in a .texi file...
but, if I put (el-get 'sync) then C-c C-c runs the command TeX-command-master (found in
Texinfo-mode-map), which is an autoloaded interactive compiled Lisp
function in ‘tex-buf.el’ and I no longer have access to previous commands.
As I understand the problem comes from AUCTeX which includes a major mode for editting Texinfo files. This major mode is not the same mode as the native Texinfo mode of Emacs, although they have the same name.
How can I go back to Texinfo native mode ?
(Emacs Version 27.1 (9.0) on macOS BigSur Version 11.2)


texts:
Given a multibyte string "x=π", how to get 4-th byte of the string,
without creating string copy with something like string-as-unibyte?

Pseudo code: (string-nth-byte 4 "x=π").

Expected result: 128.

"x=π" = [120 61 207 128] <- bytes
         0   1  2   3    <- index

Any solution that is reasonably efficient is considered valid.
O(1) run time complexity is preferred.
If there is Emacs builtin for that, I will be very happy.

Notes:

Allocations must be avoided;
get-byte fails on multibyte chars;
I am aware of unibyte strings. They are not the answer;

If you ask: "Why on earth you need to do this?",
the answer is this.


texts: org-babel for vimscript or most similar language

texts:
Since I couldn't find anything as per title, does anyone know what org-babel language could be used as workaround?

Currently I surround code blocks with #+begin_src sh, though in particular the comments " are obvisouly not displayed correctly.

Or in other words (offtopic): What language uses " for comments and is supported by org-babel?


texts: How to set backslash character "\" to be a word constituent in LaTeX-mode syntax tables

texts:
In LaTeX-mode (AUCTeX) buffers, the backslash "\" is treated as an escape character. I'd like it to be treated as word constituent (syntax class "w") instead, but only in LaTeX-mode buffers. The main reason is that it's more convenient for moving and deleting word-wise (M-f etc), including macros with their backslashes.

Some answers to questions like Treat symbols as words in prog modes suggest to use "superword-mode", but that doesn't work for me because it changes the underscore syntax, which is not what I want. Others suggest to use

  (modify-syntax-entry ?\\ "w")

or

  (modify-syntax-entry ?\\ "w" ***-mode-syntax-table)

at appropriate places in the initialization file, where "***" is the current mode.

Unfortunately the first solution changes the backslash syntax globally The first solution is buffer-local, as @Stefan pointed out, and it works if inserted in the LaTeX-mode hook. But the second doesn't work if I replace "***" with "latex", "tex", "LaTeX", or "TeX".

Any idea why the second command above is not working in latex-mode buffers? Cheers!


texts: Howto display unicode character \u2026 in terminal mode in emacs

texts: Magit uses Horizontal Ellipsis unicode escape "\u2026" (which should display as "...") to mark hidden section. How can I configure the Terminal/Emacs to display them when running in terminal mode (option -nw)? The escape string is shown instead of the visual icon. Maybe I need to install a special font? I'm running emacs 26.1 running inside KDE Kconsole terminal emulator.


texts:
I found different solutions for keeping auto-save files out of the directory where the original file is located on the internet, including

(defconst emacs-tmp-dir (format "%s/%s%s/" "/t" "emacs" (user-uid)))
(setq backup-directory-alist
      `((".*" . ,emacs-tmp-dir)))
(setq auto-save-file-name-transforms
      `((".*" ,emacs-tmp-dir t)))
(setq auto-save-list-file-prefix
      emacs-tmp-dir)

which I currently use.

It works, but only for files on "shallow" levels of my deep directory tree. When editing files many directories down, I get an error message like this (which I partly censored because it got someone else's name in it):

Question

How do I get auto-save to work for these files?

Additional info

This page helped me solve the same problem for backup files ("How to set emacs so backups in one place with tree structure?") but I can't seem to figure out how to solve it for auto-save files. (Just leaving the link here in case the code has only be adapted slightly or someone who has the backup file problem stumbles across this question.)


texts:
Windows 10, Emacs 25.1, Helm

I want to find text "test3". So I use helm-occur

As result I get 5 candidates. Nice.

Now I want to edit text direct in buffer helm-occur.

How I can do this?


texts: Closing emacs results in "Current desktop was not loaded from a file" even though desktop-save-mode was set before start

texts:
I have set the following things in my .el file (not init.el):
(setq desktop-dirname         "~/.emacs.d/desktop/"
  desktop-base-file-name      "emacs.desktop"
  desktop-base-lock-name      "lock"
  desktop-path                (list desktop-dirname)
  desktop-save                t
  desktop-files-not-to-save   "^$" ;reload tramp paths
  desktop-load-locked-desktop nil
  desktop-auto-save-timeout   30)

(desktop-save-mode 1)

Although the desktop file is saved/updated to ~/.emacs.d/desktop the following happens. When I try to close emacs I get the following message:

"Current desktop was not loaded from a file. Overwrite this desktop
file?"

Even if I choose to overwrite it (and close emacs), the exact same thing happens the next time closing emacs.


texts: How to use helm-occur to search the whole word?

texts:
For example, I got the following lines:

1. abc
2. abc def
3. abc_def
4. _abc
5. abc_

and I want to search only the word abc, so only the 1 and 2 lines matches, I googled a while, it says \babc\b would work, but it doesn't work for me, and I found that \_<abc\_> works.

But I want to make it work with helm-occur, such as when I use the regular helm-occur (I bound it to Ctrl-s), it should work as default helm-occur, but if I called it with a prefix argument (Ctrl-u), it will search the whole word instead of string on top of the helm-occur.

Is there anyone knowing how to do this?


texts: Org-mode can not insert image in MacOs X

texts:
I can not insert any image to an .org file and export it to .pdf or .html file under MacOs X.

On the other hand, Ubuntu does successfully generates the image. In fact, it also shows the image inside org file. In both Os, I enabled inline-images but MacOs X does not do anything.

Did anyone encounter with the same issue and resolve it ?


texts: Correct markdown-format tables with orgtbl-mode?

texts:
I'm just learning about org-mode, and of course blown away by its sheer level of usability. I of course want to use it everywhere, so I want to create tables with it. Including tables in markdown-mode.

The problem I'm running into is that the row-and-column separators in org-mode look like + while in markdown-mode they look like |, so I don't end up with nice-looking tables on, say, Github.

Can orgtbl-mode be configured so that a separator row will look more like |---|---| instead of |---+---| ?


texts: Startup Emacs Daemon With Elfeed (RSS Feed Reader) Buffer

texts:
What I would like to accomplish is this:

Allow emacs daemon to start with my start up applications like normal
When I open an emacs frame I would like only the first one to start with my rss news feed from elfeed
When I open another frame I would like it to just open to the scratch buffer

I start the emacs daemon upon start up on startup with emacs --daemon added to my Autostart list. I have emacsclient -a "" -c "$@" bound to my launcher on my dock.

In my .emacs file I initialize elfeed just fine but my way of trying to start it is:

(elfeed-update) ;; Update elfeed when daemon starts
(defun start-elfeed ()
  "This function will start elfeed and update it."
  (if (not (get-buffer "*elfeed-search*"))
      (progn
       (elfeed)
       (switch-to-buffer "*elfeed-search*")
    )))
(add-hook 'after-make-frame-functions 'start-elfeed)

Now when I start emacs without the daemon it starts up in the scratch buffer and elfeed has not started, even in a background buffer. When I start it with emacsclient -a "" -c "$@" the daemon seems to start but a frame never pops up. In the terminal I get this error:

*ERROR*: Wrong number of arguments: (lambda nil "This function will start elfeed and update it." (if (not (get-buffer "*elfeed-search*")) (progn (elfeed) (switch-to-buffer "*elfeed-search*")))), 1

I am new to customizing emacs with elisp and could use some help here. Does that error mean that my start-elfeed function has the wrong number of arguments or am I using the after-make-frame-functions hook wrong?

Thank you for any pointers here.

Some other info:

Distro: Xubuntu 14.04
Emacs 24.5

Edit Nov 11
I changed my function to be like this now:

(defun start-elfeed (&optional frame)
  "This function will start elfeed and update it.  I think it needs FRAME Passed to it."
  (if (not (get-buffer "*elfeed-search*"))
      (progn
    (elfeed)
    (while (not (get-buffer "*elfeed-search*")))
    (switch-to-buffer "*elfeed-search*")
    )))
(add-hook 'server-visit-hook 'start-elfeed)
(add-hook 'after-make-frame-functions 'start-elfeed)

Now it calls (elfeed) but I don't think it is finished when it continues on to the (switch-to-buffer "*elfeed-search*") function. The *scratch* buffer is still the initial buffer but now there is a buffer called *elfeed-search*, with the RSS feeds in it. It seems like the switch-to-buffer call is being skipped over.


texts: Magit: patches that ignore some whitespace changes do not apply

texts:
Context: I'm doing a merge, and fixed the conflicts manually. Now I'm trying to stage changes hunk-by-hunk and make a commit.

Issue: some hunks are not getting staged.

Here's the output from magit-process buffer

  git … apply --cached -p0 --ignore-space-change -

  error: patch failed: filename.cpp:1302

  error: filename.cpp: patch does not apply

I was wondering what can be done to fix or investigate the issue. This is happening on Spacemacs on Fedora.

With some experimentation, I've found that this issue only happens when the flag --ignore-all-space is set, i.e., if I unset this, then I can stage the same hunk.

edit: This could be a possible bug since I could reproduce it on a smaller issue. I've made a bug-report here


texts: Fuzzy search for directory when you don't know the full directory name

texts:
Say I want to find a directory like:

foo/bar/bazz/bar/directory_name_looking_for/stuff.xml

And I don't know the intermediate directory paths, or the full directory name, but remember that the directory has the word looking in it.

I am using flx-ido like so:

(require 'flx-ido)
(setq ido-enable-flex-matching t)

Which joins very well for when I want to do things like f/b/b/b/d/stuff

Is there a good way to type looking and get a list of suggestions?


texts: How to call Elisp functions from my own implementation of a shell?

texts:
I'm writing my own shell which can handle most of the GNU/Linux system calls now. So I was wondering if I could make this shell call Elisp functions too. Is it possible to do so? Is so, how do I get started?
Basically, I want the shell to do what both Bash and Eshell can do.


texts: Bind function to variable and evaluate each time variable is referenced

texts:
I want to set a variable to a function that is run every time the variable is used. Like Lazy set in a makefile

(setq counter 0)
(setq counter (+ 1 counter))
counter ; actual: 1 wanted: 1
counter ; actual: 1 wanted: 2
counter ; actual: 1 wanted: 3

How would i go about doing this? =)


texts: Using the built-in backslash fringe bitmap

texts:
The built-in backslash fringe bitmap is somewhat mysterious in that it is not available to the user through a common name such as backslash or back-slash.  I created my own -- using fringe-helper-convert and define-fringe-bitmap -- but it looks like a miniature staircase instead of a good looking smooth line.

Is there a special name for the built-in backslash fringe bitmap, and if so, what is it called?

The following snippet demonstrates how to display a bitmap in the right fringe (assuming the fringe is visible and wide enough) -- the example uses a question-mark since the built-in backslash appears to be unavailable?

(let ((peol (point-at-eol)))
  (overlay-put (make-overlay peol peol) 'after-string
    (propertize (char-to-string ?\uE000) 'display
      '(right-fringe question-mark font-lock-keyword-face))))

Here are links to the limited documentation regarding fringe bitmaps:

http://www.gnu.org/software/emacs/manual/html_node/elisp/Fringe-Bitmaps.html

http://www.gnu.org/software/emacs/manual/html_node/elisp/Customizing-Bitmaps.html

The built-in fringe backslash is visible in the right fringe in a GUI version of Emacs when the fringes are turned OFF -- i.e., (set-window-fringes (selected-window) 0 0)

Here is my staircase-looking version of the backslash, which is not a smooth line.

;; AUTHOR:  Nikolaj Schumacher -- https://github.com/nschum/fringe-helper.el
;;
(defun fringe-helper-convert (&rest strings)
"Convert STRINGS into a vector usable for `define-fringe-bitmap'.
Each string in STRINGS represents a line of the fringe bitmap.
Periods (.) are background-colored pixel; Xs are foreground-colored. The
fringe bitmap always is aligned to the right. If the fringe has half
width, only the left 4 pixels of an 8 pixel bitmap will be shown.
For example, the following code defines a diagonal line.
\(fringe-helper-convert
\"XX......\"
\"..XX....\"
\"....XX..\"
\"......XX\"\)"
  (unless (cdr strings)
  ;; only one string, probably with newlines
    (setq strings (split-string (car strings) "\n")))
  (apply 'vector
    (mapcar
      (lambda (str)
        (let ((num 0))
          (dolist (c (string-to-list str))
            (setq num (+ (* num 2) (if (eq c ?.) 0 1))))
          num))
      strings)))

(define-fringe-bitmap 'backslash (fringe-helper-convert
  "XX......"
  "XX......"
  " XX....."
  ".XX....."
  "..XX...."
  "..XX...."
  "...XX..."
  "...XX..."
  "....XX.."
  "....XX.."
  ".....XX."
  ".....XX.") nil nil 'center)


texts: How to display minibuffer only when using m-x?

texts:
I use helm to do the common stuff and I have my "helm minibuffer" on top of the helm buffers. Therefore I don't really need the regular minibuffer anymore, except when I have to pass arguments to commands.

So I'm looking for a way to dynamically display the minibuffer, when I'm using M-x. In other words, I don't want the minibuffer to be displayed, except I am really using it.


texts: specifying a syntax-table for use with TAGS file for etags

texts:
It would be convenient if I could arrange for visit-tags-table to open the TAGS file automatically with the correct syntax table for the language of the files being indexed in it.  That way regular expressions would work the same way in the TAGS file as in the files indexed.

Does anyone know how to do that?


texts: highlight blank spaces only under the marked region

texts:
Is there a way to only highlight blank spaces/tabs under the marked region?

Basically if I have whitespace-mode turned off and if a select a region all the spaces and tabs get highlighted.


texts:
I just started working with rx and was able to achieve the opposite of the regex I wanted:

(rx-to-string `(: (or
  (: line-start (not ,comment-start))
  (: line-start (zero-or-more whitespace) line-end))))

Unfortunately, notting this regex was not as straightforward as I had hoped. I have tried many different variations with not, none of them working.

Would appreciate it if you could also show how to invert this regex too, so people looking up this q will get a simple example first:

(rx-to-string `(: line-start ,comment-start))

Thanks a bunch!


texts:
Polymode creates a distinct buffer for each mode involved.
Some use really inconvenient names, where the mode part of the name is easily longer than the actual document name itself, e.g. foo.Rmd[poly-head-tail].

Is it possible, if not eliminate the [] part of the buffer name, at least customise it.


texts: Emacs crashing on OSX, no crash log file

texts:
My Emacs started to crash a lot without modifying .emacs or installing anything new.

I can replicate the steps (using Helm, Projectile) by this:

helm-projectile
then I enter a query quickly and hit backspace
I have a crash.

According to GNU Emacs Crash page I should find a crash log but I am unable to find it in OSX. The OSX crash dump itself is useless for me. I would like to know what in my .emacs is wrong or which plug-in is failing?


texts:
I'm trying to export a table from an R code block and have read Results of Evaluation (The Org Manual) which states that tables can be output with header options of :exports results :results value table.
To get the table in the correct format I'm using the R package toOrg function from orgutils.
Unfortunately it doesn't appear to work with this simple example...
#+STARTUP: align
#+TITLE: Test
#+AUTHOR: Me
#+PROPERTY: header-args:R :session *org-R*
#+PROPERTY: header-args:R :cache yes
#+PROPERTY: header-args:R :results graphics
#+PROPERTY: header-args:R :width 1024
#+PROPERTY: header-args:R :height 768
#+PROPERTY: header-args:R :tangle yes

#+begin_src R :session *org-R* :eval yes :exports none :results output silent
  library(orgutils)
  library(tidyverse)
#+end_src

#+begin_src R :session *org-R* :eval yes :exports both :results value table
  employee <- c('John Doe','Peter Gynn','Jolie Hope')
  salary <- c(21000, 23400, 26800)
  startdate <- as.Date(c('2010-11-1','2008-3-25','2007-3-14'))
  employ.data <- data.frame(employee, salary, startdate)
  employ.data %>%
    toOrg()
#+end_src

Compiling to HTML I only get the code, no table is shown in the Org buffer itself (figures are shown inline) and no table in the resulting HTML.
If I execute just the R code within an R session it prints...
> employee <- c('John Doe','Peter Gynn','Jolie Hope')
> salary <- c(21000, 23400, 26800)
> startdate <- as.Date(c('2010-11-1','2008-3-25','2007-3-14'))
> employ.data <- data.frame(employee, salary, startdate)
>  employ.data %>%
    toOrg()
| employee   | salary | startdate  |
|------------+--------+------------|
| John Doe   |  21000 | 2010-11-01 |
| Peter Gynn |  23400 | 2008-03-25 |
| Jolie Hope |  26800 | 2007-03-14 |

Really can't see what I'm doing wrong here and any pointers would be gratefully received.


texts: derive major mode but do not derive mode hooks

texts:
I am trying to reuse lots of things that are built in c-mode for technically another c-like language, including syntactical highlighting and stuff like that.

However, c-mode in my settings are customized using mode hooks. Specifically, I have enabled following two lines in my c-mode-hook:

  (semantic-mode t)
  (semantic-idle-summary-mode t)
  (semantic-stickyfunc-mode t)

But this is breaking the major mode derived from c-mode, because semantic-mode has no idea how to parse the source file in another c-like language. Is there a way to derive a major mode from an existing one without running the hooks for the parent?


texts: I see "Unnecessary call to ‘package-initialize’ in init file" but can't find the call to `package-initialize`

texts:
I'm running Emacs from HEAD on Mac OS. I installed emacs-plus using the --HEAD argument with homebrew.

I did a whole grep for (package-initialize) in ~/.emacs.d/. The only reference I found to it is in elpa/flycheck, and I odn't require it at all, so it shouldn't run. Just to be safe, I customize the flycheck-emacs-lisp-initialize-packages variable to nil, meaning that flycheck shouldn't run package-initialize at all.

Is there anything I'm missing? Is there another place I should be checking?


texts: Why does gnu.org flymake documentation is for version 0.3, but elpa.gnu.org has version 1.0.8 available?

texts:
I have Emacs 26.1 installed. It has a built-in package flymake version 0.3. Also, googling flymake gives me https://www.gnu.org/software/emacs/manual/html_mono/flymake.html as the second link in the search output. It looks like the main and the most official documentation of flymake on the internet. It says "This manual is for GNU Flymake (version 0.3, April 2004)".

At the same time on https://elpa.gnu.org/packages/flymake.html there is a version 1.0.8 of flymake available. It looks less like a site with official information about GNU projects, but still it's hosted on the gnu.org domain. So, my questions are:

Why is the most official looking documentation of flymake about such an old version?
Are these actually the same packages?
Is the package https://elpa.gnu.org/packages/flymake.html supported by GNU or is it a third party package?


texts: How to debug c-mode-common-hook that doesn't fire

texts:
I'm using prelude mode, and in a file .emacs.d/personal/old-settings.el I have, amongst other things:

(global-set-key (kbd "C-c C-c") 'comment-region)

(add-hook 'c-mode-common-hook
      (lambda()
        (local-set-key  (kbd "C-c o") 'ff-find-other-file)))

Now when editing a c++-mode file, comment-region has been set, but ff-find-other-file hasn't.

I did F1 v c-mode-common-hook and see this:

c-mode-common-hook is a variable defined in `cc-vars.el'.
Its value is ((lambda nil
   (local-set-key
   (kbd "C-c o")
   'ff-find-other-file))
(lambda nil
  (run-hooks 'prelude-c-mode-common-hook)))

How would I go about debugging this? There doesn't seem to be a way to list-hooks, detect if the hook had already fired, etc.


texts:
Linux Mint Emacs 25.1

Remote repo URL

origin (h t t p://git.remotehostname.git)

In application SmartGit when I pull/push data from remote repo, it's prompt credentials ONLY ONCE.

But when I try pull data by Magit - it's prompt credentials EVERY TIME when I use magit-pull or magit-push.

How I can save credentials in Magit?


texts: How do I focus the Man mode window when it is displayed?

texts:
When I open a man page (e.g. M-x man cat) I would like to automatically move my cursor onto the man page. I already know how to achieve this behavior for *Help* and *Apropos*, and I want to get the same behavior for Man mode too. I have tried this:
(add-hook 'Man-mode-hook
          (lambda ()
            (pop-to-buffer (current-buffer))))

This works when opening a man page for the first time. However, when opening the same man page a second time, the Man window will be shown, but the cursor will not be moved to it. For example, if I do M-x man cat for the first time, the man page for "cat" will be shown and the cursor will be moved to it. However, if I delete the man page window (C-x 0) and ask for the same man page again (M-x man cat), the man page for "cat" will be shown, but the cursor will not be moved to it.
How do I automatically select the Man mode buffer when it is shown?


texts: How to use .dir-locals.el with Projectile?

texts:
I'm trying to ignore some file patterns while performing helm-projectile-grep and some with helm-projectile-find-file. I've found that it could be achieved using .dir-locals.el here.
Following this chunk of documentation I've made my .dir-locals.el looks like:

((nil
  (grep-find-ignored-files . '("*.log"))
  (projectile-globally-ignored-files . '("*.log"))))

When helm-projectile-grep is called it yields an error in helm-projectile:

Error running timer `helm-projectile-grep-or-ack': (wrong-type-argument stringp quote)

Since both emacs manual and projectile docs are sketchy about .dir-locals.el and it's usage I have few questions?

How .dir-locals.el works? Does it merge global and dir-local value of an variable? If I have a variable a which is '("a" "b") and set it in dir-local to '("c"), what is its value that Emacs use when I perform an operation in certain scope of .dir-locals.el?
What kind of structure is expected in .dir-locals.el for grep-find-ignored-files and projectile-globally-ignored-files?

On Projectile itself:

Why Projectile helm-projectile-grep and helm-projectile-find-file don't ignore file patterns which are already ignored in .gitignore? Is it turned off somewhere in my config?

Solution

According to accepted answer, if you want to ignore e.g all the .md files from Projectile operations in your project using .dir-locals.el you should do something like this:

((nil
  (eval . (set (make-local-variable 'projectile-globally-ignored-files)
               (append projectile-globally-ignored-files
                       (f-entries (projectile-project-root)
                                  (lambda (f) (string-match "\\.md$" f)) t))))))


texts: Are there any "reasonably priced" :-) keyboards with the Ctrl key to the left of the A key? I know I can remap keys, both in Emacs and in the host OS, but I'm looking for something in hardware. That way, I get the Ctrl key where I want it, even if I plug the keyboard into an arbitrary computer where I may have only limited control over the operating environment. The only ones I am aware of are the Happy Hacking Keyboards, but the cheapest one seems to be over $200. If I used it a lot, it would be worth it, but not right now...


texts: Symbol's function definition is void: org-export--get-global-options

texts:
I use a lot of embedded latex in my org files with drill mode. It worked fine with org 8, but recently I've upgraded to org 9, and now when I run C-c C-x C-l I'll get this error. My .emacs file contains the following code related with org and latex:

(setq org-latex-create-formula-image-program 'dvipng)
(setq org-format-latex-options (plist-put org-format-latex-options :scale 1.5))

I'm new to Emacs. What should I do to fix this?


texts: How to use org-capture without creating ID property?

texts: Whenever I create org-mode entries using org-capture they automatically get an ID property. Is it possible to disable that? I'm using org mode version 9.0.5.


texts:
In evil mode, >> increments the indentation level of the current line.
It does so at an org heading too, even though it would be more
appropriate there if it would increase the org level (the number of
stars).  I realize that I could, for instance, redefine the function to
which >> is bound to check if point is at an org heading and if so
take the appropriate alternative action.  But I suspect this would not
be the most correct way of doing it.  What would?


texts: Displaying a second buffer with a shell?

texts:
I would like to have a text buffer for writing to a file on the left side and a shell (zsh) on the right side for interacting with a REPL. Is that possible?

At the moment I realize that with tmux showing emacs in the left pane. But I wonder how this can also be done within emacs.


texts: run-python does not work if added to python-mode-hook

texts:
I would like the Python inferior process to start (if it is not already running) whenever I create a python-mode buffer (for example, by visiting a .py file).

Some functions in anaconda-mode etc. depend on an inferior Python process running.  Also, I want to be able to C-c C-c and see the output.

Everything works fine if I create the python-mode buffer, then manually run M-x run-python.

However, if I run (add-hook 'python-mode-hook 'run-python), then create a python-mode buffer, I get no inferior Python process but this error:

Wrong number of arguments: (1 . 3), 0

I don't know if it's relevant, but I have this in my custom.el:

(defvar python-shell-interpreter "ipython")
(defvar python-shell-interpreter-args "-i")

I had thought that this question would help but it doesn't.

Please could you advise how to create an inferior Python process if it is not already running?  Thanks in advance.

Versions:

Emacs 24.5.1 (i686-pc-mingw32)
prelude latest at time of writing
Python 3.5.1 (Anaconda 2.5.0 64-bit)
Windows 10


texts:
I'm trying to add some functionality to someone else's package, and so
I'd like to respect their patterns. Unfortunately, one of these
patterns is to not use kbd.

I need to bind a function to C-S-b, but I can't figure out how. I
know how to do this with a single modifier (e.g. "\S-b"), but I
can't get it to work with multiple modifiers.
I know I can just
evaluate (kbd "C-S-b") and use its output ([33554434]), but I'd
like something easier to read.

Here are a few things I've tried:

(define-key emacs-lisp-mode-map
  "\C-\S-b" 'test-command)
;;; Invalid modifier

(define-key emacs-lisp-mode-map
  [C-S-b] 'test-command)
;;; Does nothing

(define-key emacs-lisp-mode-map
  "\C-B" 'test-command)
;;; Binds C-b


texts: How do I keep the indentation on org-babel-tangle?

texts:
In literate programming, I often like to write my code in small snippets and then export them all at once via org-babel-tangle. This works great for non-indentation sensitive code (especially with post-processing), but doesn't work quite well with languages like Haskell or Python as org-babel-tangle removes the initial whitespace:
This is a completely self-contained example of the problem.
Copy it into an org-mode buffer and try both
=M-x org-export-dispatch= and =M-x org-babel-tangle=.

* A simple Python function
:PROPERTIES:
:header-args:python: :tangle example.py :padline no
:END:

Here's a small example function in Python:

#+begin_src python  :shebang "#!/usr/bin/env python"
def foo():
#+end_src

According to org-mode's documentation[fn:1], we can use `-i'
to keep the indentation, so let's do that on the continuation
of the aforementioned example:

#+begin_src python -i
    """Says hello!"""
    print("Hello, world!")
#+end_src

If we (org-export-dispatch) the file, then everything seems
nice. However, if we (org-babel-tangle) the file, then the
indentation is gone and thus our Python file invalid.

* Footnotes

[fn:1] See [[info:org#Literal Examples][info:org#Literal Examples]].

The -i switch doesn't seem to work for org-babel-tangle at all. While I could use <<noweb>> to glue the code together in a hidden, non-exported source block, I would rather like to have org-babel-tangle behave correctly.
Is there some hidden option I'm missing? How can I keep the indentation when I tangle files via org-babel-tangle similarly to the -i switch for exporting?


texts: I'm using magit and magit-gerrit, for easy changes, and reviews it works well, but I cannot figure out how to add a new patchset to a change that it is in gerrit


texts: Can't have semantic-mode turned on for Python buffers only

texts:
I'm trying to activate semantic-mode for Python buffers only:

(use-package stickyfunc-enhance
  :init
  (require 'stickyfunc-enhance)
  (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)
        (semantic-mode 1)
      (semantic-mode -1)))
  (add-hook 'change-major-mode-hook #'me/enable-semantic-maybe))

But I get:

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: Org-mode \ang from siunitx is overruled by the \angle symbol on pdf export

texts:
I'm trying to use the package siunitx to format my scientific notations/values more nicely, but I can't get one thing to work, possibly due to my pdf-process.

I type in my orgfile something like this: \ang{95;13;14}N.

Expecting it to output: 95°13'14". In stead it outputs
∠{95;13;14}N.

I #+INCLUDE: this file with my LaTeX settings:

# page setup
#+LaTeX_CLASS: article
#+LaTeX_CLASS_OPTIONS: [a4paper]
#+LaTeX_CLASS_OPTIONS: [12pt]
#+LaTeX_CLASS_OPTIONS: [twoside]

# placement of TOC anywhere
#+LaTeX_HEADER: \usepackage{titletoc}

# mathtools
#+LaTeX_HEADER: \usepackage{mathtools}

# fix margin
#+LaTeX_HEADER: \usepackage[innermargin=1.5in,outermargin=1.25in,vmargin=1.25in]{geometry}

# citation style
#+LaTeX_HEADER: \usepackage[authordate,bibencoding=utf8,strict,backend=biber,url=false,natbib]{biblatex-chicago}
# (internal) links
#+LaTeX_HEADER: \hypersetup{colorlinks=true,citecolor=blue,linkcolor=blue,citebordercolor={0 1 0},linktocpage,pdfstartview=FitH,anchorcolor=blue,filecolor=blue,menucolor=blue,urlcolor=blue}
# don't forget to #+LATEX_HEADER: \addbibresource

# chemical formulae
#+LaTeX_HEADER: \usepackage[version=4]{mhchem}

# SI units simplified
#+LaTeX_HEADER: \usepackage{siunitx}

And I use this line for my latex-pdf process in my init file:

(setq org-latex-pdf-process
     '("latexmk -pdflatex='pdflatex -interaction nonstopmode' -pdf -bibtex -f %f"))

Any ideas how to resolve this?

EDIT

I've opened up the exported .tex file and there I can see the problem:
org mode has exported \(\angle\)\{65;;\}N, so it seems like emacs is extending \ang into \angle. If I manually edit the tex file and export it works correctly.
Any idea how to stop it from doing this?


texts: How to show colours and clear when running React development server in eshell?

texts:
Here is how the usual Ubuntu terminal looks when you run the React development serving using npm start and make changes to your source:

Say the server was already running and you tried to do npm start again, you get notified in a colourful message:

And, if you say no, it exits cleanly.

However, I use eshell. This is how the same thing (the react dev. server) looks in eshell:

Observe how the output is appended onto the previous contents instead of clearing the screen. The colours are also missing. If the server is already running, this is how the eshell prompt looks like:

This is kind of a mess. Once you say no, it does not exit cleanly but shows the same message again before exiting.

My question is, is there a way to make eshell more like the ubuntu terminal? Is there a modern terminal package for Emacs that could handle these kind of things?


texts: Getting characters from current position to end of line as a substring

texts:
Is there a standard Elisp function which can return as a substring (without any of the text-properties) the characters from the current position of point to the last nonwhite space character on that line.

For instance if the line is Hello World and the point is on W it should return orld  .

Note in particular, if the line contains at least one non-whitespace character, I want everything only upto the last non-whitespace character.

If a line is blank or contains only white space characters I would like the function to return nil


texts:
I am reading the following blog on setting up Emacs to use pandoc in such away that C-c C-p will open the document in my browser.
It says:

Restart Emacs, and open a markdown file (for example test.md). Then select Options->Customize Emacs->Specific Option, enter markdown-command.
enter pandoc -f markdown -t html -s --mathjax --highlight-style=pygments in the "Markdown Command" field and select "Apply and save".
Then when you are editing your markdown file in Emacs, try C-c C-c p, the generated html will show up in your default browser.

What would be the Elisp entry in .emacs?
I am using Emacs 24.5.


texts: How to list a newly formed emacs minor-mode?

texts:
With some help from the blog post found here, I have managed to write a small code for a test package (a minor mode) named niranjan. It is as follows.
(define-minor-mode niranjan-mode
   "Hello world"
   :lighter " niranjan"
   :keymap (let ((map (make-sparse-keymap)))
             (define-key map (kbd "C-c i") 'insert-niranjan)
             map))
(add-hook 'text-mode-hook 'niranjan-mode)
(provide 'niranjan-mode)

I hope this is correct. I saved it in ~/.emacs.d/elpa/niranjan with the name niranjan.el. Now I expect niranjan-mode to be listed when I press M-x, but unfortunately it isn't. Note that I am opening a new session while pressing M-x to use my new mode. What should be done to make a package appear in the normal package/mode list? Is there something to be done to refresh the list of packages? Have I placed the .el file in a wrong location?


texts: How to set utf-8 encoding for *markdown-output* buffer?

texts:
I have emacs-24.5 installed on Windows 10. Many utilities are configured through cygwin, including perl. When in Markdown mode every so often after I press C-c C-c p to run the external markdown.pl against the buffer contents and open the resulting markdown-output buffer in the browser, I instead see the following:
The reason is that the original README.md file contains RIGHT SINGLE QUOTATION MARK character in UTF-8 format, which is the bytes E2 80 99, or 0x2019 code point in Unicode. markdown.pl interprets the character correctly in its output, I tried to run it from the command prompt and the resulting HTML is also in UTF-8 encoding.

Hence the question: how can I to configure markdown-preview function so as it sets markdown-output buffer coding system to utf-8 anytime I asked for markdown-preview?


texts:
I use the ace-window package to move focus from one Emacs window to another.  It uses the built-in function window-start to decide where to place an overlay that contains a number I would type to jump to that window. That is, to make that window (and the frame containing it) the focus of input.

Sometimes, a window will not display a number, making me guess how to get to it.

The window-start function is supposed to return the character position in the buffer that is the top-left visible position in that window.

It seems that window-start sometimes returns the position in that window's buffer that is one line above the actual first-displayed position. So, ace-window dutifully displays the number in a place that is not visible.

Has anyone else experienced this? Does anyone have suggestions on how I could fix it?

Speculation:
- Could it be thrown off by lines with unusual line-height such as those containing special glyphs like HEAVY CHECK MARK?
- Could it be caused by unusual fringes or a header-line?
[One buffer where I experienced this, had some lines with extra-tall characters. Another was an info buffer that had a header-line.]


texts: Kill the next sexp and its surrounding whitespace

texts:
kill-whole-line is quite useful as it completely deletes both content and whitespace unlike kill-line which only deletes contents in line. But in lisp-mode, it is necessary  to keep parens in tact and kill-whole-line fails there.

Update:

If point is in a buffer like this

|(setq foo "bar")
(setq foo1 "bar1")

if i kill line, it should become

|(setq foo1 "bar1")

but not

|
(setq foo1 "bar1")

On the other hand, if point is in a buffer like this

(defun foo ()
 |(message "foo"))

if i kill line, it should become

(defun foo ()
 |)

How can i kill whole line and keep parens intact?


texts: What is this area for and why the content inside it isn't showing correctly?

texts:
I'm using GNU Emacs with Doom. When using, I noticed an area placed before the line numbers. I don't know the name of the area. It is called "fringe". It is used by vi-tilde-fringe-mode, magit and dap-mode. However, the content inside it isn't rendered properly in GUI, and the area is not shown in the terminal.
The image: (see the characters appearing before Head and Recent, looks like > and v)

Is it normal is a problem? If it is a problem, how can I fix it?
I'm using:

Emacs: 27.1
Doom: 2.0.9


texts: Get org-mode link label from internal link?

texts:
Q: how do I extract an org-mode link label?

Given an org-mode internal link with the following format:

[[link-target][link-label]]

How do I extract link-label?

I need to process the link as a string, not interactively in an org-mode buffer.  I could write a regexp to do this, but am wondering if there's a function already built in.


texts: Updating code from lexical-let to lexical-binding: t

texts: This code shows an elisp function (third example) using lexical-let, which is now passe as I understand. How would it be written today with lexical scope now being a quasi-built-in feature of elisp? My first guess is just to drop the lexical- prefix to let, but does that change the rest of code, especially the funcall uses? Also, what are we winning with the lexical scope version over the first example?


texts: find-file for file path with space in windows

texts:
In Windows, both find-file and helm-find-file don't work if there's space in the file name. For example:

I move cursor to the anywhere in the string "c:/a/b.yaml", and then call find-file (C-x C-f), press RET, then Emacs will open the file.

but this doesn't work for "c:/a/b c/d.yaml", note the space in path, find-file will only manage to find the directory c:/a ....

If there a configurable variable or work round for this issue?


texts: ignore dependencies when setting CANCELED todo-state

texts:
CONTEXT

I have org-todo-keywords set to "TODO(t) | DONE(d) CANCELED(c)".

Also, I have configured org-todo-state-triggers to

(cons 'quote (list (cons 'todo (list (cons org-archive-tag nil)))
             (cons "CANCELED" (list (cons org-archive-tag t)))))

This sets the :ARCHIVE: tag on the entire subtree, once the todo-state is set to CANCELED. It also automatically removes the tag if the todo-state is changed back to TODO.

PROBLEM

Finally, I have org-enforce-todo-dependencies set to t.

This would prevent setting the todo-state to DONE, when any subtask is not yet DONE.

Unfortunately, it has the undesirable side-effect, that until all subtasks are in done state (i.e. DONE or CANCELED), I would not be able to set the parent task to the CANCELED state, as it is blocked by the enforcement rule.

Is there a way to make the CANCELED todo-state ignore the subtask dependencies, or even better, to set the entire subtree to CANCELED state atomically?


texts:
It's possible to install a new theme in spacemacs?
How should I do this? I'm trying to install some theme from http://themegallery.robdor.com/


texts: Org mode: Issue with export using HTML template with #+SETUPFILE

texts:
I have download two HTML themes from this git to my home directory. Following the instruction I have put the following line on top of my .org file:
#+SETUPFILE: "/home/myusername/org-html-themes/setup/theme-readtheorg-local.setup"

where theme.readtheorg-local.setup contains the following:
$ cat "/home/myusername/org-html-themes/setup/theme-readtheorg-local.setup"
# -*- mode: org; -*-

#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="styles/readtheorg/css/htmlize.css"/>
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="styles/readtheorg/css/readtheorg.css"/>

#+HTML_HEAD: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
#+HTML_HEAD: <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="styles/lib/js/jquery.stickytableheaders.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="styles/readtheorg/js/readtheorg.js"></script>

However, when I export using 'C-c C-e h o' the template is not applied at all.
I have tried putting the following on top of my org file before exporting it. This didn't do anything
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="styles/readtheorg/css/htmlize.css"/>
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="styles/readtheorg/css/readtheorg.css"/>

#+HTML_HEAD: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
#+HTML_HEAD: <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="styles/lib/js/jquery.stickytableheaders.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="styles/readtheorg/js/readtheorg.js"></script>

My ~./.emacs init file does not contain anything that relates to org-html. The only customized value is quoted below for ease of reference. org-html-preamble is currently set to STANDARD (default value).
(customize-set-variables
'(org-html-html5-fancy t))

Could someone please advise what I have done incorrectly and is there any extra configuration that is needed?
Thank you in advance.


texts: How to write a theme from all known faces?

texts:
I'd like to write a theme from all known faces (face colors and styles - as one would typically find in a theme).
There is a way to write themes customize-create-theme, however it only writes some colors, not all the colors listed from list-faces-display.
How can I do this?
Example snippet (not )
(deftheme my-theme "Description.")

(custom-theme-set-faces 'my-theme
  '(font-lock-keyword-face ((t (:foreground "#808bed"))))
  '(font-lock-preprocessor-face ((t (:foreground "#409090"))))
  '(font-lock-reference-face ((t (:bold t :foreground "#808bed"))))
  '(font-lock-string-face ((t (:foreground "#ffcd8b" :background "#404040"))))
  ;; -- snip --
  )

To give some context, I have my own theme which I'd like to update with some existing colors & face (bold/italic etc).


texts: I want to delight narrow-to-region. When I call org-toggle-narrow-to-subtree it calls org-narrow-to-subtree which calls narrow-to-region. When this is called the modeline shows "Narrow". Is there a way to delight that? I would like to replace that with a unicode character, which I did with minor modes. Help tells me that narrow-to-region is a c function an not lisp. Does this mean no delighting possible?


texts: Org-mode backend: access properties in heading

texts:
I currently begin to write a org-mode backend for a custom file format, so I can export from org-file to that format.

Therefore I need to apply properties (or attributes) to headings. My prolbem is now, how I could solve this.

I currently have the following headline function:

(defun org-mine-headline (headline contents info)
  (let ((full-text
         (substring-no-properties
          (org-export-data (org-element-property :title headline) info)))
        (p (org-element-property nil headline))
        (a (org-export-read-attribute :attr_mine headline)))
    (format "%s: [%s] %s" full-text p contents)))

Which gives me with the following org file:

* H1
#+PROPERTY: findme a
foo

the following output:

H1: [nil] foo

But I would like it to become something like that:

H1: [(:findme "a")] foo

I also tried attributes with no success:

* H1
#+ATTR_MINE: :findme a
foo


texts: Kill process buffer without confirmation?

texts:
I have C-x C-k bound to kill-this-buffer. But when I enter into a buffer which is running a process like Python or MySQL, if I do C-x C-k it asks

  Buffer "*Python*" has a running process; kill it (y or n)?

How can I kill process buffers without confirmation?


texts: I would like to have a section of my document for "Prep" - basically scripting stuff you need to have system wide in order run the document. It's not really relevant to anyone reading the document and I'd like to just have the entire subtree not included in exports. How would I do that?


texts:
I noticed something odd.  If I press M-P I get the message M-p is
undefined rather than M-P etc..  Is there a reason for this?

Version 26.2.  Using Arch Linux and the X window system.


texts: Org external link - can I indicate which browser/tab to be used

texts:
Suppose I have several browsers running at any given time.

Google Chrome
Google Chrome Canary
Chromium
Opera
Safari

How can I indicate in my org mode links

[[https://www.gnu.org/software/emacs/][GNU Emacs]]

which browser should be used when (C-c C-o) opening the link.

What I tried: Read https://orgmode.org/manual/External-links.html


texts:
To establish an ssh connection, I use the configuration file.;ssh remoteHost -F /home/alamd/ПакетыДоступа/root_91_211_249_142/config. Is it possible to transfer ssh connection settings from such a file to tramp? I found that it is possible to pass options through

  'tramp-ssh-controlmaster-options'

, but it seems there is no option to transfer the configuration file. Thanks.


texts: Limiting Emacs incremental search to a function definition

texts:
Any existing package that can do incremental search inside a function definition instead of the whole buffer?

Now the best I can do is to turn on semantic-mode along with semantic-stickyfunc-mode and carefully search within its scope.


texts: Search for either of two words using isearch

texts: Is there a way to use isearch (only search i think that works in pdf-tools)? to search for either of two words at the same time? It would search in the pdf for 'eval' or 'valid' and move forward in each occurrence of either word?


texts:
I'm trying to debug a piece of elisp that is in an orgmode template I'd like to use. (link here)
The problem is occurring in the source block that is supposed define the cite links.
(org-add-link-type
 "cite" 'ebib
 (lambda (path desc format)
   (cond
    ((eq format 'html)
     (format "(<cite>%s</cite>)" path))
    ((eq format 'latex)
     (if (or (not desc) (equal 0 (search "cite:" desc)))
         (format "\\cite{%s}" path)
       (format "\\cite[%s][%s]{%s}"
               (cadr (split-string desc ";"))
               (car (split-string desc ";"))  path))))))

now when this block is run, it completes no problem and gives back a "Created cite link." message which is expected. However when you go to run the latex exporter, it gives me the following error.
Symbol's function definition is void: search

I have narrowed this down to the search command in the add link block, however I cannot figure out what it is supposed to be calling. From my research Common Lisp has a search function, but elisp does not. I've tried modifying the code to use every search like function build into emacs, and a few that are not such as the ebib-search with no success.
Do any of you have an idea as to what this is referencing?


texts: How do I get MELPA working on my Windows 8 laptop

texts:
In my init file ~\AppData\Roaming\.emacs.d that I created using C-x C-f ~/.emacs.d/init.el RET
I tried:

(require 'package) ;; You might already have this line
(add-to-list 'package-archives
             '("melpa" . "https://melpa.org/packages/"))
(when (< emacs-major-version 24)
  ;; For important compatibility libraries like cl-lib
  (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize) ;; You might already have this line

and

(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/")
                         ("marmalade" . "https://marmalade-repo.org/packages/")
                         ("melpa" . "https://melpa.org/packages/")))

and

(add-to-list 'package-archives '("marmalade" . "https://marmalade-repo.org/packages/"))
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(add-to-list 'package-archives '("org" . "http://orgmode.org/elpa/") t) ; Org-mode's repository

using both https:// and http:// since the Melpa website states there are issues with windows and https

Each time I have edited and saved the file and afterwards (re-)started Emacs.
Still after C-x list-packages RET I seem to get the ELPA list only.

I'd really appreciate some help, because I have no idea what I'm doing wrong.


texts: diminish-mode not working in .emacs files

texts:
I've some minor mode that I want to hide so that it wouldn't clutter my mode line in my emacs config. But the problem is, even after I put the (diminish 'minor-mode) lines in my .emacs file, the minor modes aren't hidden in mode line. I've to manually evaluate the diminish-mode lines everytime I restart an emacs session.

What am I doing wrong ? Is there anyway I can fix this behaviour?


texts: org-mode source code block using minted doesn't indent exported ruby correctly

texts:
I am using org-mode to make a Beamer LaTeX presentation, which then gets rendered to PDF.

Here is the part I am having trouble with:

* Vectors in Ruby (components)
- a Vector can be added to another vector
- a Vector can be multiplied by a scalar
#+begin_src ruby
class Vector
  def +(vector)
    Vector.new(components.zip(vector.components).map {|(vi,wi)| vi+wi })
  end

  def *(scalar)
    Vector.new(components.map{|c| scalar*c })
  end
end
#+end_src

When I run org-export-dispatch and render to PDF, here's what the methods look like:

I checked in the intermediate .tex file and the Vector lines have a tab indentation instead of space. It is inside a \begin{minted} block.

How can I fix this indentation?


texts:
With this text:

Play with it a few times you will see my point. The
command you need is:

$ echo hello

How do I make it into:

> Play with it a few times you will see my point. The
> command you need is:
>
> $ echo hello

Without using the complicated regular expression:
M-x replace-regexp RET ^ RET > RET

Note that I couldn't use C-M-% shortcut key to conjure query-replace-regexp since it's not possible to produce that key combination in a terminal.


texts: Org babel with noweb syntax and untangling

texts:
I just stumbled upon the possibility of using noweb syntax with
org-babel, so that named source blocks can be referred to from
other blocks, as in

    #+name: hullo
    #+begin_src
    hullo there,
    #+end_src

    #+begin_src
    <<hullo>>
    world
    #+end_src

As great as my initial delight, so also was my disappointment as
I learned that this does not seem to work well with
org-babel-detangle.  So just to make sure: there's no existing
way to make noweb syntax and untangling work together, is there?


texts: How to ignore backup files (~) when running grep?

texts:
M-x grep can be used to find strings in files. But I'm not interested in backup files (those whose name ends with a ~).

How should I ignore those files when using the grep command?


texts: What is causing background colors to blend?

texts:
I'm using ivy which defines two faces that can highlight matches, ivy-current-match and ivy-highlight-face. It's possible that both can be applied to one match.

I've noticed that in some cases the ivy-current-match background color (which is the most important one) does not show up when it's on something that has ivy-highlight-face as well.

For other color combinations, an entirely new background color is invented when they are combined, usually something darker than the ivy-highlight-face.

Is there some sort of color blending going on?

These are with these faces:

'(ivy-current-match ((t (:background "#00AF00"))))
'(ivy-highlight-face ((t (:background "#AF0000"))))

Here is the original issue I reported to ivy: https://github.com/abo-abo/swiper/issues/995

And a repro from emacs -Q:

(require 'package)

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

(package-initialize)
(package-install 'ivy)
(package-install 'counsel)
(package-install 'monokai-theme)
(require 'ivy)
(load-theme 'monokai)

(ivy-mode 1)

(custom-set-faces
 '(ivy-highlight-face ((t (:background "#383b31")))))

Then M-x counsel-describe-variable


texts:
I am used to my tables aligning nicely when I hit C-c C-c in Linux. In Emacs for OS X (emacsforosx.com) this does not behave on my system.

It works in Aquamacs.


texts:
On Windows Emacs v24.2.1 I get error:

(error "Required feature `cl-macs' was not provided")

I byte-compile my .emacs and here is code:

(with-no-warning (require 'cl-macs))

Actually (load "cl-macs") succeed but cl-macs.el lack (provide 'cl-macs) statement for that version (newer Emacs has corresponding provide statement).

What workaround to use for? I think:

(load "cl-macs")

but it look ugly in compare to usual (require '...).

(require 'cl-macs nil t) doesn't prevent from above error.


texts: I want to purge emacs from debian in order to install the newer version from git but when I do apt-get purge emacs and then emacsit still runs. Any idea on how to get rid of emacs ?


texts: objc-mode: Comment-end face is not same face as comment-start

texts:
How can I configure/modify objc-mode so that the face of comment-end is the same face as comment-start?

[The goal is to have commend-end always use font-lock-comment-delimiter-face, instead of font-lock-comment-face.  Perhaps whatever method c-mode is using to achieve the desired behavior by default can be applied to objc-mode as an answer to this question.]

STEP 1:  Launch the latest GUI version of Emacs 25 with no user configuration; i.e., emacs -q.

STEP 2:  Open an Emacs source code file used to build Emacs such as nsterm.m.  The buffer will be in objc-mode.

STEP 3:  Place your cursor on a comment-start and type C-u C-x = and see that it has font-lock-comment-delimiter-face.

STEP 4:  Place your cursor on a comment-end and type C-u C-x = and see that it has font-lock-comment-face.

If you repeat this same procedure in a c-mode buffer, the commend-end delimiter will have font-lock-comment-delimiter-face.


texts: LaTeX-environment inserts unwanted empty line

texts:
When I'm editing a LaTeX document and I'm using C-c C-e for LaTeX-environment, I often get a blank line after the newly-inserted environment.  This is never what I want and sometimes even plainly wrong because it can lead to errors if you for example insert a matrix into a displayed equation.

Is there an easy way to turn this off?  I checked the customization options but couldn't find anything obvious.


texts: How can I tell when non-interactive bash process is done executing a command?

texts:
I'm trying to write a different shell command line interface where the input line stays at the top. Output of previous commands should stack below:

> INPUT LINE

LAST OUTPUT (of command 1)

PENULTIMATE OUTPUT (of command 2)

...

I want to use a non interactive bash process and would like to handle the insertion of the output into the process buffer via an output filter. Commands are send to the bash process via process-send-string.

As I tested the output of a command can arrive in chunks and I would like to know when all output has arrived because later I want to add features for which I need to know that (specifically I want to narrow the buffer after all output arrived).

So is it possible to determine when the the last chunk of output arrives the process filter?

Any answers explaining that this is totally the wrong way and what I should do instead are welcome, too!


texts: Is there is an existing parser for `.gitignore` files?

texts:
Is there is an existing parser for .gitignore files? Maybe there is some Elisp package that includes something like this?

Ideally, I would like to be able to read a .gitignore file in a given directory and all parent directories up to the project root and convert the file to list of regular expressions.

This list could be used to filter the results of various commands. In particular, I would like to use it in helm-find-files.


texts: How to stop background processes interrupting minibuffer

texts:
I have a couple of background processes that I regularly run, such as mu4e and jabber-mode.

These, and other, processes provide updates to the minibuffer. Unfortunately, they do so when I'm already interacting with the minibuffer.

How can I prevent this happening, or at least dismiss the message so I can continue interacting with the minibuffer?


texts: What is the equivalent of the org-babel CALL in emacs-lisp?

texts:
Let's take this simple Org code, with two Python code blocs (one which returns a list, and the other one which prints the type and the content of the parameter):

#+NAME: int
#+BEGIN_SRC python :results value
return [1, 2, 3]
#+END_SRC

#+NAME: print_table_info
#+BEGIN_SRC python :var table=[]
print "type = {}".format(type(table))
print "table = {}".format(table)
#+END_SRC

#+CALL: print_table_info(table=int) :results output

Executing the #+CALL: will produce the expected result:

#+RESULTS:
: type = <type 'list'>
: table = [1, 2, 3]

Now let's assume I want to execute this directly in emacs-lisp with org-sbe. I would have:

#+BEGIN_SRC emacs-lisp :results output
(org-sbe print_table_info ":results output" (table (org-sbe int)))
#+END_SRC

And executing this code block would produce:

#+RESULTS:
:
: (results (quote (1 2 3)))
:
: (results (type = <type 'str'>
: table = (1 2 3)
: "))

Two issues here, which are related:

This result shows that a list was not given to the print_table_info code block but instead a string.  How can I actually pass a list?
How could I get rid from the Lisp code in the output of org-sbe and just get the plain output as when I execute the #+CALL:?

Thanks for your help!


texts: I noticed that I can't use virtualenvwrapper commands (like workon) in an eshell but they do work within a shell environment. Is there a virtualenvwrapper-like mode for Emacs?


texts: Converting init file on Mac/Linux to Windows

texts:
I use a package called Deft that needs a directory to store and load files. To define this directory on Mac or GNU/Linux I use the following expression:

(setq deft-directory "~/Dropbox/org")

When using Emacs on Windows shall I change every ~ to C:\\Users\\sbac and every / to \\ as in:

(setq deft-directory "C:\\Users\\sbac\\Dropbox\\org")


texts: HTTP Error 400 returned when accessing MELPA package archive

texts:
I'm working on a VM running Centos 7 which ships with emacs 24.3. I wanted to install, use some newer packages requiring > 25.1 so I downloaded the source for emacs 25.2 and built it. When I try to load packages from MELPA it fails. If I run M-x eww https://melpa.org/packages/ I see the following:
400 Bad Request
The plain HTTP request was sent to HTTPS port.

My understanding was that Emacs 25.2 included TLS functionality.  When I evaluate the below it prints tls IS NOT available. IS TLS support not included in Emacs 25.2? The Emacs GnuTLS manual states that it is an optional optional add-on. Did I miss something when I built it? Was I supposed to specify that I wanted the TLS library included?
(let (tlsAvailable (gnutls-available-p))
  (if (eq tlsAvailable nil) (message "tls IS NOT available") (message "tls IS available")))


texts:
When I type C-x d for the first time after starting emacs I get regular dired, not dired+ view. If I execute M-x diredp-dired-for-files I get dired+ view of the directory, and every C-x d after that opens dired+ view of any directory I visit.  Also if dired+ package was updated from list-packages then C-x d invokes dired+ automatically even the first time and without me having to execute diredp-dired-for-files.  Why doesn't dired+ get invoked automatically on the first and subsequent C-x d until I manually invoke it as diredp-dired-for-files?  Is this how it supposed to work?

Edit I forgot to mention, package-initialize is the first command in my init.el. In fact, the packaging system takes care of this

;; Added by Package.el.  This must come before configurations of
;; installed packages.  Don't delete this line.  If you don't want it,
;; just comment it out by adding a semicolon to the start of the line.
;; You may delete these explanatory comments.
(package-initialize)


texts: How to send buffer to a repl without showing it in prompt?

texts:
I'm using nodejs-repl, though the question applies to sending text to any repl.

I'd like to send a buffer to the repl, which I do with C-c C-b, but I don't want the buffer text to show in the prompt.

So instead of this:

> 0 + 1
1
> const seven = require('./seven);
const five = require('./five');
const add = require('./add');

const twelve = add(seven, five);
console.log(twelve);

12
>

I would instead something like see:

> 0 + 1
1
> loaded path/to/file.js
12
>

The loaded path/to/file.js isn't required, I basically just don't want to see all the buffer text.

I'm new to elisp and so all I can think to do is store the buffer text to a variable and somehow only show that variable (I don't know how to do this though).


texts: How do I "escape" a time in a todo entry so that it doesn't show up on the time grid?

texts:
I have some to-do entries that have a "time-like" string (i.e something like 7:00) as part of the entry text. The problem is that org-mode is interpreting that substring as a time, and is treating that as part of the timestamp for the to-do entry. Is there a way to escape this text so that it doesn't get interpreted as a timestamp?

Edit: I see that the org-mode manual specifies

  In the headline of the entry itself, a time(range) may also appear as plain text (like ‘12:45’ or a ‘8:30-1pm’).

Is there a way to disable this behavior, or failing that, indicate to org-mode that it should not interpret a particular piece of text as a timestamp?


texts:
I am trying to run Emacs with slime and clisp on windows. Currently I am setting up my init-file so that I can run SLIME.

(setq inferior-lisp-program “home/gage/bin/clisp/full/lisp.exe
-B home/gage/bin/clisp/full
-M home/gage/bin/clisp/full/lispinit.mem
-ansi -q”)
(add-to-list ‘load-path “home/gage/bin/share/emacs/site-lisp/slime/”)
(require ‘slime)
(slime-setup)

I run eval-buffer and this error pops up.

eval-buffer: Symbol's value as variable is void: “home/gage/bin/clisp/full/lisp\.exe

Help?


texts: Is CEDET/semantic obsolete? How to analyze C code for source transformation tasks?

texts: Reading through some CEDET docs I found that the author herself recommends "to use Semantic only as source of information, and perform names completion using other packages". Does this advice also hold for other tasks? I want to analyze C source and insert e.g. a doxygen documentation for a function which matches the function signature. Which package is the right one for such an attempt? Note that I need to adapt the parser as the source is some awkward embedded we-roll-our-own-syntax C code.


texts: Why does my function-generating macro only work when I evaluate its expansion?

texts:
I'm trying to write a macro that will define a function exactly once where I don't really care what the name of the function is.  My thought was to generate a symbol, use defun with that, and then put a special property on the symbol.  The next time the macro is called, it looks for a symbol with this property first and generates a new symbol if it can't find one.

Here's my code:

(require 'dash)
(require 'cl-lib)

(defun lispdoc-find-handler (key)
  (--find (and (functionp it)
               (-> (symbol-plist it)
                   (plist-get 'lispdoc-section-handler)
                   (eq key)))
          (append obarray nil)))

(defmacro lispdoc-defsechandler (key &rest body)
  (let ((sym (or (lispdoc-find-handler key)   ;; use existing symbol if defined
                 (cl-gensym))))
    `(progn (defun ,sym ,@body)
            (put ',sym 'lispdoc-section-handler ,key)
            (cons ,key ',sym))))

;; test

(lispdoc-defsechandler :test (examples)
  (prin1-to-string examples))

(when-let ((f (lispdoc-find-handler :test)))
  (funcall f '(1 2 3 4 5)))

When I eval-defun my call to lispdoc-defsechandler, I get a different symbol every time (where I'm very clearly checking to see if it already exists first).  When I macroexpand-last-sexp it, I get the following:

(progn (defun G564 (meta examples)
         (prin1-to-string examples))
  (put 'G564 'lispdoc-section-handler :test)
  (cons :test 'G564))

Evaluating this gives me the same ultimate return value (i.e., (:test . G564)), but now the macro always gives the same result, too (i.e., the function has actually been defined).

Even if I minimize the macro to just the following

(defmacro lispdoc-defsechandler (key &rest body)
  (let ((sym (or (lispdoc-find-handler key)
                 (cl-gensym))))
    `(defun ,sym ,@body)))

I still get the generated sym as a return value, but its function-value isn't defined.  What's going on here?  If the function isn't being defined, how is it getting evaluated at all?


texts:
I am using special blocks to create myself a theorem environment so that I can style it in both HTML and Latex output. For this I do;

#+BEGIN_theorem
 ---Theorem goes here----
#+END_theorem

and this expands into Latex as

\begin{theorem}
 ---Theorem goes here----
\end{theorem}

But I want to pass an optional argument to this special block so that when I do;

#+BEGIN_theorem
#+ATTR_LATEX :theorem_name "Mean Value Thorem"
 ---Theorem goes here----
#+END_theorem

so that it will expand into;

\begin{theorem}[Mean Value Theorem]
 ---Theorem goes here----
\end{theorem}

So, basically I want to pass argument to Latex expansion through special blocks. How can I achieve this?


texts:
I'm trying to define the keymap for a major mode but keep getting the error: Wrong type argument: keymapp.

What am I doing wrong?

(defun insert-text ()
  (interactive)
  (let ((x (read-string "Enter text to be printed: ")))
    (insert x)))

(defvar test-mode-map
  (let ((map (make-keymap)))
    (define-key map (kbd "M-S-RET") 'insert-text)))

(defun test-mode ()
  (interactive)
  (setq major-mode 'test-mode
    mode-name  "Test Mode")
  (use-local-map test-mode-map))

I read another question with a similar error but it doesn't really help.


texts: Receive error when trying to use tern mode

texts:
I have installed tern use npm and install tern.el from melpa. I put the path of tern.el in my init file as per instructions on the emacs section of the tern homepage. However when I enable tern mode and try to run a command such as jump to definition at point, I get the following error:

  Searching for program: no such file or directory, tern

What is the issue?


texts: What I like about my mbsync/mu4e setup is that I can download all my email and then read it all and respond to it all offline. But this doesn't work for sending mail, since if I'm offline, it won't let me send a message. How do you configure mu4e so that if you're offline, it puts your message in an outbox, and then sends it as soon as it gets a connection?


texts: TBLFM - :: (two colons) - what does it mean?


texts:
I was reading the use-package documentation, which says, "Here is the simplest use-package declaration:"

;; This is only needed once, near the top of the file
(eval-when-compile
  ;; Following line is not needed if use-package.el is in ~/.emacs.d
  (add-to-list 'load-path "<path where use-package is installed>")
  (require 'use-package))

(use-package foo)

As an Emacs beginner, I have a few questions about this part if I may.

Do I need (package-initialize) before these lines?  It seems to me that without doing that, the use-package macro wouldn't be available.
I do not need the 4th line in the above snippet, right? As I have installed use-package from MELPA Stable, and the package is installed to the default location ~/.emacs.d/elpa/use-package-2.4.
In this example, is (use-package foo) equivalent to (require 'foo)?


texts: Beginner: Doom Emacs, or Emacs in general: Which program is used for spellcheck-as-you-write in text mode and how to change its dictionary

texts:
I am learning how to work with Emacs on Ubuntu 20.04. After going through Tutorial and using default key-bindings for some time, I have decided to test more ergonomic (at least for me) setup - that is how I ended up in Doom Emacs.
First time using Doom Emacs, I am writing notes for usage in simple text mode. I write in my native (czech) language. All text I write is highlighted as spelling error, which is kind-of annoying. Which external program is responsible for that in Doom Emacs and how can I change its spelling dictionary??
In Doom Emacs I have enabled all :checkers options (grammar, spell, syntax). I have also followed this question solution: Ispell Spellcheck ; installed appropriate ispell dictionary from apt and restarted Emacs. I have also tryed to stop flyspell-mode (if this would be caused by flyspell), but the misspelling markings still persist in viewed text.
I have also tryed to flyspell-buffer, but with no success.
When I was learning Emacs, I have been doing the same with vanilla Emacs and I have used GUI-top bar menu to set language (not sure if it was for buffer or whole application) and everything worked as expected, there were no spurious misspellings detected.
Which program is responsible in Doom Emacs, or Emacs in general, for spellchecking on-the-fly and how can its dictionary be changed?
If this site is not the right place to ask (and I should adress author directly), please, let me know in comments. My reason asking here is because I think this is not a bug in Doom Emacs, but that it is my lack of knowledge how to work with Emacs.


texts: Format fails to copy text properties from the format-string for adjacent %-sequences

texts:
Take a look at this example:

(format (concat "%s" (propertize "%s" 'face 'error)) "foo" "bar")
"foobar"

(format (concat "%s " (propertize "%s" 'face 'error)) "foo" "bar")
#("foo bar" 4 7 (face error))

And the documentation of format explicitly states:

  Text properties, if any, are copied from the format-string to the produced text.

Why is that?

I know I can work around this with:

(format "%s%s" "foo" (propertize "bar" 'face 'error))
#("foobar" 3 6 (face error))

Or even:

(concat "foo" (propertize "bar" 'face 'error))
#("foobar" 3 6 (face error))

But my original use case is a bit more complex than this.

Edit

A probably more general example is the following:

(format (concat (propertize "%s" 'face 'bold)
                "" ; any non-empty string works
                (propertize "%s" 'face 'error))
        "foo" "bar")
#("foobar" 0 6 (face bold))


texts: How to set leader-key-like chord sequence in Evil mode?

texts:
I am using Spacemacs with evil mode and this works:
(define-key evil-normal-state-map (kbd "m") 'set-input-method)

However, I would like to use something like this:
(define-key evil-normal-state-map (kbd "m o") 'set-input-method)

to be able to type m and then o, or even more keys in sequence to get the chord effect and trigger the function I want.
However (kbd "m o") is not working.
How to make m o chord work in evil mode in Spacemacs?


texts: Change syntax highlighting when doing ps-print-buffer-with-faces

texts:
Hopefully a simple question.

I code in c++ in emacs with a dark background and the syntax highlighting is perfect for viewing that way, however when I print on white paper, some of the colours like yellow/orange don't show well against the light background.

I have tried doing M-x invert-faces default in the buffer and then printing, but this has no effect.

I am able to select the word, do M-x customize-face, and change the foreground colour this way, which works, but I don't want to do this when I'm printing. It's variable names that I want to change the colour of but only when printing.

What I would like to do it have a custom functions, which would temporarily change all variable names in that buffer to a different colour, print it, and then change them back.

The output of customize-buffer looks like:

Editing a setting changes only the text in this buffer.
To apply your changes, use the Save or Set buttons.
Saving a change normally works by editing your init file.
For details, see [Saving Customizations] in the [Emacs manual].

 Operate on all settings in this buffer that are not marked HIDDEN:
 [Set for current session] [Save for future sessions]
 [Undo edits] [Reset to saved] [Erase customizations]   [Exit]

Font Lock Variable Name Face:(sample) [Hide Face]
   [State]: SAVED and set.
   Font Lock mode face used to highlight variable names.
Groups: [Font Lock Faces]
Choice: [Value Menu]
 Attributes: [ ] Font Family: *
             [ ] Font Foundry: *
             [ ] Width: *
             [ ] Height: *
             [X] Weight: [Value Menu] light
             [ ] Slant: *
             [ ] Underline: *
             [ ] Overline: *
             [ ] Strike-through: *
             [ ] Box around text: *
             [ ] Inverse-video: *
             [X] Foreground: #FF8400    (sample)
             [ ] Background: *
             [ ] Stipple: *
             [ ] Inherit: *

Any thoughts on how to proceed?

Thanks

Joey


texts: I have just installed Magit and so far all is going great! However, I have a lot of GitHub repos that I would like to fetch via Magit. Is there a way to fetch all repos from GitHub?


texts: How to get the window for mode-line-format?

texts:
I'd like to customize the mode line with my own faces, depending on
whether a particular window is selected or not. Let's say I have this:

(setq-default mode-line-format
              '((:eval (propertize
                        (format-mode-line
                         mode-line-buffer-identification)
                        'face (if nil
                                  'mode-line
                                'mode-line-inactive)))))

I'd like to put instead of nil a predicate that checks if the
current window is selected. How could I do that?


texts: How to find all TODOs that are scheduled today or before today or TODOs that are not scheduled

texts:
How to find all TODOs in org-mode that meet any of the following conditions:

TODOs that are scheduled to be done today
TODOs that are scheduled to be done before today
TODOs that are not scheduled


texts:
In another question (IDO rebind C-j to C-<RET>), Seraph asked about defining the <C-return> key for ido-mode.

It turned out that the key was already bound in cua-global-keymap, which overrode its binding in ido-common-completion-map.

Steps to reproduce:

emacs -Q
M-x cua-mode RET
M-x ido-mode RET
(define-key ido-common-completion-map (kbd "<C-return>")
  (lambda ()
    (interactive)
    (message "C-j called")))

C-x C-e
M-x ido-dired RET
C-h k C-return

Which turns out to be bound to cua-set-rectangle-mark in cua-global-keymap, as opposed to the anonymous command above in ido-completion-map.

As a workaround, I recommended removing the definition in cua-global-map.

Question: is there a way to make the definition in ido-common-completion-map override the definition in cua-global-map?


texts: How to allow a sexp within a quoted list to be evaluated?

texts:
(setq a 2)
(setq l '(a b c))
(car l)

Got a when evaluating this, and why its value not 2 ?


texts:
OS X 10.11
Emacs 24.5: /Applications/Emacs.app
emacsclient: /Applications/Emacs.app/Contents/MacOS/bin-x86_64-10_9/emacsclient
(server-start) in my .emacs file
% emacsclient some-file

Result is:

  /Applications/Emacs.app/Contents/MacOS/bin-x86_64-10_9/emacsclient:
  can't find socket; have you started the server? To start the server in
  Emacs, type "M-x server-start".

  /Applications/Emacs.app/Contents/MacOS/bin-x86_64-10_9/emacsclient: No
  socket or alternate editor.  Please use:

  --socket-name   --server-file      (or environment variable
  EMACS_SERVER_FILE)    --alternate-editor (or environment variable
  ALTERNATE_EDITOR)

I have also tried this running Emacs and emacsclient as installed with MacPorts with the same result.

This is been happening for many years. I can't even remember the last time I was able to use emacsclient. I have searched extensively for information about this, but all I can find is information I already know as a sophisticated Emacs user of many decades.

I am not looking to run Emacs as a daemon.

Suggestions?


texts: Finding English Letters in a multilingual document

texts:
I have a document mainly Persian with English/French/German characters here and there. I want to append a command before Latin word(s) and a } at the end. Do you think it could be done in emacs?

Suppose there's an English sentence for example Welcome to Emacs I want it to become \lr{Welcome to Emacs}.

*It is a markdown document which in turn is going to be converted to Latex. \lr{} is a local command for a Persian package which renders non-RTL words and sentences correctly.
Thank you.


texts:
I'd like to temporarily override a function in a piece of code.

Take, for example, the following:

(defun nadvice/load-quiet (args)
  (cl-destructuring-bind
      (file &optional noerror nomessage nosuffix must-suffix)
      args
    (list file noerror t nosuffix must-suffix)))

(defun nadvice/idle-require-quiet (old-fun &rest args)
    (advice-add 'load :filter-args #'nadvice/load-quiet)
    (apply old-fun args)
    (advice-remove #'load #'nadvice/load-quiet))

(advice-add 'idle-require-load-next :around #'nadvice/idle-require-quiet)

What doesn't work:

This. It would be much cleaner if I could avoid manually enabling and disabling the advice and trust the single-threaded nature of Emacs to take care of things.
cl-letf won't let me reference the origional function, so I can't implement things that :filter-args would normally do.
cl-flet can't override functions in other functions.
noflet is an external package, which I'd like to avoid. (Also does much more than I need)


texts: smartparens how to stop behaviour of inserting backslash \ before I type a single quote '

texts:
I'm in C major mode, editing source files. Whenever I want to type a single quote ' smartparens automatically gives me the following: \'|\' , where  | is the cursor position.

What I want exactly is this: '|'.

Anyone knows how to solve this?


texts:
How could I write literate (and exportable to latex) Agda code in org-mode?

Org-babel would be a great option, but there is no ob-agda2 (I think?). I have tried defining an org-babel-execute function for agda following the template ob-template.el, but my knowledge of Elisp is not enough to fill all the required functions.
Literate Agda works well with Latex files, but it needs the extension of the file to be .lagda and only detects Agda code between \begin{code} ... \end{code}, instead of the org-mode syntax of #+begin_src agda2.

A possible solution right now would be to add some Latex export options to make \begin{code} export correctly to Latex

#+latex_header: \usepackage{verbatim}
#+latex_header: \newenvironment{code}{\verbatim}{\endverbatim}

and to keep changing betweeen major modes (org and agda) to edit the same file, with an .org.lagda extension.  Is there any better way to do this?


texts: emacs: Work out which monitor is the primary one

texts:
Is there a way to programatically work out which display is considered the "primary" display for X within emacs?

I've managed to get a function working that determines if the machine has more than one display connected to it:

(defun how-many-displays ()
    (safe-length (display-monitor-attributes-list)))

I expected that in the list of display attributes, there'd be a way to determine which monitor X thinks is the primary monitor. But unfortunately, the only way to do this seems to be reliant upon defining the monitor layout for each machine I'll be using this config on (which is two machines, but one of them is a laptop that I connect to external displays and as such it will have two configurations).

What I'd like is to be able to determine which display is the primary, and then parse out the geometry so I can calculate offsets for the window position.

Any ideas?