texts: how to bind custom commands to keys in existing mode map?

texts:
I wrote some extra commands for Python mode: python-insert-quote and python-insert-double-quote. I want to have these commands be available in the minibuffer when python-mode is active. How can I add these custom functions into python-mode without write a new mode?

I was thinking it might be nice to keep these additional functions saved in ~/.emacs.d/lisp/extra-python.el

I'm not sure how hooks work or if this would be the right time to use hooks. When I look at hooks, It says that hooks are used to change the behavior of a mode, giving this example:

  (add-hook 'text-mode-hook 'auto-fill-mode)

The example would seem antithetical to what I'm trying to do. I just what the functions to be callable form the mini-buffer only when in python-mode, not to be called when the mode is launched.

GNU Emacs 26.1

saved in ~/.emacs.d/lisp/extra-python.el

(defun python-insert-quote ()
  "Inesert python single quote"
  (interactive)
  (let ((myline (thing-at-point 'line)))
    (while (string-match "\\([^ ].*\\)" myline )
      ;; remove line
      (kill-whole-line)
      ;; add better line
      (insert (concat "'" (match-string 0 myline) "'" "
"))
      ;; fix indent
      (forward-line -1)
      (beginning-of-line)
      (indent-for-tab-command)
      (error ""))))         ;(break) the equivalent

(defun python-insert-double-quote ()
  "Inesert python double quote"
  (interactive)
  (let ((myline (thing-at-point 'line)))
    (while (string-match "\\([^ ].*\\)" myline )
      ;; remove line
      (kill-whole-line)
      ;; add better line
      (insert (concat "\"" (match-string 0 myline) "\"" "
"))
      ;; fix indent
      (forward-line -1)
      (beginning-of-line)
      (indent-for-tab-command)
      (error ""))))         ;(break) the equivalent

(provide 'extra-python)

saved in ~/.emacs.d/init.el

;; Add commands to python mode
(add-hook 'python-mode-hook (lambda ()
  (define-key python-mode-map [f6] 'python-insert-quote)
  (define-key python-mode-map [f5] 'python-insert-double-quote)))


texts: Single/simple way to set indentation to 2 for all modes

texts:
I'm a bit confused about setting indentation for different modes in Emacs.

It seems you have to explicitly set indentation for each mode
Some modes use setq-default, some use setq and some use add-hook
Indentation variables are inconsistently named

My question:

Is there a single indentation variable I can set that all modes inherit as a default?

If not, is there a shorter and more correct way to set up my indentation than listed below?

(setq-default tab-width 2)
(setq-default sh-basic-offset 2)
(setq-default sh-indentation 2) ;; workaround for bug in 25.3.1
(setq c-basic-offset 2
      css-indent-offset 2
      js-indent-level 2)
(add-hook 'php-mode-hook '(lambda ()
                            (setq c-basic-offset 2)))
(add-hook 'ess-mode-hook '(lambda ()
                            (setq ess-indent-offset 2)))


texts: Force magit to ask for confirmation before deleting a branch

texts:
I would like to have magit ask for confirmation when I've told it to delete a particular branch.
Currently it seems that magit considers the selection of a branch to delete to be the confirmation, as the documentation to magit-no-confirm says:

The user always has to confirm the deletion of a branch by
accepting the default choice (or selecting another branch)

This is not enough of a confirmation for me, and I'd like to make magit ask me for confirmation after I've selected a branch to delete.
Is there any way to do this?


texts:
I want to use Emacs for programming in Clojure, Mathematica and for taking notes in class. I am using the Emacs configuration provided by "Clojure for the Brave and Bold", which pretty heavily customizes Emacs for Clojure. I would like to have a different environment for Mathematica, and a vanilla environment for note taking?

How can I keep multiple profiles for Emacs?


texts: Semantic does not reload c-preprocessor symbols from file

texts: semantic allows specification of C-preprocessor keywords using the variable semantic-lex-c-preprocessor-symbol-file, which is a list of C/C++ files that contain preprocessor macros. How do I get semantic to reload these files after changing one of them?


texts: kill-ring-save rectangle and paste transposed?

texts:
Suppose I have some code written like:

a_to_b = self.tversky(a, b)
b_to_c = self.tversky(b, c)
d_to_e = self.tversky(d, e)
e_to_f = self.tversky(e, f)
g_to_h = self.tversky(g, h)

I would like to select as a rectangle the variable names x_to_y and then paste it into array as so:

return [a_to_b, b_to_c, d_to_e, e_to_f, g_to_h]

I don't necessarily need the commas in one command, but basically selecting a few columns and then applying M-S ^ to each line. So I can get them all next to each other.


texts: Attaching files in mu4e from the clipboard

texts:
I use mu4e for email. I can attach a file to a new message with drag-and-drop or with dired (as in these directions from the manual).

I would like to code the same behavior as Mail: in the Finder, I copy the relevant file or files, go to a Mail message, and they are pasted as attachments.

I wrote this function to attach one file from the clipboard:

(defun add-attachment ()
  "Include at the end of the buffer the attachment in the
interprogram-paste-function, assuming it is from the Downloads
folder."
  (interactive)
  (let ((prev-point (point)))
    (goto-char (point-max))
    (insert (concat "\n\n"
            "<#part filename=\"/Users/username/Downloads/"
            (shell-command-to-string "pbpaste")
            "\" disposition=attachment>"
            "\n"
            "<#/part>"))
    (goto-char prev-point)))

The problem is that the file has to be in the Downloads folder. The Mail program has access to more information, such as the folder, because it attaches a document instead of pasting the filename (which is Emacs's behavior).

How can I access this information and include in Emacs the full path to the files in the clipboard?


texts:
I wonder if there's an easy way to merge adjacent clock entries if they are within X minutes range?

for example

:LOGBOOK:
CLOCK: [2015-06-28 Sun 11:54]--[2015-06-28 Sun 12:12] =>  0:18
CLOCK: [2015-05-18 Mon 11:07]--[2015-05-18 Mon 11:54] =>  0:47
:END:

would be simplified as

:LOGBOOK:
CLOCK: [2015-05-18 Mon 11:07]--[2015-05-18 Mon 12:12] =>  01:05
:END:


texts: How do I center the title when exporting org file to HTML

texts:
#+TITLE: Hello World
#+AUTHOR: A. U. Thor
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="style.css"/>
#+HTML_DOCTYPE: html5

currently gives me this as output where the title is centered to the left.


texts: How to get colors in Magit diffs on Windows?

texts:
Color codes are not working on my Windows 7 box. I have working colors in Git Bash that comes with the Git install.

Here is what I get:


texts: Why eshell lists my host environment variables when I am connected to other machine via ssh?

texts: I am connected to another machine using tramp and my eshell does send all the commands to remote machine but when I do echo $PATH it prints me my local PATH. Why?


texts:
Is there a way to use file local variables set in an org-mode file in the following contexts:

Simply expanding the variable when text is exported (eg: to LaTeX)
Passing the value to :var in a babel source block (SQL or Python)
Expanding the variable in a org-mode table for use in #+TBLFM

For example here is the local variable definition at the end of the document:

# Local Variables:
# mode: org
# foo: bar
# aNumber: 32
# End:

Context 1:

* First Section
is about <foo>

Context 2:

#+BEGIN_SRC python :var baz=<foo>
print(baz)
#+END_SRC

Context 3:

|Numbers | NumbersMultipliedBy2 |
|<aNumber>   | =@2$1 * 2            |


texts:
I was wondering how you could get the equivalent of sudo !! in eshell. I cant tell you the amount of times I have done this forgetting eshell doesn't have this feature built in.
I have looked through the available eshell functions and haven't seen anything that seems promising.


texts: Regexp \\text{vars}(\([:ascii:]+\)) -> |\1| doesn't work

texts:
Why doesn't this regexp work when I do C-M-%? I need to replace exactly these strings:
\text{vars}(\vp) -> |\vp|
\text{vars}(\vp') -> |\vp|
I don't have anything else of the form \text{vars}*, so I used
\\text{vars}(\([:ascii:]+\)) -> |\1| and got Replaced 0 occurrences. What's wrong?


texts: How to recommend helm-ag to select the current (where the call came from) position

texts:
I use helm-do-ag-this-file for interactive file search and navigation. To do this, I have a setting (setq helm-ag-insert-at-point ' sexp) and the expression under the cursor gets into the search bar for helm-ag.
My problem: in the helm-ag buffer, the selection starts at the beginning of the buffer, but I would like the selection to be matched the current (where the call came from) position cursor.
How can this be done?


texts:
In http://tuhdo.github.io/c-ide.html#orgheadline2 which is about "Prerequisite"

  Or, helm + helm-gtags.

What does "Or" imply as the alternative to the combination "helm + helm+gtags"?

Is the alternative

GNU Global
GNU Global + ggtags

What are the relations between GNU Global and helm?
Are GNU Global and helm  alternatives to each other?

ggtags is a frontend of GNU Global, and is helm-gtags a frontend of helm?

What should I install according to the link?

Is it okay to install both combinations GNU Global + ggtags and helm + helm+gtags, and to use them both in the future?

Thanks.


texts: Killing a window without killing the associated buffer

texts: I have a weirdly specific way I like to organize my windows when working with C, and where emacs opens the compilation window really bugs me. I try to close it and switch another window to the *compilation* buffer, but for some reason the kill-window command also kills the buffer. Is there a way to avoid this? Or am I just doing this in a really asinine way?


texts:
The diary file is located by default at ~/diary. I'd rather it wasn't. I've looked quite a bit through the reference over the past couple of days, I haven't seen anything generated in the .emacs that sets it, and there are no SX questions about it.

Does anyone know how to put your diary in a different directory?


texts:
I am using Emacs 24.4 with Ubuntu 14.04. I just discovered that the C-M keyboard sequences are not working in Emacs. For example in elisp-mode the key C-M-left is bound to backward-sexp, but when I press Ctrl+Alt+"Arrow Left" nothing happens.

If I try describe-key and type some key combination with Ctrl+Alt nothing happens, but pressing Ctrl+Left, or Alt+Left works fine. Also pressing Ctrl+Alt+L locks the computer, which indicates that the desktop intercepts the Ctrl+Alt keystrokes before Emacs gets them..

Update

I can confirm that the key C-M-r is in fact working, so I think this is an indication that there is a conflict with the Ubuntu desktop keyboard shortcuts somewhere.


texts: Alternative shortcuts to copy the character

texts:
To copy the character at point usually I do Shift-<right> M-w. I am wondering what are the alternative ways to do this action using only the Emacs standard keybindings (maybe with minimal keystrokes but this is not very important).

Specially when working with unicode characters, it is easier to copy-paste them rather than insert them directly, this is maybe a reason why a convenient shortcut for copying a character would be helpful.

Perhaps an inconvenience with Shift-<right> M-w is that the fours keys involving in this action are a little far away.

Of course one can define a personal shortcut for this, but I am looking for a standard shortcut.

(Note: It appears that in vim mode vy can do this).

Edit: I appears that the short answer to my question is no.
For this reason I accepted the answer given by Emacs User.
An alternative solution is the following: We can exploit the fact that the shortcut Meta-w  bounds to nothing if a region is selected. Hence we can use the ordinary Meta-w to copy the character with the following settings The first function was suggested by lawlist.
This is the best alternative way I found without introducing an extra shortcut.

(defun my-copy-region-as-kill ()
  (interactive) (copy-region-as-kill (point) (1+ (point))))

(defun my-copy-character () (interactive)
       (if (region-active-p) (kill-ring-save (region-beginning) (region-end))
     (my-copy-region-as-kill)))

(global-set-key (kbd "M-w") 'my-copy-character)


texts:
I want to select current word under the cursor without using mouse.
After searching this forum, I learned how double click works.
(I noticed that it is a bit complicated and there were no direct key bindings.)

What is the best way to select current word with only keyboard?
I also don't want to use emacs function or script with a customized binding
because I want to use it universally(Android studio, Jetbrains...)


texts: Inserting/updating source file header comments

texts:
How can I insert header comments in source files of arbitrary languages?

If the file is newly created, the header should be inserted.
If a file already exists, then it should be possible to insert a header at the top of the file, or update as needed (update file name in the header if the file name changed, update copyright year)
Of course depending on the language, the header should be inserted with the correct commenting characters.

I am looking forward to different packages and/or custom elisp recommendations.


texts: How replace either of two words using a regexp to find them?

texts:
Text

How are you?
I'm just fine.

I need to add some suffix to the next words: are and fine.

I try this:

\(are\)|\(fine\)

but it doesn't help.


texts: Find the first difference between two buffers

texts:
Given two buffers, how do I find the first character position where their contents differ? E.g. for contents abcdef and abcDeF, the first difference would be at point=4. For abc and ab, it would be at point=3.

Is there anything more direct than writing my own binary search based on compare-buffer-substrings to compare progressively smaller substrings?


texts: Alignment not working on one machine, but working on others?

texts:
Alignment is not working for me on my Windows machine, but it is on my Centos machine.  I want to understand why.

I first noticed the problem when I turned on linum-mode.  Here's what it looks like in Centos:

But in Windows, it looks like this:

Then, I tried to follow Understanding of emacs align-regexp, and the following is what I got.  In Centos:

But in Windows:

What is wrong with my alignment in Windows?  How can I fix it?


texts: Company-mode completion for Org keywords

texts:
Org mode has completion for all keywords via pcomplete, as noted by Andrew Swann.

However, Company does not seem to pick up on these keywords. Calling company-complete on the following, where | represents point, brings up a list of English vocabulary words instead of Org keywords:

#+|

Is it possible for Company to do Org-specific completion in addition to the helpful textual completion that it normally does?


texts: how to get an elisp function to press TAB?

texts:
I want to activate the TAB key from within an elisp function.
here is my function:
(defun aline ()
    "We insert a pair of dollar signs and position
    point in between them."
    (interactive)
        (progn
            (insert "\\begin{align*}\n\\ \n  \\end{align*}")
            (kbd "TAB")
            (backward-char 16)
        )
)

Its desired behaviour is to print out:
\begin{align*}
\ <cursor>
\end{align*}

Unfortunately it indents the \end{align*}
\begin{align*}
\
  \end{align*}

This is fixed in AUCTEX by pressing TAB.
How can I get my function to press the TAB key?
I realise I could fix it by removing spaces after "\n"
(insert "\\begin{align*}\n\\ \n\\end{align*}")

but I want to learn e-lisp and I'm curious of how to fix this with an automated TAB press
I have tried the following commands:

(kbd "TAB")
(insert "?\^I")
(tab-char)


texts: How to control which iESS process gets a code evaluation?

texts: I have several R instances running and want to pick which one gets the evaluations in my buffer. Is there a built-in way of doing this?


texts: Org babel - return results of multiple statements

texts:
This must be very simple, but I haven't been able to find an answer.
How can I have org-babel output the results of multiple statements?

Ex.:

#+BEGIN_SRC scheme :exports both
(define square (lambda (x) (* x x)))
(define (smallest-divisor n)
  (define (divides? a b)
    (= (remainder b a) 0))
  (define (find-divisor n test-divisor)
    (cond ((> (square test-divisor) n) n)
          ((divides? test-divisor n) test-divisor)
          (else (find-divisor n (+ test-divisor 1)))))
  (find-divisor n 2))

;; 3 statements follow:
(smallest-divisor 199)
(smallest-divisor 1999)
(smallest-divisor 19999)
#+END_SRC

#+RESULTS:
7

I'd like results to give me all values, as in:

#+RESULTS:
199
1999
7

Please point me to an answer, should this question happen to be a duplicate.


texts: Move a file to a directory in the filesystem with emacs lisp

texts:
What is the function to move files? I want to emulate the following shell command:

mv file dir

As described here, the closest is rename-file, but this would be emulating this:

mv file newfile


texts: How to retain selection after command run (indent-code-rigidly)?

texts:
I found a neat code snippet for ~/.emacs configuration:

  (global-set-key (kbd "C->")
                  (lambda (b e &optional n)
                    (interactive "r")
                    (indent-code-rigidly b e (or n 4)))
                  )

  (global-set-key (kbd "C-<")
                  (lambda (b e &optional n)
                    (interactive "r")
                    (indent-code-rigidly b e (or n (- 0 4))))
                  )

This snippet allows me to use C->/C-< hotkeys to force indent/unindent selected code block.
But after indent/uindent applies to code block, selection is lost. How to retain selection (or select again same code lines) programmatically?


texts: In LaTeX mode, the content of \frametitle{...} gets a bigger font size.  How can I prevent that from happening?  And is there a general to prevent /all/ variation in font size?  (I wish emacs would just look like a terminal.)


texts:
I'm struggling to find a way to define keys only for eshell. Looking at the emacs wiki I saw examples using the eshell-mode-map yet I get errors when trying to define it.

  progn: Symbol’s value as variable is void: eshell-mode-map

I'm trying to get the f-keys to work as nornal f-keys after using them to quick launch functions in global mode.

Here is what I tried

(define-key eshell-mode-map (kbd "<f9>") (kbd "<f9>")  )


texts: Where the `l-pac` abrreviation for `list-packeages defined`?

texts:
Recent versions of emacs come with package.el built in and provide the abbreviation M-x l-pac. However, l-pac is not recognized by smex or helm-M-x. M-: (l-pac) also does not work and the help functions do not seem to know about l-pac either, so it does not seem to be a an emacs function.

Where/How is l-pac defined?


texts: How to get notifications from Erc in macOS?

texts:
I just started using erc in emacs and I've built emacs with --with-dbus compile option. I enabled notifications (so that I can get a notifications when my erc nickname gets mentioned) module in Erc modules list. But, whenever my nick gets mentioned in an erc channel, dbus gives me this error message:Error: (dbus-error "No connection to bus" :session). I've no idea how to fix this :(

How can I get notifications to work for macOS?

Edit: I've started the dbus process with: brew services start dbus


texts: Restoring point when tangling current block

texts:
When I do

C-u C-c C-v t

to tangle the code block at point, my point moves to the head of the code block. How can I prevent that point movement.


texts: How do I add text to every new buffer that I create?

texts:
Suppose I want to put my name and the date at the top of every new buffer that I create. How would I do that?

Furthermore, suppose I want to use the name of the new buffer in the text that I want to place automatically, where what text is placed depends on a parameter that I specify. Let's say if the parameter is "java" then the text placed will be

public class [Filename without file extension] {
    static void main (String[] args) {

    }
}

or if it's "cpp" then,

public class [Filename without file extension] {
    int main(int argc, char** argv) {

    }
}


texts:
I'm fairly new to aquamacs/emacs and while editing I noticed that it indents however it wants.
In order to indent the way I want I end up using M-i, but that is pretty cumbersome.
So, how do I make the TAB key behave like M-i (that is, inserting 4 spaces whenever I press it, regardless of the type of file I am editing)?


texts:
I'm trying to get effort estimates out of a columnview table and do some math on it in a separate table.

#+TBLNAME: estimate
#+BEGIN: columnview :indent t
| ITEM             | TODO | Effort | CLOCKSUM |
|------------------+------+--------+----------|
| \_    Some task  |      | 40:00  |          |
#+END:

| Effort |
|--------|
| #ERROR |
#+TBLFM: @2$1=remote(estimate, @2,$3)

I have tried moving the tblname down in the block, which doesn't work either.

Update after fix:

#+NAME: estimate
#+BEGIN: columnview :indent t
| ITEM             | TODO | Effort | CLOCKSUM |
|------------------+------+--------+----------|
| \_    Some task  |      |  40:00 |          |
#+END:

| Effort |
|--------|
|  40.00 |
#+TBLFM: @2$1=remote(estimate, @2$3);t


texts:
When I try to push into my remote repository, the mini buffer says Running git push -v origin master:refs/heads/master  but nothing else happens.
Following the manual, I have staged, committed, and linked my remote repository.  Only when I try to push by P p I get stuck with the error message. How do I fix this?
Edit: I guess it's waiting for me to enter the password but I don't know where to enter.


texts: How to proceed on package.el signature check failure

texts:
I just tried to install ascii-art-to-unicode from the gnu repository (http://elpa.gnu.org/) via list-packages. I get the following error:

package--check-signature: Failed to verify signature
   ascii-art-to-unicode-1.9.el.sig: ("No public key
   for 474F05837FBDEF9B created at 2014-09-24T16:20:01+0200
   using DSA")

I'm using cask/pallet to manage my packages; is there some setup I missed? Some recent changes to elpa?

I'm using an emacs 24.4 pre-release.


texts: buffer-file-name is a function, so why doesn't M-x buffer-file-name work?

texts:
When trying to run it I get

M-x buffer-file-name [No match]

But it has a function help entry via C-h f and I can evaluate it with M-: buffer-file-name. So why isn't it accessible via M-x?


texts: Searching for org-mode property values including whitespace

texts:
I made this simple example to help explain my problem:

* entry
  :PROPERTIES:
  :author1:  me
  :author2:  my self
  :END:

Now when I do a property search with C-c a m searching author1="me" I find entry as expected.

When I try to search author2="my self" as soon as I hit space to type in the whitespace character between my and self it just says [No match] in the minibuffer and the whitespace character is not inserted. I can find entry by searching author2={self} for example or type the whitespace outside the minibuffer and copy-paste it in, but that can't be the solution... I can type in whitespace normally in other minibuffers, e.g. in the keyword search under C-c a s.

I tried typing in a search like that launching emacs -q, so without any emacs customization but got the same result. I have emacs 26.3.

What am I missing here?


texts: No visual-line-mode in emacs! How to set line wrap?

texts: I am using Emacs on mac osx 10.7*. I have the LongLines mode where long sentences are truncated on screen with $ symbol. M-x visual-line-mode does not exist in my Emacs. That is when I type M-x and then visual and TAB it says no such command, nothing with visual. How to set line wrap in this situation?


texts: Emacs Org-mode: can a follow functionality be made showing the content under a headline in a second window?

texts:
I use org-mode, and have huge text files with headings (as well as subheadings at different depths). Instead of clicking open each headline to check for its content, I would like a "follow" functionality, made such that when moving the cursor down or up the collapsed headlines in one window (commands C-n or C-p, respectively), the content under the current headline is shown in a second window, splitting the frame vertically or horizontally.

How can I make or invoke such a following mode for showing headline content?


texts: Bind multiple keys to a command using `global-set-key` interactively

texts:
I want to bind multiple keys interactively to a single function using global-set-key.
For example, let M-. g bind to project-find-file function.
How to achieve this?


texts: Void-variable error when lambda function calls itself

texts:
Here's a simple test:

(let ((func (lambda (i)
              (when (> i 0)
                (print i)
                (funcall func (1- i))))))
  (funcall func 3))

It says (void-variable func), but why? When (funcall func 3) is called then func already has a value. Why doesn't the inside of the lambda see the dynamically bound variable?


texts: find-tag: Build a new TAGS file if it does not already exist

texts:
I prefer to use the older version of find-tag, instead of the xref library.  I wrote a function to build the tag database, but I'm having trouble locating a good place to plug it in.  The default behavior when a TAGS file cannot be located is for visit-tags-table-buffer to generate an error message "File %s does not exist".  By the time we get to that message, however, it is the end of the function and too late to build a new tags file.  I would like to do this without breaking visit-tags-table-buffer.

Q:  Where can I plug-in tags-build so that I can call find-tag and be on my merry way with a new TAGS file if one does not already exist?

  (defun tags-build ()
"Build the TAGS datbase and set the default `tags-file-name'."
(interactive)
  (let ((default-directory (file-name-as-directory (expand-file-name
                             (read-directory-name ".../src directory:  ")))))
    (set-process-sentinel
      (start-process "build-tags" nil
        "/bin/bash" "-c" "find . -iname \"*.c\" -or -iname \"*.h\" | xargs etags")
      `(lambda (p e) (when (= 0 (process-exit-status p))
        (setq-default tags-file-name (expand-file-name "TAGS" ,default-directory))
        (message "tags-file-name:  %s" tags-file-name)
        tags-file-name)))))


texts: How to non-interactively dump list of open buffers, associated filenames and saved/unsaved state?

texts:
I'm trying to develop a git hook that warns me if any files that belong to a repo are unsaved in the editor. For that I need a list of open files/buffers and their state, so basically a non-interactive version of (list-buffers).

I run Emacs in server mode so I know I can do emacsclient -e '(command)', but how do I dump the list of current buffers?


texts:
first i do this in a terminal: $ git clone git://github.com/altercation/solarized.git, that creates a directory in my home called "solarized", after that i add this 2 lines to my init.el

(add-to-list 'load-path "~/.emacs.d/emacs-color-theme-solarized")
(load-theme 'color-theme-solarized.el t)

so i created a directory emacs-color-theme-solarized in ".emacs.d" and i put there the code of the color-theme.., but when i "byte-compile and load"my init.el this message came in the mini-buffer: load-theme: Unable to find theme file for `color-theme-solarized.el'

what i did wrong?


texts: How to write a major mode that does not open the file but provides a view on it

texts:
I would like to write a major mode for inspecting netCDF files. These are binary files which can be multiple GB in size. So I don't want to open them in emacs.

The interaction that I have in mind is the following:

User opens netCDF file like any other file in emacs.
A command line program (ncdump -h) is executed on the file and the output is interpreted by emacs.

The problem is that there seems to be no way to stop emacs from actually opening the file.


texts: Greek characters in graphs produced by org-babel and gnuplot

texts:
I can generate plots using gnuplot source blocks with org-babel like the following:

#+begin_src gnuplot :file plot.png
  plot x   w l t "$\epsilon$ = 1", \
       1-x w l t "ε = 0.1"
#+end_src

which I then export to HTML using:

(org-html-export-to-html)

My problem is that I would like to put greek characters in the axis labels. As demonstrated in my example, either using a LaTeX formula or an UTF-8 character would be fine for my immediate use (although using LaTeX formulas would be more general and thus better in the long run).

Is there anything I can set-up so that org-babel can export plot with nicely rendered greek characters?


texts: Is there an emacs package which can mirror a region?

texts:
Say, I have a buffer A in which there is a region of text from some position pos1 to an other position pos2.

I switch to buffer B, call a function with buffer A, pos1 and pos2 as parameters and it copies the referred region to buffer B at point and lets me edit it at either place with all the edits made in buffer B's relevant region mirrored to buffer A's relevant region and vica versa.


texts:
I really cannot bear to memorize so many options' name for Org-mode just like learning English vocabulary. For example: #+ATTR_LATEX:, #+tblname:, #+CAPTION for tables, #+ATTR_HTML: for HTML exporting.

In Org-mode, what I've known to do something similar to this are:

Block complete: enter <s press TAB to expand to a #+BEGIN_SRC ... #+END_SRC block. (or <e, <q....etc.)
Property name complete: C-c C-x p to insert property.

But, is there any built-in function to aid user to input/complete options?


texts: Emacs exchanged mutated vowels (german) into octal presentation

texts:
i am working with Emacs as my editor for quite a long time.

Yesterday, out of the sudden, Emacs presented me all mutated german vowels as octal numbers. I have tried some things, but nothing worked, Emacs is obviously not interested in interpreting his own setting(?). For example if i tell him to Set the language environment to german, he is still presenting octals, so that, for example a word like "für" is written as "f\303\274r", which makes the whole text unreadable, "Körpergrößen" for example is written as "K\303\266rpergr\303\266\303\237en" which makes the whole text worthless for editing.

This octals are shown in the old text, if i write new mutated umlaute, then they are disappearing if i save and open it again !?

regards

p.s.: the category "init-file" is only chosen because otherwise i could not post this question....
pps.: i am working on Windows 7


texts: Is it possible to create case-insensitive keywords in a generic-mode?

texts:
I am very new to Emacs and I am discovering the functionality of "generic-mode" for the first time.  I am trying to add a generic-mode to create basic syntax highlighting for an obscure programming language that I use.  It's very simple:

;; BEGIN mtl-mode
(define-generic-mode
    ;; name of mode
    'mtl-mode
    ;; comments
    ;; '("(*" . "\*)") Opening comment is (* closing is *) but not sure how to do it!
    nil
    ;; keyword list
    '("ACV" "CONTACT" "DISCHARGE" "FOR" "MODULE" "REPEAT" "TESTMACRO"
      "TRANSF" "WITH" "BITS" "CONTINUE" "ELSE" "IF" "OPTO" "RES"
      "TESTPINS" "TYPEOF" "ZENER" "BREAK" "DCI" "IND" "PATGEN"
      "RETURN" "TESTMODULE" "UNTIL" "CAP" "DCV" "EXIT" "LED" "PIN"
      "TRACK" "CASE" "DIODE" "FET" "LINK" "PULSE" "TESTBLOCK" "TRAN"
      "WHILE" "PRINTF" "FFLUSH" "STDOUT"
      )
    ;; font-lock list
    '()
    ;; auto-mode list
    '(".*mtl")
    ;; function list
    nil
    ;; documentation
    "Mode for editing Aeroflex ICT MTL files")
;; END mtl-mode

This works fine for a start, but the keywords are not actually case sensitive in MTL.  Is there a way to specify that they should not be treated as such? Or do I have to add separate keyword cases to the list for each common possibility (e.g. "WHILE" "while")


texts:
I'm trying to sync Google Calendar over OAuth2 using org-caldav. However, when I execute M-x org-caldav-sync, the following error occurs:

*Messages*:

Contacting host: www.googleapis.com:443
json-read: End of file while parsing JSON

I can't seem to figure out which process is parsing JSON. Even when I set org-caldav-debug-level to 2, the debug buffer only displays a syncing message:

*org-caldev-debug-buffer*:

========== Started sync

The only thing which has happened is the creation of an empty appointments.org file.

Is there a way to solve this, or debug what is going wrong?

This my init config (I've added the OAuth providers after reading this closed ticket):

(use-package org-caldav
  :config
  (setq org-caldav-oauth2-providers
        '((google
           "https://accounts.google.com/o/oauth2/v2/auth"
           "https://www.googleapis.com/oauth2/v4/token"
           "https://www.googleapis.com/auth/calendar"
           "https://apidata.googleusercontent.com/caldav/v2/%s/events"))
        org-caldav-url 'google
        org-caldav-oauth2-client-id "xxx"
        org-caldav-oauth2-client-secret "xxx"
        org-caldav-calendar-id "xxx"
        org-caldav-inbox "~/org/calendar/appointments.org"
        org-caldav-files '("~/org/calendar/org-caldav.org")))


texts: Open new emacs frame that steals focus from other apps?

texts:
I have this notification system in emacs that opens a new buffer with a reminder and relevant info at specified times. However, if I am using my browser I can't see it.

Therefore I am wondering whether it is possible to open a new emacs frame that steals the focus from other apps?


texts:
After taking a look at the definition of defun in byte-run.el, it seems that the macro does some very interesting things regarding checking for the existence of a docstring.

First, it uses a declare form to indicate that the third argument to the defun is the docstring. It then checks whether the third argument is a string (which means it's a docstring), or actually a declare form (which means there is no docstring).

If I understand correctly, this allows the user of a defun to specify a docstring or to it out altogether.

Is this use of an optional argument considered unusual? Usually, for a function (foo a b &optional c d &rest rest), we'd enter a nil for c if we wanted to specify d but not c. I haven't seen other examples of arguments that can simply be "left out" like the docstring.


texts: How to make Org-Babel support tangel to su/sudo file with tramp-sudo?

texts:
I hope to let org-babel can tangle to root permission file with tramp-sudo support like the following format:

#+BEGIN_SRC clojure :dir /sudo:: :tangle "/etc/kk.clj"
...
#+END_SRC

But it does not work. How to implement this?

Here is the error:

Debugger entered--Lisp error: (file-error "Removing old name" "Permission denied" "/etc/nginx/conf.d/kk.clj")
  #<subr delete-file>("/etc/nginx/conf.d/kk.clj" nil)
  ad-Advice-delete-file(#<subr delete-file> "/etc/nginx/conf.d/kk.clj")
  apply(ad-Advice-delete-file #<subr delete-file> "/etc/nginx/conf.d/kk.clj")
  delete-file("/etc/nginx/conf.d/kk.clj")
  ...  [assoc 4] 6 "\n\n(fn SPEC NAME)"] :tangle :shebang 0 :tangle-mode "yes" file-name-sans-extension "no" nil "." :mkdirp file-name-directory make-directory parents file-exists-p mapcar car delete-file generate-new-buffer " *temp*" make-byte-code "
  ...
  mapc(....
  org-babel-tangle((4))
  funcall-interactively(org-babel-tangle (4))
  call-interactively(org-babel-tangle nil nil)
  command-execute(org-babel-tangle)


texts: Looking for a Fedora 21 repository for current GNU Emacs development code

texts: I'm asking here as I can't find it anywhere on the net: I was about to learn how Emacs is actually packaged for Fedora 21 (btw, thanks a lot to the maintainers) to do the same with the latest release, but if that's already done there's not much purpose on reinventing the wheel.


texts:
Given something like:

| $1.10 |   |
| $2.20 |   |
| $3.30 |   |
|       |   |

How do you add the amounts with $-sign? C-c + does not work for me.


texts: Show hover text of internal links in exported HTML in org-mode?

texts: Is there a way to show hover text of internal links in exported HTML in org-mode? Sometime I would like to have a quick peek of the reference details of a org-ref citation link when reading the exported HTMLs of my notes.


texts: I'd like to know how GNU Emacs responds, by defaults, to such signals as HUP and USR1.  Is this behavior documented in any manual?  If so, where?  If not, is there a place I could look in the source code?


texts: Easiest way to set keybindings for strings

texts:
I use strings like "include/lib-one", "include/lib-two", "src/lib-three" all the time.

Is there an easy way to set shortcuts for these strings, e.g. as C-c 1, C-c 2 and so on?


texts: Icicles error: Cannot decrease the defualt face height more than it already

texts:
On icy-mode is enabled, I keep getting following error while I am typing, which makes it very difficult to type:
Cannot decrease the defualt face height more than it already.

Example case:
M-x => ibuf [TAB] and when enter a character it gives the warning message.
[Q] Can I supress/fix this error?
Based on the windows lise sometime mini buffer also open vertically or horizontally.
My Setup:
(add-to-list 'load-path "~/.emacs.d/lisp/icicles")
(require 'icicles)
(icy-mode 1)

(set-face-attribute 'default nil :height 100)
(variable-pitch-mode t)


texts:
I want to find my init file.. but I cannot, supposedly it must be created? How do I create an init.el file?
Do I just C-X C-F and then type ~/.emacs.d/init.el?


texts: I have started using Org-Mode and every time I close my file every headline is collapsed when I reopen it. Is there any way to stop that? I want every headline fully expanded.


texts: SMPTmail suddenly isn't reading .authinfo properly. How can I fix it?

texts:
Some update must've made it so that SMTP mail isn't reading my password from ~/.authinfo any more. It reads everything else OK (hostname, port), but prompts me for my password the first time I try to send mail after restarting emacs. So right now, every time I restart emacs, I have to open .authinfo, copy my password, and paste it into emacs. How can I get it to properly load my password from .authinfo?

In case it matters, here's my .spacemacs.


texts: How to change the color of some words in Beamer using Org-mode

texts:
I am using org-mode to export to pdf using LaTeX beamer class. How is it possible to change the color of some of the words I use in my slides?

I saw an example that uses the @ symbol: @important@ changes important to the color red. I tried the same example (beamer tutorial) but I could not obtain this effect.


texts:
I find running the following is different from just running emacs on mac

/Applications/Emacs.app/Contents/MacOS/Emacs -nw

Should I create an alias in zsh/bash for it?


texts: Why bold faces do not inherit from the `bold` face?

texts:
I had tried to use a thin weight font as the default face and a regular weight font as the bold face (try, it's a nice combination), but I desisted because there are a zillion faces that do not inherit from bold but explicitly set the weight property to bold, so that I should manually customize a zillion faces…
I'd like to know if the Emacs developers/maintainers have ever provided a reason for them explicitly setting the weight to bold, when it is possible to specify that such faces inherit from bold leading to a single point of modification.


texts: ediff - change colors and how to merge code

texts:
first question:  is how to adjust colors of ediff-revision output, tried various versions - no luck:
;; Customizing colors used in diff mode
(load-library "ediff")
(setq ediff-window-setup-function 'ediff-setup-windows-plain)
(setq ediff-split-window-function 'split-window-horizontally)

(defun update-diff-colors ()
  "update the colors for diff faces"
  (set-face-attribute 'diff-added nil
                      :foreground "white" :background "blue")
  (set-face-attribute 'diff-removed nil
                      :foreground "white" :background "red3")
  (set-face-attribute 'diff-changed nil
                      :foreground "white" :background "purple"))

(eval-after-load "diff-mode"
  '(update-diff-colors))

;; Usage: emacs -diff file1 file2
(defun command-line-diff (switch)
      (let ((file1 (pop command-line-args-left))
            (file2 (pop command-line-args-left)))
        (ediff file1 file2)))

(add-to-list 'command-switch-alist '("diff" . command-line-diff))

;; turn off whitespace checking:
(setq ediff-diff-options "-w")

(provide 'ediff-settings)

second: How to merge the changes from left to right but only a selected portion / changed block?


texts:
Every time I use pv in ansi-term it brokes my terminal. There are two possibilities:

broken terminal clears every time i press enter and hides output
it stops understand \n or something and writes output line by line in a bottom of a window, overwriting previous line by next.

How do I fix this? Why this doesn't happening in regular terminals like gnome-terminal? Is it a pv bug or something emacs-specific?


texts:
How can I rename functions project wide?

I am using spacemacs and also with tern, and it look like tern can only rename variables.


texts: auto-complete mode performance is awful in nxml-mode

texts:
Performance used to be OK, but a couple of weeks ago the performance got much worse. Some experimentation showed that it's auto-complete-mode in XML files.

When I type, it now takes a second or two for each character to appear.

This is a profiler report that covers me typing three or four words:

+ timer-event-handler                                            1636  90%
+ ...                                                             115   6%
+ command-execute                                                  34   1%
+ ac-handle-post-command                                           25   1%
+ redisplay_internal (C function)                                   2   0%
+ key-chord-input-method                                            1   0%

I have no idea what to do with it though.

If I turn off auto-complete-mode the problem instantly goes away.

Ideas, anybody?

Thanks.


texts: hs-minor-mode keybindings are undefined or bring up help window

texts:
I installed the json-mode package, then added this to my .emacs:

(require 'json-mode)
(add-hook 'json-mode-hook 'hs-minor-mode)

After opening a json file, I used Describe-variable on hs-minor-mode and found it was set to true.

But when I try to use any of the keybindings listed on Hide Show they don't work.

If I try C-c C-c for example, it says it is undefined.  If I try C-c ESC C-h as shown in the example, the help window opens.  How do I make this work.


texts: How to disable ERC connection notifications?

texts:
My ERC irc client sends some very annoying messages that fill most of my screen, letting me know that I've connected. I'd like to turn these off.

I've tried setting a couple of variables and functions to nil without success: I expected setq erc-enable-notifications nil to do what I needed, but alas, it isn't the right place for this.

I'm using the Spacemacs init with the ERC layer.

These messages fill my screen every few minutes when my bouncer reconnects to me, so I suspect the repeated spam is the fault of my ZNC bouncer configuration.


texts: automatic indentation with space like visual studio

texts:
Is there any package that covers indentation with space like visual studio?

like,

if(a==b)  ==> if(a<space>==<space>b)

for(int i=0;i<N;i++) ==> for(int i<space>=<space>0;<space>i<space><<space>N;<space>i++)

similar question is already asked but it was uploaded almost 2 years ago, then I re-ask it. (Automatically insert a space in some C expressions)

thank you in advance :-)


texts: What is the difference between `-Q` and `-q --no-init-file --nosplash`

texts:
I have started seeing some strange X related behaviour in emacs. I have not been able to pin it down. It goes away when I run emacs -Q, but is still present when running emacs -q --no-init-file --nosplash.

The man page says:

  -Q, --quick
     Similar to "-q --no-site-file --no-splash".  Also, avoid processing X resources.

What is the difference?

What does avoid processing X resources mean?

What does that tell me about my problem?


texts: Why doesn't the same Windows font look the same when migrating to emacs 26.1?

texts:
I'm trying to migrate from emacs 24.5 to emacs 26.1. I installed 26.1 and running both with the same config files. I took several tries and fixing small things in the config, for emacs 26.1 to start without errors.

However, the font setting has problems. It is set by a frame parameter in initial-frame-alist:

(font . "-outline-Consolas-normal-normal-normal-mono-18-*-*-*-c-*-iso10646-1")

It works fine in 24.5. but in 26.1 the exact same font setting results in smaller font (emacs 26.1 below):

Why is that?

According to describe font the same font and size is used, only the font version is different for some reason:

emacs 24:

name (opened by): -outline-Consolas-normal-normal-normal-mono-18-*-*-*-c-*-iso10646-1
       full name: Consolas-13.5
            size: 18
          height: 22
 baseline-offset:  0
relative-compose:  0

emacs 26.1:

name (opened by): -outline-Consolas-normal-normal-normal-mono-18-*-*-*-c-*-iso10646-1
       full name: Consolas-11.0
            size: 18
          height: 22
 baseline-offset:  0
relative-compose:  0
  default-ascent: 17
          ascent: 17
         descent:  5
   average-width: 10
     space-width: 10
       max-width: 20

Why emacs 26 finds a different version of the same font in the first place?


texts: Invoke select-buffer inside the current buffer

texts:
I accidentally activate select-buffer inside the current buffer's working area

However, no idea how to repeat the above operation even though pressing various keys.

Cloned the configuration from doom-emacs


texts:
When working with YAML (using yaml-mode), is there a way to fold a hierarchical tree in a DWIM manner (i.e., without manually adding the {{{ ... }}} markers of folding-mode manually)?
yaml-mode itself seems to have no provisions for that.
The solution must religiously keep the indentation intact, as this is critical to YAML.


texts: Error occurs during Java: (wrong-type-argument stringp (require . info))

texts:
EDIT: Error is not present with Emacs 26.3. I will revist when Emacs 27 becomes a release.

Emacs 27.0.50

This error occurs when I load a .java file or read java code in an org-mode src block. How may I prevent this error from occuring? Thank you. :)

My jvm.el config might be the culprit.

;;; package --- Summary:
;;; Commentary:
;;; JVM Languages & Support
;;;; Java
;;;; https://blog.jmibanez.com/2019/03/31/emacs-as-java-ide-revisited.html
(use-package lsp-java
  :after lsp
  :config
  (add-hook 'java-mode-hook 'lsp)
  (add-hook 'java-mode-hook 'flycheck-mode)
  (require 'dap-java))
;;;; Kotlin
;;;; Groovy & Gradle
(use-package groovy-mode)

;;;; Scala
(use-package scala-mode)
;;;; Clojure
(use-package cider
  :after lsp
  :init
  (setq lsp-enable-indentation nil)
  (add-to-list 'lsp-language-id-configuration '(clojure-mode . "clojure-mode"))
  :config
  (add-hook 'clojure-mode-hook 'lsp)
  (add-hook 'clojurec-mode-hook 'lsp)
  (add-hook 'clojurescript-mode-hook 'lsp))
(use-package cider-hydra)

;;;; Add Java to Org-babel
(org-babel-do-load-languages
 'org-babel-load-languages
   (append org-babel-load-languages
           '((java . t))))

;;;; Maven
(setq nxml-child-indent 4)

(provide 'jvm)
;;; jvm.el ends here


texts:
A local variable keeps coming back, and I know not whence.
In a certain buffer,
TeX-command-extra-options is "--synctex=1", even after I have removed
this from my init.el and restarted Emacs.
I tried setting it to something else by adding

%%% Local Variables:
%%% mode: latex
%%% TeX-master: t
%%% TeX-command-extra-options: "--output-directory=out/"
%%% End:

to the end of the file.  But, if I save and revert, the old value
persists.  If I setq the variable manually, and revert the file, the
old value comes back.  This doesn't happen with emacs -Q, but I was
hoping someone might know what is going on.  I suspect that AUCTeX is
somehow responsible.

Alternative question: how might I debug this?  It seems to me that, when
I revert, the variable is first set according to my specification, and
then reset by something or other.


texts: How to paste text into an org table with a set number of columns?

texts:
I usually have a bulk of items separated by either spaces or new lines and I want to have them all full a table with a set number of columns.

Basically if I want the table to always have 3 columns, then this text:

test1 test2     test3 test4
   test5  test6 test7

will become:

|test1|test2|test3|
|test4|test5|test6|
|test7|     |     |

How to achieve that?


texts: Drag the weblink of a file to a dired folder to save in that folder

texts:
Assume that I am visiting a folder (directory) on my system by M-x dired in Emacs. Also assume that I am visiting a webpage like http://www.gnu.org/software/emacs/manual/pdf/ by the default web browser of my system (say Mozilla Firefox). If I drag the link elisp.pdf from this webpage and drop it on that dired buffer, the most natural things that one wishes to happen is to save the file elisp.pdf in that folder.

What are the most natural way to achieve this in Emacs?


texts: How to disable DocView as default command in AUCTeX?

texts: When I'm writing a .tex file on emacs, I like to compile with pdflatex and then see the result on an external pdf viewer. The emacs manual says that I can use C-c C-c to launch any compilation method other than plain TeX, but the problem is that the default for C-c C-c is doc-view. This is a minor annoyance, because typing pdflatex [Enter] takes only a second, but still, I often wish that C-c C-c autocompleted to pdflatex. Is there a way this can be done?


texts: orgDefine a keyboard binding that works only in org-agenda when under evil

texts:
Using emacs 25.2.2 on Kubuntu 18.04 with evil and evil-org.

Here is a very basic question that I could not get a clear answer for, despite googling.

I want to define a keyboard binding that works ONLY in org-agenda when it is under evil.

I want to be able to press C-s to execute save-all-org-buffers.

How do I achieve that?


texts: Is there a function to insert the correct `(kbd "...")` by pressing the key?

texts:
I'm bored of looking up key names for the kbd function, is there a way to automatically insert the correct key name just by pressing the key?

So for example I want something to do this: I'm typing

(local-set-key |

I run magical-insert-kbd-command, press f6 and I get

(local-set-key (kbd "<f6>") |


texts: Emacs hang after installing GTK3 in windows 7

texts:
I was led to this place by @Chris from stackoverflow. My original question and steps I have taken (thanks to Chris' suggestion) and outcomes are at : https://stackoverflow.com/questions/30972920/emacs-hang-after-installing-gtk3-in-windows-7. Basically under windows 7, emacs setup was fine until I installed GTK3+ for windows 7. Then emacs hang while starting. The menu appears but everything else not.

My original intent is to learn common lisp, and specifically use cl-cffi-gtk package. Now it looks like that I have to do this under linux using a VM.  It bugs me a lot since my main working environment is windows 7. Thanks a lot.

Sorry that I can't use gtk3 as tag because of lack of reputation.


texts: Why is my Python indentation set to 8 locally by default?

texts:
I'm running Emacs 25.2.2 on Ubuntu 18.04 for WSL. I launch emacs -q and open a new Python file, test.py. As soon as I hit the Tab key, I notice the indentation is 8 spaces instead of 4. I don't like that.

I run describe-variable to check on python-indent and I see:

python-indent is a variable defined in ‘python.el’.
Its value is 8
Local in buffer test.py; global value is 4

    This variable is an alias for ‘python-indent-offset’.
    This variable is obsolete since 24.3;
    use ‘python-indent-offset’ instead.`

[...]

As for the preferred variable:

python-indent-offset is a variable defined in ‘python.el’.
Its value is 4

[...]

Am I correct to think that this is a major bug in the default Python mode? What's the simplest fix or workaround?


texts: I have two messages were one message is a reply to another. Because of an error while sending the second message is not showed as a reply to the first. In mutt I could 'join' two messages, is something like this also possible in mu4e?


texts: I did a spurious replacement across many files that shows in Emacs as '^E', equivalently the result of C-q C-E. What ASCII character does that correspond to, so I can undo the replacement?


texts: How to set the frame for opening pdf in org mode?

texts:
I have two links in my org buffer:
[file://tmp/foo.pdf]
[file://tmp/bar.pdf]

Hitting enter on [file://tmp/foo.pdf] opens the pdf in the same frame (using pdf-tools / ..Running /usr/bin/xdg-open..).
I split the frames in order to see the pdf alongside the org buffer.
But now hitting enter on [file://tmp/bar.pdf] opens again in the same frame, and now I don't see my org buffer anymore, have to switch it again etc.
How can I open the file in org but use the other frame for it's displaying?
Ctrl h v org-link-frame-setup returns
org-link-frame-setup is a variable defined in ‘ol.el’.
Its value is
((vm . vm-visit-folder-other-frame)
 (vm-imap . vm-visit-imap-folder-other-frame)
 (gnus . org-gnus-no-new-news)
 (file . find-file-other-window)
 (wl . wl-other-frame))

I tried (file . find-file-other-frame) without effect


texts: How to "swap" only the numerical row of a keyboard inside Emacs?

texts:
My question is:

when I am editing (La)TeX code, regularly I need to type the famous dollar signs in order to put mathematical code ($x^2+y^2=z^2$), a very frequent thing indeed.

Therefore, I would like to change the keyboard input inside Emacs (preferably only in TeX-related modes), in order to swap the numerical row of the keyboard; that way, I don't need to press Shift key in order to insert special symbols in the numerical row like $&*#%[]...

(Also, my keyboard is a Brazilian ABNT2)

Many thanks in advance!


texts:
I am trying to create a Regex for Imenu indexing for my CSS modes but I'm having trouble getting it exactly right as I'm no regular expression guru. Here's a snippet of LESS CSS I'm using (regexp-builder) to test against:

@font-face {
  font-family: 'sorts_mill_goudyregular';
  src: url('/webfonts/GoudyStM-webfont.eot');
  font-weight: normal;
  font-style: normal;
}

body {
  margin: 0;
  padding: 0;
}

#foo {
  color: blue;
}

h1,
h2,
h3,
.CheltenhamBT-BoldHeadline {
  font-family: CheltenhamBT-BoldHeadline;
  font-weight: normal;
  font-style: normal;
}

.ClarendonText-Bold {
  font-family: ClarendonText-Bold;
  font-weight: normal;
  font-style: normal;
  .bold {
    font-weight: bold;
  }
}

Given this, I would like the menu to contain the following entries:

@font-face
body
#foo
h1, h2, h3, .CheltenhamBT-BoldHeadline
.ClarendonText-Bold

Note, I'm not interested in the nested .bold declaration.

I've tried a few approaches and have it mainly working, but I'm having trouble accounting for the occasional ,\n. Here's my current regex:

"^\\([\\.#@]?[a-z0-9_-]+\\(,\n\\)*\\)\\s-{$"

Can anyone help me out?


texts: Full path figure export to LaTeX error in org-mode in Windows 7

texts:
when I export a full path figure , like:
[[file:c:/Users/admin/Desktop/1.png]]

to LaTeX in org-mode, a result of
{//c:/Users/admin/Desktop/1.png}

was generated. One more // was generated in front of c:,
which is an error in LaTeX.

How can I solve this problem?

I have posted this problem to org-mode mail list, but nobody replied me, so I continued to ask here. Thanks for any help.


texts: How to add additional comment syntax to a mode?

texts:
In general, given a major mode with a defined comment syntax, what do I have to define or change to add a new comment syntax? By "adding", I mean setting some new characters so that they

work with commands such as comment-line, comment-dwim, comment-indent-new-line
are preserved nicely by fill-paragraph
get in all other ways treated as comments usually work in programming modes, including the proper spacing after the comment string

(Syntax highlighting will be specific to the mode, I guess, but if there is something more general -- please tell.)

Also, of course I'd like to have a function (or functions?) to apply the new comment syntax like with comment-line, which I can then bind to some keys, without having to implement all by myself, if possible.

There are description of some commands and variables here, but that doesn't answer all questions completely.  For examle, some modes seem to include the space after the actual comment character into comment-start, while others don't -- why? Does it make a difference?

The only similar question I could find was this, but it's a bit more specific, and I don't know really what the provided answers do.  For C and C++, there must certainly be a way that handles both // and /**/ comments, but that's not elaborated there... Also, I don't want to define a whole new major mode just for comments.  This question is close, but unanswered.

My concrete use case: I'm working with julia-mode, where there normally are line comments starting with #.  The syntax handling of that is, I think, defined here by setting comment-start to "# " and comment-start-skip to "#+\\s-*".  What would I have to do to make line comments starting with #' and #+ be handled the same, preserving the standard comments? (For the curious, these kinds of comments are used in Weave.)

I set

(setq comment-start "#' "
      comment-start-skip "#+'?\\s-*")

but that doesn't quite do what I want:

comment-line now inserts comments starting with #', but I'd like it to keep using standard comments (just #).  It manages to uncomment lines starting with both # and #', though.
fill-paragraph basically ignores the ', and behaves as with normal # (ie., #' bla\n #' blub becomes #' bla ' blub instead of #' bla blub, while doing the right thing without the single quotes).

What I want is to keep everything related to only # the same, but respect the compounds #' and #+ in formatting and uncommenting.  And have extra commands to insert them, equivalent to comment-line.


texts: How do I update this defun to select region

texts:
I wrote this function which takes a string and writes out self.var for each entry in the string. This helps me create python classes faster.

(defun elf-python-self (str)
  "Parse the arguemnts in STR and write out self.var = var."
  (interactive (list (read-string "Argument List: ")))
  (message str)
  (let ((var-list (split-string str ","))
        (var-name))
    (forward-line)
    (move-beginning-of-line nil)
    (while (> (length var-list) 0)
      (setq var-name (strip (pop var-list)))
      (message var-name)
      (insert (format "        self.%s = %s\n" var-name var-name)))))

If I type a, b, c then I get the following

    self.a = a
    self.b = b
    self.c = c

How do I modify this function to apply the code to the selected region?


texts: How to set minor mode variables in dir-locals?

texts:
Im writing an lsp-mode purescript client and couldn't figure out how to override the default config options using a .dir-locals file.

For example, I have a defcustom :

defcustom lsp-purescript-use-npx t
  "Whether to execute using npx or a globally installed version. Defaults to Npx"
  :type '(choice (const :tag "Npx" t)
                  (const :tag "Global" nil))
  :group 'lsp-purescript)

The problem I'm essentially trying to solve is how to set a variable for a minor mode. I'd like to set the value of lsp-purescript-use-npx within dir-locals but the docs ive seen only show how to set major mode variables

Any help and/or urls for documentation?


texts:
Is there a way in EMMS that I can browse by folders, instead of artists?
I can use smart browse to open a buffer that can add songs to the playlist. That buffer opens by artists, how can I change it to open by folders instead?


texts:
I am trying to customize Emacs by adding a feature where I can select a block of text (like the region but not bound by mark and point).

Currently I have implemented this by setting two variables that mark the start and end of the block.

(defvar block-mark-start nil "Start of block.")
(defvar block-mark-end   nil "End of block.")

This works, I am able to manipulate the text within this block like I want to. However, I am now trying to get  the block to be highlighted.

At first I tried manually setting the face of this text:

(add-text-properties block-mark-start block-mark-end '(font-lock-face myface))

This worked, however I was unable to unset the highlighting, this approach also seemed to occasionally break with things not getting highlighted, things outside the block getting highlighted, etc..

So I moved on to trying libraries like Highlight but there doesn't seem to be a way to highlight arbitrary text, you can only use the mouse, region, or regexs. I have similar issues with the secondary selection.

I am trying to emulate the way blocks work in Wordstar / Joe's Own Editor.


texts: Set default language for code-blocks in orgmode

texts:
Is there a way to define a default language for org-mode code blocks in the docuement header?  Usually, within one org document, I only use one programming language, so it's getting tiresome to always write

#+BEGIN_SRC python
[...]
#+END_SRC

It would be nice to be able to do something like

#+PROPERTY: header-args :session *mysession* :tangle yes :results silent :language python

[...]

#+BEGIN_SRC
[...]
#+END_SRC

Is there any way to achieve this?


texts: Kill-buffer prompt with option to diff the changes

texts:
The save-some-buffers command prompts to save or ignore each modified file, and also provides an option to diff the modified file against the file it is visiting.

I'd like the same behavior from kill-buffer or kill-this-buffer. If the buffer is modified there is already a yes/no prompt but I'd also like the option to see the diffs.

Is there a built-in way to do this, or an appropriate extension point? Or should I just bind my own kill-buffer command?


texts: Search and replace on lines range, numerically

texts: I was lately being teased by a vi user. He said that within few commands, one can do search-replace (both regexp and simple string ), on lines range. And one does not need to do highlight. One inputs start, end, and the string and replacement, pretty much.Is there a way to do that in emacs? I'd hate to lose in a religious war ;-)


texts: How to pop an arbitrary element from a list?

texts:
Q: how do I pop an arbitrary element from a list?

Given the list '(a b c d e), pop returns a and destructively
modifies the list to '(b c d e).  How can I generalize this
function so I could pop an arbitrary element (say, c)?

I'm almost sure I've seen this in a library somewhere, but can't
remember where.


texts: How can I prevent auctex to indent a new environment inside another environment?

texts:
Suppose I enter the following code using LaTeX-environment

\begin{tikzpicture}
    \begin{pycode}
        a = 2
    \end{pycode}
\end{tikzpicture}

Then auctex automatically indents as shown above. This is not desired since it will bring error messages if I compile it via pythontex because of wrong indentation.

So I have two question:

How to prevent that the pycode environment becomes indented if it is insied any other environment (for example tikzpicture)
How to prevent that code inside a pycode environment is indented by auctex.

Note that this is a follow up question to Pythontex and auctex, so the solution should work together with mmm-mode.

Edit

After giordanos suggestion I made a minimal .emacs file:

(require 'package)
;; (add-to-list 'package-archives
;;     '("marmalade" .
;;       "http://marmalade-repo.org/packages/"))
;; (add-to-list 'package-archives
;;              '("melpa" . "http://melpa.milkbox.net/packages/") t)

;; (setq package-archive-enable-alist '(("melpa" deft magit)))

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

(package-initialize)

(add-hook 'LaTeX-mode-hook (lambda ()

(add-to-list 'LaTeX-verbatim-environments "pycode")
(add-to-list 'LaTeX-indent-environment-list
        '("pycode" current-indentation))
))

(require 'python)
(defun python-indent-guess-indent-offset ()
  "Guess and set `python-indent-offset' for the current buffer."
  (interactive))

(require 'mmm-auto)
(mmm-add-group 'latex-python
 '((latex-python-envs
    :submode python-mode
    :face mmm-default-submode-face
    :front "\\\\begin{\\(pycode\\|pyverbatim\\)}\n"
    :back "\\\\end{~1}\n"
    :save-matches 1)

   (latex-python-cmds
    :submode python-mode
    :face mmm-default-submode-face
    :front "\\\\pyc?{"
    :back "}")))

;; (setq mmm-global-mode 'maybe)
;; (setq mmm-submode-decoration-level 0)
(mmm-add-mode-ext-class 'latex-mode nil 'latex-python)
;; (global-set-key [(f11)] 'mmm-parse-buffer)

(advice-add 'LaTeX-insert-environment ':after '(lambda (env) (mmm-parse-block 2)))

It works but messes up the syntax highlighting:

If I do C-c C-n, it becomes ok, but the mmm-mode get's disabled:

If I enable the mmm-mode again, I get the first picture again.


texts: Point motion strategy for Emacs 25 and older

texts:
I've read What is inhibit-point-motion-hooks?.

Assume some minor-mode my-mode that wants to do point-motion-y
things.

Assume my--point-entered and my--point-left functions that work
fine in Emacs < 25, when my-mode sets point-entered and
point-left props to use them.

Assume I'd like to have the mode keep working on Emacs < 25, but also
do the right thing if it finds itself on 25+. What is the right thing
to do?

I could (setq-local inhibit-point-motion-hooks nil) and call it a day. But that var is described as "obsolete", which seems stronger than
"deprecated". So that seems like not the right thing.

Is the following a good template to use instead?

;; When mode is enabled
(when (fboundp 'cursor-sensor-mode)
  (cursor-sensor-mode 1))

;; When mode is disabled
(when (fboundp 'cursor-sensor-mode)
  (cursor-sensor-mode -1))

(defun my--cursor-sensor-function (window old dir)
  (let ((new (window-point window))) ;is this correct ???
    (pcase dir
      (`entered (my--point-entered old new))
      (`left    (my--point-left    old new)))))
;; where my--point-* are existing point motion functions

;; Where the props are added:
(let ((motion-props (if (fboundp 'cursor-sensor-mode)
                              (list 'cursor-sensor-functions
                                    (list #'my--cursor-sensor-function))
                            (list 'point-entered #'my--point-entered
                                  'point-left    #'my--point-left))))
  (add-text-properties beg
                       end
                       (append (list 'some-other-prop some-val)
                               motion-props)))

Or if that's not a good approach, what is the recommended way to work
with both older and newer versions of Emacs?


texts: Is it normal that I can recover nothing from "recover-session" but I can recover my file from "recover-file"?

texts:
I added some contents to a file, killed emacs without saving it, then started emacs and tried to recover the file's contents.
At first I tried to use recover-session, and got a prompt:
No previous sessions to recover

Seemed that emacs didn't save my file contents. But when I tried to use recover-file, it worked, my file was restored. So emacs did save my file contents, but recover-session couldn't find it, why? Is it normal?


texts:
I have written till the 35th line in Emacs with activated line numbers (so my last line number is 35). When I am writing in the 32nd line there are line numbers flickering up to the 43rd line number (appearing only while writing) and when I stop they disappear.

The line numbers I mentioned (35 32 43) are just to explain the problem and they are simply my current line numbers. The same happens if I have 5 or 10 or any number of lines.

Why are those line numbers flickering and how can I make them stop appearing?


texts: Orgmode - scheduling recurring events without using sexp or +-syntax

texts:
I'm trying to use my Orgmode calendar via MobileOrg on my Android devices, to push events to the Google calendar, and neither sexp-formatted events nor recurring events (set up with +) seem to appear in Google calendar (for + recurring events the first one appears, but none of the subsequent ones).

The solution would seem to be to create individual entries for every occurrence of the recurring event, which will be tedious and inefficient.  I assume there must be a way of harnessing the power of elisp in such a way to create a function which, when given a start date and a stop date and a time-span for recurrence [e.g. every day, every week etc.] (and, ideally, note any skipped dates, e.g. for holidays) and have that function output individual org-mode events.  Has anyone done this sort of thing?


texts: How to set org-mode category icon on per file basis?

texts:
Can you set org-mode category icon on per file basis? If so, then how?
It is usually set by adding icons to org-agenda-category-icon-alist globally, like so:

(setq org-agenda-category-icon-alist '(
    ("computer" ,(list (all-the-icons-material "computer" :height 1.0)) nil nil :ascent center)
))

Further, there is an option available to specify the category (but not the icon, which would be really nice) on per file basis, as follows (e.g., in a file called not_computer.org)[1]:
#+CATEGORY: computer

Finally, there is a way to specify file local variables, but I do not think that would help (my elisp is not sufficient to solve this)[2]:
-*- mode: modename; var: value; ... -*-


texts:
If I want to show only lines that content "Buy" I use command occur:

Like this:

Nice.

But I need to show lines that content "Buy" and 0.00000057

So the result must like this

How I can do this by occur command?


texts:
I want to be able to save my buffer local evil markers (m to mark a location and then ' or ` to jump to it) across emacs sessions/instances. I'm not really sure how to do this. I tried installing/using session and adding them like so:

(add-to-list 'session-locals-include 'evil-markers-alist)

This doesn't work though, and I'm not sure what else to try. Thanks.


texts: Changing global-whitespace-mode options locally to a particular buffer

texts:
I want to customize the behavior of global-whitespace-mode on a per-major-mode basis, and also define some interactive commands that change what's being highlighted on a per-buffer basis.  global-whitespace-mode does something rather more complicated than just turning on whitespace-mode in every buffer, I don't particularly understand why, but anyway it's getting in the way of me writing those interactive commands.  Specifically, this function works as a mode hook but not as an interactive command:
(defun turn-off-highlight-long-lines ()
  "Turn off highlighting of long lines via global-whitespace-mode."
  (interactive)
  (let* ((already-active-p (local-variable-p 'whitespace-active-style))
         (desired-style
          (delq 'lines (copy-sequence (if already-active-p
                                          whitespace-active-style
                                        whitespace-style)))))
    (if already-active-p
        (progn (setq whitespace-active-style desired-style)
               (whitespace-color-on))
      (setq-local whitespace-style desired-style))))

But this seems to be exactly what (global-)whitespace-toggle-options does, except buffer-locally, so I'm stumped.
(I'm not using (global-)whitespace-toggle-options because I want the effect to be buffer-local.)


texts: Go to item that links to id of current item?

texts:
I'm setting up something similar to org-depend, but more plain-text.

I have a sub item with an id:

* TODO my sub task
  :PROPERTIES:
  :ID:       b988fcc3-5f73-4f4c-8b90-38c63d3ee72c
  :END:
  task notes

And another task that points to it via a link with id:

* TODO master task
 - [ ] bake cake
 - [ ] [[id:b988fcc3-5f73-4f4c-8b90-38c63d3ee72c][my sub task]]

Now for the  sub task, in the title like I want to insert an elisp link that jumps to what ever links to it. Like so:

* TODO my sub task [[elisp:(org-occur-link-in-agenda-files)][parent]]

Now when I run org-occur-link-in-agenda-files in M - x , I get a list of links. But the above command inside an elisp link in the title doesn't do anything, it just prints 't' in the output line.

Does anyone know how to implement this?

[edit]
This works only if the parent is below the child and only in the same file.

[[elisp:(search-forward-regexp (concat "id:" (org-id-get-create)))]]

Now it would be good to be able to go to the first matching regex item somehow?


texts: Org Agenda faces do not appear after applying themes

texts:
In my Org Agenda all text except for priorities use the "default" face. Until recently I would see colourful text for say, todo status. I was playing around with custom themes, so I may have broken something. However I can't seem to undo this change, even after reverting all changes.

How can I make the Org Agenda use the correct faces instead of just using "default"?


texts:
I have had a problem with undoing lately, which seems rather dangerous and has
almost lost me work.  At first I thought it was due to undo-tree, so I
deactivated that.  But it persists and now I suspect yasnippet.  I just got the
following when trying to redo.  (Work would have been lost if I hadn't already
saved.)

apply: Wrong number of arguments: #[(snippet) "ÂH  > [snippet
cl-struct-yas--snippet-tags 0 signal wrong-type-argument yas--snippet 2
yas--commit-snippet] 4 ("/home/toothrot/.emacs.d/elpa/yasnippet-20180111.1533/yasnippet.elc" .
175423)], 3

Sorry I haven't had time to investigate this very thoroughly, but perhaps
someone has had the same problem.


texts: Copying and pasting org tables misaligned?

texts:
I have a table in Org mode that looks as shown below

| S.No. | Template       | V800A | V800B |
|-------+----------------+-------+-------|
|    1. | IFD03B         |    17 |     8 |
|    2. | Calcs          |     5 |     5 |
|    3. | ALM_4S_AX04B   |    20 |    16 |
|    4. | ALM_DX05B      |     7 |     2 |
|    5. | ALM_1S_HZD05B  |     2 |     1 |
|    6. | ALM_RERING03B  |     4 |     4 |
|    7. | ALM_DI_DO05B   |    17 |    16 |
|    8. | IS04B          |     2 |     2 |
|    9. | Step06B        |    12 |    14 |
|   10. | DO_INDEPEND06B |     8 |     8 |
|   11. | AO_PID13_01B   |     5 |     5 |
|-------+----------------+-------+-------|
|       | Total          |    99 |    81 |

But when I paste this content within MS Outlook or MS Excel it looks as shown below.

Why does this behave in such a manner and what should I do to fix this?
Presently, I'm using Text to Columns option (in MS Excel) to convert this into a table and deleting the | and it makes a clean excel table.
For Outlook, I do not have such options to exercise.
Are there any settings to be made into Emacs to fix this?

P.S:  I'm on Windows 7 with Emacs 24.5.1 installed. I will attempt this on Ubuntu (+open office) and update the question later.


texts: How do I get rtags to work in spacemacs?

texts:
On a recent pull of both rtags and spacemacs, but I can't seem to get rtags to work well. There is no keybindings for jumping/searching to/for symbols and the definitions either. I've seen a couple places that that about either mineo layer or that c++-mode itself has support, but I can't find the magic words.

I have c-c++-backend set to 'rtags but it still keeps asking me what tags file I want to use. I already have rdm up and running and I get queries back from it, so that isn't an issue.

What is the current way to use rtags in c++-node for spacemacs?


texts:
Using this widget:

(widget-create 'editable-field :size 4 :format "text1 %v text2")
(widget-setup)

I get the following output (where the underscores appear as a fillable grey area)

text1 ____ text2

In general, when hitting Enter inside an editable field area, the effect is a jump to the next field.
(widget-setup) sets the buffer read-only, therefore outside the editable area, hitting Enter gives widget-before-change: Text is read-only: "Attempt to change text outside editable field".

However, if I place the cursor immediately before text2, hitting Enter inserts an undesired newline, while that should be a read-only area.

Why is a newline added despite that is a read-only area?
How can I prevent the newline insertion?


texts: What is the difference between 'python-shell-send-buffer' and 'python-execute-file'?

texts:
I have had difficulties to run any python code when using python-execute-file (SPC m c c in spacemacs), until I finally found out that I have to use python-shell-send-buffer (SPC m s b in Spacemacs) to run code.

I wonder what is the purpose of python-execute-file then?


texts: Show the matching line in the center of the screen instead of the bottom when opening a grep result

texts:
When I grep something inside emacs and click to open one of the matching files. The matching line is always displayed at the bottom of the screen, and I have to scroll it up for a better view.

Is it possible to focus the matching line at the center of the screen automatically when opening one of the grep results?


texts:
org-agenda-sorting-strategy priority sorting doesn't work in my setup.
I have a single file for all the tasks for agenda. Its structure looks similar to
this:
#+STARTUP: overview
#+CATEGORY: Tasks
#+ARCHIVE: ../archive/tasks_archive.org::

* Tasks
:PROPERTIES:
:CATEGORY: Single
:END:
** TODO [#B] task 1
SCHEDULED: <2020-08-06 Thu>
** TODO [#B] task 2
SCHEDULED: <2020-08-06 Thu>
** TODO [#C] task 3
SCHEDULED: <2020-08-06 Thu>
** TODO [#A] task 4
SCHEDULED: <2020-08-06 Thu>

* Repeatable
:PROPERTIES:
:CATEGORY: Repeat
:END:
** TODO [#B] task 5
SCHEDULED: <2020-08-06 Thu .+1d>
:PROPERTIES:
:STYLE:    habit
:END:
** TODO [#D] task 6
SCHEDULED: <2020-08-06 Thu .+1d>
:PROPERTIES:
:STYLE:    habit
:END:
** TODO [#C] task 7
SCHEDULED: <2020-02-02 Sun ++1m>
:PROPERTIES:
:LAST_REPEAT: [2020-08-06 Thu 20:44]
:STYLE:    habit
:END:
** TODO [#A] task 8
SCHEDULED: <2020-08-06 Thu .+1d>
:PROPERTIES:
:STYLE:    habit
:END:

* Waiting
:PROPERTIES:
:CATEGORY: Wait
:END:
** TODO [#A] task 9
SCHEDULED: <2020-08-06 Thu>
** TODO [#C] task 10
SCHEDULED: <2020-08-06 Thu>
** TODO [#B] task 11
SCHEDULED: <2020-08-06 Thu>
** TODO [#D] task 12
SCHEDULED: <2020-08-06 Thu>

* Projects
:PROPERTIES:
:CATEGORY: Project
:END:
** TODO [#B] task 13
SCHEDULED: <2020-08-06 Thu>
** TODO [#D] task 14
SCHEDULED: <2020-08-06 Thu>
** TODO [#C] task 15
SCHEDULED: <2020-08-06 Thu>
** TODO [#B] task 16
SCHEDULED: <2020-08-06 Thu>

My setup to display agenda looks similar to this:
(agenda ""
  ((org-agenda-skip-function
     '(or
        (org-agenda-skip-entry-if 'todo '("WAITING"))
        ))
    (org-agenda-cmp-user-defined 'jarfar/org-agenda-cmp-user-defined-birthday)
    (org-agenda-sorting-strategy '(time-up todo-state-down user-defined-down habit-down priority-up deadline-up scheduled-up effort-down alpha-up))
    (org-agenda-remove-tags nil)
    (ps-number-of-columns 2)
    (ps-landscape-mode 1)
    (org-agenda-files (append org-agenda-files `(,my/org-events-file-path)))))

(defun jarfar/org-agenda-cmp-user-defined-birthday (a b)
  "Org Agenda user function to sort categories against other categories. The birthday category is considered to be behind other category by default."
  (let* ((pla (get-text-property 0 "CATEGORY" a))
          (plb (get-text-property 0 "CATEGORY" b))
          (pla (string-equal pla "Birthday"))
          (plb (string-equal plb "Birthday"))
          )
    (if (or (and pla plb) (and (not pla) (not plb)))
      0
      (if pla
        1
        -1))))

The agenda show records with different priorities totally mixed up. When I run
agenda with org-agenda-sorting-strategy set to just priority-up it
doesn't change anything.
Any hint what could be wrong?

EDIT:
I solved most of the problem. The main issue was caused by wrong implementation of
jarfar/org-agenda-cmp-user-defined-birthday the correct one is:
(defun jarfar/org-agenda-cmp-user-defined-birthday (a b)
  "Org Agenda user function to sort categories against other categories. The birthday category is considered to be behind other category by default."
  (let* ((pla (get-text-property 0 "CATEGORY" a))
          (plb (get-text-property 0 "CATEGORY" b))
          (pla (string-equal pla "Birthday"))
          (plb (string-equal plb "Birthday"))
          )
    (if (or (and pla plb) (and (not pla) (not plb)))
      nil
      (if pla
        +1
        -1))))

The tasks are now sorting fine, but habits still not. They still sort in a weird way.
My current sorting setting is:
(setq org-agenda-sorting-strategy '(time-up todo-state-down user-defined-down habit-down priority-down deadline-up scheduled-up effort-down alpha-up))

Any clue?


texts: How to rebind C-backspace in projectile find file?

texts:
I've installed helm and projectile modes and I wanted to restore the previous behaviour of the C-backspace binding to kill whole last word.

In these modes, when looking for a file (after pressing C-x-f), this binding is changed to turn on/off auto expansion (it seems to run the helm-ff-run-toggle-auto-update function).

I've put this in my init.el:

(define-key helm-find-files-map (kbd "<C-backspace>") 'backward-kill-word)
(define-key helm-projectile-find-file-map (kbd "<C-backspace>") 'backward-kill-word)

And when I run describe-variable for helm-find-files-map and helm-projectile-find-file-map they indeed contain the (C-backspace . backward-kill-word) entry.

Unfortunately, pressing C-backspace in helm-find-file still toggles auto expansion instead of deleting the last path entry. How to achieve this?

This is the minimal example of init.el contents that should reproduce this behaviour:

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

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

(projectile-global-mode)
(setq projectile-completion-system 'helm)
(helm-projectile-on)

(helm-mode 1)

(define-key helm-find-files-map (kbd "<C-backspace>") 'backward-kill-word)
(define-key helm-projectile-find-file-map (kbd "<C-backspace>") 'backward-kill-word)


texts:
Messages displayed by Gnus with HTML rendering may contain links which don't display the URL, instead they display the text which tells what this link is about.

I've found a way to extract the URL by doing M-xdescribe-text-properties and then in the buffer with the properties, I'd need to expand the shr-url section.  The question thus: is there a more straight-forward way to do this?


texts: Simulating mouse operations with keyboard

texts:
Is there a way, via some command that can be invoked by the keyboard, of making Emacs think that I clicked at a particular point (so that it does whatever it would have done if I clicked there, e.g. follow link or pop up a menu)? Or that I hovered mouse at point (so that tool tip pops up)?

[Motivation: Some modes decorate the buffer, turning some text into links and so on. I may know how to do something with the mouse (e.g. click on it), but not the equivalent keyboard shortcut/command to invoke. Of course I should read documentation for the mode and learn it, but thought it's an interesting question.]


texts:
Often times I find an interesting article online that I want to read later but I have a different priorities so I just paste a link into my org notes. Later these links become broken, and the articles are lost forever.
What I found works pretty well is to use https://archive.org/web/ to preserve online articles for later use. To save an article we just use the form on the bottom of the page. After a moment the link is ready.
I wish to simplify this process by just converting link at the point to archived one. The archiving is not guaranteed, though. Some of the websites don't allow crawlers and for the archive.org this is a must - "Only available for sites that allow crawlers."
Does anyone of you managed to implement such a solution?
I consider alternative solutions like downloading the page with the images into separate folder - most often I use w3m to read these articles, but not all of them may be opened in no-JS browser and I wish to have solution that will work even then.


texts: Matching pairs for character bound to a keystroke

texts:
I am using smartparens with AucTeX and it works great. I wanted to map a keystroke for the dollar sign, so I did it as follows -

(global-set-key (kbd "s-m") (lambda () (interactive) (insert "$")))

But if I enter a dollar sign using the above keystroke, I no longer get a matching dollar sign as opposed to if enter a dollar sign the normal way (shift+4).

I'm not sure I understand why this happens. If anyone could point to the right place in the documentation so I can work out a fix, it'd be much appreciated.


texts: Search/replace-like feature for swapping text

texts:
I frequently find myself trying to replace e.g. foo with bar and bar with foo in a buffer.

The way I usually do it is either:

3 query-replaces: aaa -> @@@, bbb -> aaa, @@@ -> bbb
give up on automation and just do the replacement by hand

I suppose that it is possible to get something working using the , syntax in query-replace-regexp to test if the matched string is aaa or bbb. But the resulting syntax would be too cumbersome, so I never really tried it.

The thing is, given how common a task it is, I think there must be a better, single-step, way of doing it, either built-in or in an existing package. Is there?


texts: Dired+ doesn’t work on old remote system

texts:
When connected to an old remote system with Tramp 2.4.3.27.1, the buffer shows no files. With tramp-verbose set to 6, I looked at the Tramp debug buffer, then found (anonymized):
13:27:21.657267 tramp-send-command (6) # /bin/ls --color=never --dired -algGh /user/user/. 2>/dev/null

When I remove 2>/dev/null and execute the above command, I get:
/bin/ls: invalid option -- h
Try `/bin/ls --help' for more information.

ls on the remote system is part of GNU fileutils 3.16 and does not support the option -h. For my regular system I have configured dired+:
(dired-listing-switches "-algGh")

Is there any way to use a different configuration for that remote system?
What I tried, unsuccessfully:
(connection-local-set-profile-variables
  'example.com
  '((dired-listing-switches nil)))
(connection-local-set-profiles
 '(:application 'tramp :machine "example.com")
 'example.com)

How I connect to the old system
The system only supports connection by SSH v1. For that purpose, plink and pscp do support the option -1. So I added to tramp-connection-properties:
("/plink:user@example\\.com:" "login-args"
 (("-1")
  ("-l" "%u")
  ("%h")))))

Now I can connect to /plink:user@example.com:.
My solution
Thanks to Michael Albinus’ answer, I came up with:
(defun my-dired-before-readin-hook ()
  (let ((remote-host (file-remote-p default-directory 'host)))
    (when (string= remote-host "example.com")
      (setq dired-actual-switches "-algG"))))
(add-hook 'dired-before-readin-hook 'my-dired-before-readin-hook)


texts: org -captue template display a fake board

texts:
After I updated doom-emacs, the todo captuer template board displayed as

It's actually a fake board because I custom them as

(setq org-capture-templates
      '(("n" "Personal Note" entry
         (file+function "~/Documents/OrgMode/ORG/src/todo.today.org"
                        my-org-goto-last-personal-notes-headline)
         "* %T %?")
        ("t" "Personal Todo" entry
         (file+function "~/Documents/OrgMode/ORG/src/todo.today.org"
                        my-org-goto-last-personal-tasks-headline) "* TODO %i%?")

        ("pn" "Project Note" entry
         (file+function "~/Documents/OrgMode/ORG/src/todo.today.org"
                        my-org-goto-last-project-notes-headline)
         "* %T %?")
        ("pt" "Project Todo" entry
         (file+function "~/Documents/OrgMode/ORG/src/todo.today.org"
                        my-org-goto-last-project-tasks-headline) "* TODO %i%?")

        ("T" "Tickler" entry
         (file+headline "~/Documents/OrgMode/ORG/src/tickler.org" "Tickler") "* %i%? \n %U")))

So when I dispatch pt, it invoke 'project dotorather than 'personal todo

Where could configure the board?


texts: Is there a way to have multiple modes in one buffer?

texts:
This is kind of a weird question, but I have a file that's a mix of perl, text, and Bourne shell.  Is there some (easy) way to have emacs switch major modes at different points in the file?

Perhaps when it sees -*- Text -*- or -*- Perl -*- or something?

Or can I just change it for the region if I narrow-to-region?

Thanks.

-E

I just noticed that there is a tag for "multiple-modes", so I'm hopeful.


texts:
I'm following the instruction here to set the default font:

(add-to-list 'default-frame-alist '(font . "Monospace 10"))
(set-face-attribute 'default t :font "Monospace 10")

This works. To avoid the repetition, I tried factoring the string out with let:

(let ((f "Monospace 10"))
  (add-to-list 'default-frame-alist '(font . f))
  (set-face-attribute 'default t :font f))

The result I get when I load this is

  Invalid font: f

Why is the second expression not equivalent to the first pair of statements?


texts: yas-expand doesn't trigger reindent in aggressive-indent-mode

texts:
I'm trying to make a call to yas-expand doesn't trigger aggressive-indent. I'm guessing this is because yas-expand, for some reason, doesn't trigger a call to after-change-functions into which aggressive-indent--keep-track-of-changes is added when the aggressive-indent package is loaded.
Is there a way to make yas-expand at the end trigger the correct call to after-change-functions?
I was thinking something like
(add-hook 'yas-after-exit-snippet-hook
            (lambda () (run-hooks '(after-change-functions))))

would do the trick but this error.
For the time being I'm using the hack
(add-hook 'yas-after-exit-snippet-hook
            (lambda ()
              (insert " ")
              (backward-delete-char 1)))

to trigger a call to after-change-functions.
Is there a way to manually trigger a call to after-change-functions?


texts:
I've run into a bit of an issue that I'm having trouble resolving.  I use quite a few packages, one of which is ESS.  The latest update to ESS seems to run into issues when trying to install.  All I get is a blank window  when I try to start it.  I can start Emacs with -Q, but --debug-init doesn't help at all.  I've tried using melpa-stable instead, but I rely on too many packages from melpa to make that jump.  I've also tried deleting all elpa packages and letting them reinstall, but it gets stuck at installing ESS.  I can't interact with the window at all, and it's stayed blank like that for at least 30 minutes.

Windows 10
Emacs 25.0.50 (Emacs w64)


texts:
I'm using Emacs on MS Windows and suddenly I noticed that when I press C-s (incremental search) the prompt shows I-search [NL]: which I presume is my locale. I still can search incrementally but I can't execute recorded macros anymore. The macro shows like:

C-s         ;; isearch-forward
SPC         ;; self-insert-command
<with-input-method>

And it fails, what's wrong? In the past I have seen some Windows settings with keyboards and so on, but I don't believe that's the case.

I'm on a company laptop where settings can be changed at (upper mgt)'s will.


texts: The tab-to-tab-stop command moves the point to the next tabstop; I can't find an equivalent to move to the previous tabstop and tab-to-tab-stop doesn't accept a universal argument to reverse direction.


texts: How do I demote/promote selected subtrees?

texts:
(current as of org 8.2.10)

I have a thing (shameless plug) that outputs a simple snippet of org-headings in a single file that look like this:

* little boys
  - snakes
  - snails
  - puppy dog tails
* little girls
  - sugar
  - spice
  - everything nice
** addendum
  - etc.

These are meant to go into another file through org-insert functions, specifically, a subheading of that other file.

In order to do that I have to demote all of the headings so that they slide nicely into place. How can I do that?

I tried:

C-x r t to prepend asterisks; this adds asterisks to every line
C-x h M-S-<right> to try demoting the whole selection; this only demoted the first line

Further issue: org-metaright does not demote subtrees

Commenters were correct that C-x h M-<right> (org-metaright) promotes or demotes visible selections. However, this ignores their subtrees, resulting in reordering of their substructure. The same behavior occurs with org-do-demote called on a selection.


texts:
Is there a built-in function/feature to export org headlines (not just properties drawers) and associated content into a HTML table?  Can this be done with a custom css and if so, what might the template look like?
Thanks in advance for your pointers.


texts: Determine the face(s) that would be applied to a character inserted at point, after font-lock does its thing?

texts:
Suppose I am trying to write a major mode.  In this mode, certain ordinary characters should have special "electric" behavior when typed, but only in some contexts (e.g. in code but not in strings or comments).  The definition of "some contexts" is very complicated, but it's neatly summarized by the syntax highlighting: if the character x, inserted at point, would be given a particular face by font-lock, then the characters shouldn't have electric behavior, otherwise they should.

So I'm imagining that I could somehow write

(defun mymode-maybe-electric-squiggle ()
  (interactive)
  (if (or (not mymode-electricity)      ; user option
          (memq (faces-of-hypothetically-inserted-character ?x)
             'mymode-literal-face))
      (call-interactively 'self-insert-command)
      ;; else do the electric thing
))

But I can't figure out how to write faces-of-hypothetically-inserted-character.  The x shouldn't go on the undo list, and the buffer shouldn't visibly have an x in it for a moment while I give font-lock a chance to run, and how would I give font-lock a chance to run in the middle of a command, anyway?

(For purposes of this question, please assume that there isn't any other feasible way to make the decision.)


texts: org-mode: sections/headers: export esp HTML: number body text with terminal '.' (like TOC default)

texts:
summary
How to make the numbering in the body text of each section title (aka header) render with regard to .s like the text of each header's entry in the default-generated table of contents?
Apologies if this is answered elsewhere (this is hopefully not a LMGTFU), but I'm not seeing anything online, particularly in the org-mode docs.
example
1. I create the following 4 line junk.org file
* foo
** bar
** baz
* quux

in a buffer, and save it.
2. I do [C-c, C-e, h, o] to [export the org to a junk.html file, render that in my webbrowser].
what I get by default
Browser output resembles following (which is much simpler than citing the mass of HTML emitted for even this 4-line example):
Table of Contents

    1. foo
        1.1. bar
        1.2. baz
    2. quux

1 foo
1.1 bar
1.2 baz
2 quux

what I want
I want the same TOC output, but the headers in the body should instead render like
1. foo
1.1. bar
1.2. baz
2. quux

I.e., I want the numbering in the body text for each header to render with a terminal . just as the default TOC text for each header already does.
How to do this? I'd prefer a method that works {generally, for all export backends}; if that's not an option, I'm currently most interested in something that works for HTML export, but am also interested in {PDF, LaTeX}.


texts: Can you describe a face color in terms of an inherited face color?

texts:
Specifically, I want tags in org mode to be a variant of the color of the corresponding heading (e.g. less saturated or lighter).

Each org mode heading level is a different color, so I can't just directly change the color for the org tag face.

I can clearly inherit a variant of the size, but there doesn't seem to be any way to inherit a variant of the color. Is it possible?


texts: How to change comments characters in assembly mode

texts:
I am editing .s files whit an assembly-to-binary translator that does not accept ; as a comment delimiter but accept C like comments (namely // and /* ... */).

I tried to modify comment-start variable locally using set-variable command but it does not matches any comment-start. When I display the variable within a .s (emacs correctly indicate Assembler mode) it says ; locally and nil globaly (wtf ??).

For the asm-comment-char variable, it says value is 59 which corresponds to the ascii code for ; but when I tried to set it, for example to //, it says it does not match type character of the variable. So I tried to set it to 047047 which is supposed to be the ascii code for // but my comment's keys still give ; or ;;.

So what can i do ? Which one of these variables control the comments characters in assembly mode ?


texts: How to disable line wrapping in LaTeX layer?

texts:
The LaTeX Layer by default wraps a line after column 85 by inserting a new line while typing and moving the current word to the new line. When the line is a comment, it even automatically inserts the comment prefix.

How can one disable this behaviour?

The emacs variables word-wrap and truncate-lines seem to have nothing to do with this, they only change how text is displayed while the above behaviour actually inserts new lines.


texts: Org-table color entries that match a predicate

texts:
Say we have the following table:

| Student | Grade |
|---------+-------|
| Foo     |     7 |
| Bar     |   5.5 |
| Baz     |     9 |

Is there a way to change the face color of an entry when a condition is matched, e.g., change the color of Grade < 6, or change the color of names starting with B?


texts: How can I expand everything recursively under the current heading / element in org-mode?

texts: Hoping the question is not too brief, I'm assuming this is a fairly common operation - but I can't seem to find anything in the docs about this.