texts: Is there any command like `other-frame` which behaves like windows's Alt-TAB?

texts:
Is there any command like other-frame which behaves like windows's Alt-TAB? And how to create this command?

To clarify this behavior, I wrote python code which virtually emulate this behavior. Each elements of frame_lst are frames. The first element of the frame_lst is the currently selected frame. With Alt being pressed, pressing TAB N times move the index which shows which frame will be selected, and after releasing TAB and Alt the frame of index'th element of frame_lst is selected and focused, then change the order of the elements of frame_lst to make recently selected frame become first element of the frame_lst.

Emulation Program (virtual_alt_tab.py)

def init_environment():
    global frame_lst, index
    index = 0
    frame_lst = ['f1', 'f2', 'f3', 'f4']

def on_alt_tab_pressed():
    global frame_lst, index
    index += 1
    index = index%len(frame_lst)

def on_alt_tab_released():
        global frame_lst, index
        frame_lst.insert(0, frame_lst.pop(index))
        index = 0

def hit_alt_tab_n_times(n):
    global frame_lst
    print('==== Before hitting Alt-TAB ====')
    print(frame_lst)
    for _ in range(n):
        on_alt_tab_pressed()
    on_alt_tab_released()
    print('==== After hitting alt-TAB consecutively %d times ===='%n)
    print(frame_lst)

# test 1
print('\n================ test 1 ================')
init_environment()
hit_alt_tab_n_times(1)

# test 2
print('\n================ test 2 ================')
init_environment()
hit_alt_tab_n_times(2)

# test 3
print('\n================ test 3 ================')
init_environment()
hit_alt_tab_n_times(3)

Output

================ test 1 ================
==== Before hitting Alt-TAB ====
['f1', 'f2', 'f3', 'f4']
==== After hitting alt-TAB consecutively 1 times ====
['f2', 'f1', 'f3', 'f4']

================ test 2 ================
==== Before hitting Alt-TAB ====
['f1', 'f2', 'f3', 'f4']
==== After hitting alt-TAB consecutively 2 times ====
['f3', 'f1', 'f2', 'f4']

================ test 3 ================
==== Before hitting Alt-TAB ====
['f1', 'f2', 'f3', 'f4']
==== After hitting alt-TAB consecutively 3 times ====
['f4', 'f1', 'f2', 'f3']

I found related article.

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

According to this article Emacs can't detect the release event of the Alt key. So I need another mechanics which complement this. I think pressing C-g will complement this, but I don't know how to detect C-g after Alt-TAB pressed repeatedly.


texts: Insert ChangeLog entries in commit message?

texts: Is there a way to insert relevant entries from the ChangeLog into the Magit commit message? I'm thinking of how the built-in Emacs VC's C-c C-a (log-edit-insert-changelog) command works.


texts: Synchronize org mode between different machines

texts:
I am writing an org file that org babel will tangle into "custom.el"  as shown here and here.

My problem is that on one machine the path to my agenda files is C:/Users/Username/Dropbox/file.org  while on anther machine it is C:/Users/DifferentUserName/Dropbox/file.org.

I can setq the org-directory to the the correct path on different machines with:

(setq org-directory
  (car  ;; with car returned value is type 'string' witout car returned type is 'cons'
      (delq nil
         (mapcar (lambda(x) (and (file-directory-p x) x))
                       '("c:/Users/marka/Dropbox/Apps/OrgMode"
                         "c:/Users/Mark/Dropbox/Apps/OrgMode"
                         "c:/Users/msmith/Dropbox/Apps/OrgMode")))))

With a single agenda file, using concat (concat org-directory "/gtd_work.org") returns the desired path to the agenda file "c:/Users/Mark/Dropbox/Apps/OrgMode/gtd_work.org".

Unfortunately multiple uses of  the concat function when nested in the setq  appears to stop functioning:

>  (setq org-agenda-files
>             '((concat org-directory "/gtd_work.org")
>               (concat org-directory "/gtd_proging.org")
>               (concat org-directory "/gtd_home.org")
>               (concat org-directory "/DailyRoutine.org")))

Using C-h v to find the value of org-agenda-files yields:

org-agenda-files is a variable defined in `org.el'.
Its value is ((concat org-directory "/gtd_work.org")
 (concat org-directory "/gtd_proging.org")
 (concat org-directory "/gtd_home.org")
 (concat org-directory "/DailyRoutine.org"))

Additionally I have tried:

Removing the single quote in the setq, this raises an Invalid function: (concat org-directory "/gtd_work.org") exception.
mapcar and mapc raise Wrong type argument: stringp, (concat org-directory "/gtd_work.org") exceptions.
Using ~/file.org without concat returns nil

I am doing this in scratch right now as config.org is w.i.p.  Will org concat the path to the agenda files? Am I not using concat correctly?  If I write out the full path for each file on each computer and use (mapcar (lambda (x) (and (file-exists-p x) x)) it will correctly select the machine specific path, however, this results in the first world problem of having to specify 20~40 paths rather than 8~12.

Solution by amitp below works for both the setq and for the:

(setq org-agenda-files
      (delq nil
            (mapcar (lambda (x) (and (file-exists-p x) x))

Thanks everyone for the help.


texts:
I was wondering if org-mode offers a function to sort a list by the item states? So that checked items appear on top and unchecked items at the bottom? For example with this list

- [ ] Not yet done
- [x] Already done
- [ ] Not yet done
- [x] Already done
- [ ] Not yet done
- [x] Already done
- [ ] Not yet done
- [x] Already done

I would get this list:

- [x] Already done
- [x] Already done
- [x] Already done
- [x] Already done
- [ ] Not yet done
- [ ] Not yet done
- [ ] Not yet done
- [ ] Not yet done


texts: How to prevent Gnus from querying the server during startup?

texts:
Gnus documentation says

  A slightly different approach to foreign groups is to set the gnus-secondary-select-methods variable. The select methods listed in this variable are in many ways just as native as the gnus-select-method server. They will also be queried for active files during startup (if that's required), and new newsgroups that appear on these servers will be subscribed (or not) just as native groups are.

So, if I have

(add-to-list 'gnus-secondary-select-methods
             '(nnimap "imap.first.com"))
(add-to-list 'gnus-secondary-select-methods
             '(nnimap "imap.second.com"))

in my gnus-init-file then Gnus will query imap.first.com and imap.second.com. Querying the servers could take a while for many reasons. How can I prevent Gnus from querying the servers at startup?


texts: How can I add Unicode 8 support to Emacs 24.3?

texts:
insert-char provides a very convenient way to enter Unicode code points using their names and even search for code point names.  Unfortunately, GNU Emacs 24.3 and Unicode 8 were released at roughly the same time, so the new code points are not available from the list provided by insert-char.  How can I add them?

UPDATE

I implemented Aaron's solution (albeit in a lazy manner) and it works.  I used the emoji list from http://emojipedia.org/unicode-7.0/ and http://emojipedia.org/unicode-8.0/ (Emacs 24.3 lacks the Unicode 7 code points too, by the way)

(ucs-names)
(nconc ucs-names
       '(("SLIGHTLY SMILING FACE" . ?)
         ("SLIGHTLY FROWNING FACE" . ?)
         ("SLEUTH OR SPY" . ?)
         ("SPEAKING HEAD IN SILHOUETTE" . ?)
         ("MAN IN BUSINESS SUIT LEVITATING" . ?)
         ("REVERSED HAND WITH MIDDLE FINGER EXTENDED" . ?)
         ("RAISED HAND WITH PART BETWEEN MIDDLE AND RING FINGERS" . ?)
         ("RAISED HAND WITH FINGERS SPLAYED" . ?)
         ("EYE" . ?)
         ("HOLE" . ?)
         ;; and so on
           ))


texts:
I thought it would be handy to be able to change the font height of a buffer on the fly by invoking a key press and giving the font height you would want, e.g.
C-t 130 would set the local buffer font size to 130. I've been able to write a function that can change the font size to a preset value like thus:

(defun set-font-low ()
 "Lowers the font of this buffer to 70.  call `set-font-high` for reverse."
 (interactive)
 (setq buffer-face-mode-face '( :height 70))
 (buffer-face-mode))

A modified version would include the possibility of setting this font height interactively:

(defun set-font-height (size)
  "set font height for local buffer"
  (interactive "sheight:")
    (message size)
    (setq buffer-face-mode-face '( :height (size)))
    (buffer-face-mode))

However, this code doesn't work. The message shows the correct size, and the font size isn't changed. substituting size with 70 will still produce no change. What's more, regardless of the specific argument used, after this function is executed moving the cursor up or down in that buffer becomes impossible, e.g. C-p results in a wrong type argument: stringp, nil error.

I'd guess my problem is that I'm trying to set the attribute to a variable rather than to a number. in jmibanez's answer to this question he seems to be able to do just that, but I can't figure out what the correct syntax is in this problem.

I'm running GNU Emacs 26.0.90 (build 1, x86_64-w64-mingw32) on windows 10.


texts: how can i do for replace a part of a regexp

texts:
For example i have this text:

select * from T1 ;

select * from T2 ;

select * from T3 ;

My objetive is replace the text by this other:

select * from T1_H ;

select * from T2_H ;

select * from T3_H ;

when i looking for the regexp, i put the next:
"from .* ; , but i whant replace only the part ".*" with the same text that has before plus "_H". How could i do this?


texts:
I work with a Makefile-like infrastructure that allows having lists as variables and appending values to them. For this, the += operator is used.

However, I'm having incorrect highlighting using this operator.

The + is being highlighted as part of the word. I tried doing (modify-syntax-entry ?+ "." my-syntax-table-based-on-makefile-mode-syntax-table) without getting the desired result (having the + in += highlighted the same as =).


texts: Complete a calculation ("2+3=...") inside a buffer

texts:
I have a calculation in my org-mode buffer:
7700*1/100 + 18000*2/100

I'm looking for the quicker way of completing it, and displaying it like this:
7700*1/100 + 18000*2/100 = 437

My current way of doing this is a little harassing.

do the computation with calc embedded mode: C-x * e
leave the calc embedded mode: q
Copy the result
Revert the change(C-x u), append "=" and paste the result.

What is a quicker way to accomplish the same thing?


texts: Temporary input-decode-map while inputting key sequence

texts:
I want all sequences like C-c C-p to be translated to C-c p and even C-x C-k C-e should become C-x k e.
This is easily done with e.g.
(define-key input-decode-map (kbd "C-p") (kbd "p"))

but how do I do it only while a sequence is being read, so that I can still use C-p as usual when just navigating the buffer? In other words, the first chord should be allowed, but succeeding chords in a sequence should be translated.
I tried to advise read-key-sequence, which didn't seem to do anything.
(advice-add #'read-key-sequence :before #'my-kill-ctl)
(advice-add #'read-key-sequence :after #'my-restore-ctl)

(defun my-kill-ctl (&rest _)
  (define-key input-decode-map (kbd "C-p") (kbd "p"))
  _)

(defun my-restore-ctl (&rest _)
  (define-key input-decode-map (kbd "C-p") nil)
  _)


texts: Getting autocompletion for qt4 with CEDET

texts:
I use emacs 24.4 with auto-complete1.5.0 and bundled version of CEDET2.0 (I've also tried with latest CEDET by downloading and loading cedet-devel-load.el).

I have qt4 sources installed and semantic in my ac-sources.
I want it to parse and auto-complete my sources.

Following Alex's Ott tuto I put this in my init.el :

(require 'semantic/sb)
(require 'semantic/ia)
(require 'semantic/bovine/gcc)
(require 'semantic/bovine/c)

(add-to-list 'semantic-default-submodes 'global-semanticdb-minor-mode)
(add-to-list 'semantic-default-submodes 'global-semantic-highlight-func-mode)
(add-to-list 'semantic-default-submodes 'global-semantic-idle-local-symbol-highlight-mode)
(add-to-list 'semantic-default-submodes 'global-semantic-idle-scheduler-mode)
(add-to-list 'semantic-default-submodes 'global-semantic-decoration-mode)
(add-to-list 'semantic-default-submodes 'global-semantic-idle-completions-mode)
(add-to-list 'semantic-default-submodes 'global-semantic-idle-summary-mode)

(add-to-list 'auto-mode-alist '("/usr/include/qt4" . c++-mode))
(semantic-add-system-include "/usr/include/qt4" 'c++-mode)
(semantic-add-system-include "/usr/include/qt4/QtGui" 'c++-mode)
(semantic-add-system-include "/usr/include/qt4/Qt" 'c++-mode)

;(add-to-list 'semantic-lex-c-preprocessor-symbol-file "/usr/include/qt4/Qt/qconfig.h")
;(add-to-list 'semantic-lex-c-preprocessor-symbol-file "/usr/include/qt4/Qt/qconfig-dist.h")

(semantic-mode 1)

But there's nothing to do, I don't get any completions !

-- Edit --

After some search I think the problem is that semantic doesn't parse qt sources as it should;

for example, I have :

#include <QSystemTrayIcon>

But when I try to complete "QSyst"... I have only one possible completion : QSystemTrayIconPrivate
So I opened /usr/include/qt4/QtGui/qsystemtrayicon.h to see what's in this file and there is the definition of QSystemTrayIcon class:

class Q_GUI_EXPORT QSystemTrayIcon : public QObject

and the definition of QSystemTrayIconPrivate :

class QSystemTrayIconPrivate;

I don't know what this Q_GUI_EXPORT means, I have never seen such construction of class; with root powers, I modified the header to :

class QSystemTrayIcon : public QObject

then forced semantic to reparse and the completion works for this class now !

I deduce Semantic doesn't understand how qt creates classes,
it's the same for other such as QApplication, and so on...

I don't want to manually edit all qt sources.
So, is there a way to hack Semantic source code so it can understand this kind of class construction ?


texts: How to make exceptions to bind-key* overriding behavior?

texts:
I like binding M-n to make-frame, so I have the following in my init file:

(bind-key* "M-n" 'make-frame)

The * form of bind-key allows me to override other minor-mode M-n bindings. But when I'm using the minibuffer (e.g. find-file), I'd rather M-n retained it's original behavior and ran next-history-element.

I'm currently using a workaround, but I'm hoping there's a better solution.

(defun ivan-unbind-make-frame () (bind-key* "M-n" nil))
(defun ivan-rebind-make-frame () (bind-key* "M-n" 'make-frame))

(add-to-list 'minibuffer-setup-hook #'ivan-unbind-make-frame)
(add-to-list 'minibuffer-exit-hook  #'ivan-rebind-make-frame)

Another approach I considered was to create a keymap of the minibuffer bindings I want to take precedence over bind-key* bindings and put it in an entry at the front of emulation-mode-map-alists.

(defvar overriding-minibuffer-map
  (let ((map (make-sparse-keymap)))
    (define-key map (kbd "M-n") #'next-history-element)
    map))

(defvar minibuffer-active-p nil)

(add-to-list 'emulation-mode-map-alists
             `((minibuffer-active-p . ,overriding-minibuffer-map)))

(defun minibuffer-active-on  () (setq minibuffer-active-p t))
(defun minibuffer-active-off () (setq minibuffer-active-p nil))

(add-to-list 'minibuffer-setup-hook #'minibuffer-active-on)
(add-to-list 'minibuffer-exit-hook  #'minibuffer-active-off)

This is more complicated and still doesn't free me from using minibuffer setup/exit hooks (unless there's an existing variable that reflects whether the minibuffer is active, but I couldn't find one). It also makes the assumption that M-n runs next-history-element in all minibuffer use-cases, and I'm not sure that's true.

Is there a better way to handle this, or should I stick with my current solution?


texts:
I use this function for tangling my init.el file

(defun tangle-init ()
    "If the current buffer is 'init.org' the code-blocks are tangled, and the tangled file is compiled."
    (when (equal (buffer-file-name) (expand-file-name (concat user-emacs-directory "init.org")))
      (let ((prog-mode-hook nil)) ;; Avoid running hooks when tangling.
        (org-babel-tangle-file buffer-file-name (concat user-emacs-directory "init.el") "emacs-lisp")
        (byte-compile-file (concat user-emacs-directory "init.el")))))
(add-hook 'after-save-hook 'tangle-init)

That code works well but it take a lot of time. So I would like to execute this function with async librairie (https://github.com/jwiegley/emacs-async)

I tried something like this but doesn't work:

(require 'async)
  (defun tangle-init-async ()
    "If the current buffer is 'init.org' the code-blocks are tangled, and the tangled file is compiled."
    (when (equal (buffer-file-name) (expand-file-name (concat user-emacs-directory "init.org")))
      (async-start
       (lambda ()
         (let ((prog-mode-hook nil)) ;; Avoid running hooks when tangling.
           (org-babel-tangle-file buffer-file-name (concat user-emacs-directory "init.el") "emacs-lisp")
           (byte-compile-file (concat user-emacs-directory "init.el")))))))
  (add-hook 'after-save-hook 'tangle-init-async)

Any help appreciated.


texts: Suppress a warning in lsp-mode using clangd

texts:
Here's an example of code for which I get a warning when using lsp-mode, with clangd:

struct A {
  union {
    struct B {
       int i;
    } b;
  };
};

The warning appears with a flycheck mark on the left, telling me that types cannot be declared in an anonymous union. I would like to suppress this error, but I can't seem to figure out how. How can I suppress a clangd warning from within lsp-mode?


texts: Launch emacs in eww mode, display local .html file at startup

texts:
I'm new to Emacs and I'm going about customizing my install on Mac OS Catalina.

I have a twist on a common request.

I had the idea to customize the emacs startup screen, but I see those options are limited based on what I've read so far. You can switch out the logo, maybe change the bg color, customize the text string associated with that screen, but you can't really dig into it per say because it's all in the source code.

So I got the idea of displaying a local html file (or one on a LAN) instead. I got that to display on launch, but it's showing in HTML code mode/buffer. I found this line for my .emacs file elsewhere: (setq initial-buffer-choice "~/.emacs.d/startup.html")

My question is... Is there a way to launch Emacs in eww browser mode and display a local startup.html file? (Which is like hitting a nail with a sledgehammer I know but, I was curious.)

Related to this, can you specify a handler for links to files within a page displayed by eww? (e.g. .mp4,.mp3, html, pdf,.csv, etc.)


texts: How to configure EasyPG with Gpg4win or any other Windows GPG version?

texts:
I am having a hard time getting GPG to work in Emacs under Windows.

The configuration options I tried:

  (setq epg-gpg-program "c:/Program Files/GNU/GnuPG/gpg2.exe")

  (setq epg-gpg-home-directory "C:/Documents and Settings/user/My Documents/.gnupg")

Upon opening a .gpg file with Emacs 25 for Windows I get the error

epg-context--make: GPG error: "no usable configuration", OpenPGP

With Emacs 24.3 the error is
epa-file--find-file-not-found-function: Opening input file: Decryption failed,

What am I missing?

Do I need some special version of GnuPG?

Additional configuration options?


texts:
Linux Mint 20, Emacs 27.2
I compare two files by ediff
Here result:

As you can see the ediff show different on the specific line.
But... I need to see different in the specific chars (A and Z).
I need to change background only on the different chars (A and Z). Not whole word.
Is  it possible?


texts:
In a big C++ project I use dabberv-expand (aka M-/). Rtags, ctags, csope etc do not work by different reasons. Unfortunately I do not know how to enforce dabbrev to use a fuzzy search. So I decided to use ivy. The following code does almost everything I want:

(defun ivy-complete ()
  (interactive)
  (dabbrev--reset-global-variables)
  (let* ((abbrev (dabbrev--abbrev-at-point))
         (candidates (dabbrev--find-all-expansions abbrev t)))
    (when (not (null candidates))
      (let* ((found-match (ivy-read "matches " candidates
                                :preselect (thing-at-point 'word)
                                :sort t))
            (abbrev-length (length abbrev)))
        (insert (substring found-match abbrev-length))))))

One thing is missed. The completion shows the candidates in the minibuffer. I want them to be displayed in a popup window near the entry point. I tried to use     ivy-display-function-popup and ivy-display-function-overlay but failed.

Questions:
how to show the candidates in a popup or overlay window? May be it is possible to use ivy as a backend for some other packet like company?


texts: How to deal with 'add-hook' in .emacs when it's reloaded more than once?

texts:
I have some add-hook functions in my .emacs similar to below,

Send a notification when a pomodoro is completed:

(add-hook 'org-pomodoro-finished-hook
  (lambda ()
      (message "Pomodoro finished")
))

Now I sometimes change something in these lambda functions that ran from the hook and often reload the whole .emacs (as oppose to a certain region etc..).

As a result, when pomodoro finishes, I get two notifications. It looks like add-hook adds two functions to the list.

From a high level p.o.v, what's the best way of dealing with this?

[EDIT/SOLUTION]

As pointed out in the answer, the add-hook only adds the function once if the function is identical to the previous definition. The thing is that changing the function no longer makes it identical and thus you get duplication in the hook list.

I.e, Re-evaluating this does not produce multiple 'MEH' messages:

(add-hook 'org-pomodoro-finished-hook
  (lambda ()
      (message "MEH")
))

However, if I change "MEH" to something else (like "BLEH"), then I'll be seeing two messages (MEH and BLEH).

The solution is to point add-hook to functions and change the functions instead of changing the hooks.

In the example below, "Meh" can be changed to "Bleh", the .emacs can be re-loaded and only "Bleh" will be displayed.

(defun my/message ()
  (message "Meh")
)

(add-hook 'org-pomodoro-finished-hook 'my/message)


texts:
What works

I have installed emacs-eclim and have it working in my Java buffers. For example, I can invoke eclim-java-refactor-rename-symbol-at-point or eclim-java-show-documentation-for-current-element and they behave as expected.

I can run eclim-complete, and I receive a list of correct completions in another buffer.

I evaluate something like company-emacs-eclim--candidates "Object.") in a java buffer, and I get a list of completion candidates.

Without any eclim backends, company also works as expected.

What doesn't work

Hoping to get eclim completion candidates in my Java buffers, I added the following lines to my .emacs:

(require 'company-emacs-eclim)
(company-emacs-eclim-setup)

However, I do not get eclim completions as expected. If I invoke company-emacs-eclim explicitly, I get the error "Cannot complete at point", with the following backtrace:

Debugger entered--Lisp error: (error "Cannot complete at point")
  signal(error ("Cannot complete at point"))
  error("Cannot complete at point")
  company-begin-backend(company-emacs-eclim)
  company-emacs-eclim(interactive)
  ad-Orig-call-interactively(company-emacs-eclim record nil)
  call-interactively(company-emacs-eclim record nil)
  command-execute(company-emacs-eclim record)
  execute-extended-command(nil "company-emacs-eclim")
  smex-read-and-run(("toggle-debug-on-error" "company-emacs-eclim" ...))
  smex()
  ad-Orig-call-interactively(smex nil nil)
  call-interactively(smex nil nil)

Version information

GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, GTK+ Version 3.10.7)
 of 2014-03-07 on lamiak, modified by Debian

emacs-eclim 20150502.516


texts: mu4e: how to stop the unarchiving of entire threads when new message arrives?

texts:
The issue:

Say a new message arrives in my inbox that is a reply to an existing thread/chain of emails that I've archived. mu4e will move the entire thread out of the archive and back into my inbox.

The question:

Is there a way to stop mu4e from moving the whole thread out of archive and back into my inbox? For context, in Gmail this can be accomplished by turning "conversation grouping" off.

I am a mu4e newb, but digging it so far. Any help with the issue I'm encountering would be much appreciated.


texts: Unsure what to make of the following Emacs prompt to change my init file

texts:
Every time I open emacs, I get the following error; emacs is working fine, but not giving me the initial help screen:

An error has occurred while loading `/Users/thorkamphefner/.emacs.d/init.el':

File error: Cannot open load file, package

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

When I enter debug mode, I get the following prompt, which I'm not sure how to read. Line 44 in my init file looks like it has nothing to do with the error described.

Debugger entered--Lisp error: (file-error "Cannot open load file" "package")
  require(package)
  eval-buffer(#<buffer  *load*> nil "/Users/thorkamphefner/.emacs.d/init.el" nil t)  ; Reading at buffer position 44
  load-with-code-conversion("/Users/thorkamphefner/.emacs.d/init.el" "/Users/thorkamphefner/.emacs.d/init.el" t t)
  load("/Users/thorkamphefner/.emacs.d/init" t t)
  #[nil "^H\205\276^@   \306=\203^Q^@\307^H\310Q\202A^@ \311=\2033^@\312\307\313\314#\203#^@\315\202A^@\312\307\313\3$
  command-line()
  normal-top-level()


texts: How can I programmatically get the canonical unicode name of a character?

texts:
I'm attempting to get the name of the character (or multibyte character) at point, and just the name, programmatically.

describe-char tells me what the character's name is, along with a bunch of other stuff that I don't want.

get-char-property appears to be what I want, except that I tell what property I want. Neither 'name, 'Name, "Name", or "name" seem to do anything (when used as e.g. (get-char-property ?& 'name).


texts: How to make the background color of `x-show-tip` defined in `pos-tip.el` transparent?

texts:
I found the flycheck-pos-tip package uses a function defined in pos-tip-show which uses a built-in function: x-show-tip.

I want to change the background color of x-show-tip to be transparent.

There is a custom variable named pos-tip-background-color in the pos-tip package, how can I change this value to transparent? For example, the value of pos-tip-background-color is #FF0000, how can I change its alpha value to 50, so that I get a color of RGBA(255,0,0,0.5) if I use a CSS style value.


texts: Automatic "push-mark" when navigating with xref, find-grep, etc?

texts:
There seem to be a lot of situations, where a command changes the cursor location (point), but no mark is pushed, making navigating back by popping the mark with C-u SPC impossible.

For isolated use-cases, I can fix this with e.g. advice-add on the affected command, or other ad-hoc fixes (see e.g. Set mark when jumping from emacsclient). I have however found, that it affects just too many situations to manually track down where to put the advice, and maintain that advice as the functions change -- quite often the suitable function is a package-private function like xref--show-pos-in-buf.

Examples, where this makes issues, include:

M-x xref-... commands[1]
M-x occur
M-x grep
Latex forward/inverse search
...

Is there some better, cleaner way to achieve more comprehensive "mark-pushing"?

Workflow and Workarounds

Given a setup

+--EmacsFrame----------------------+
|              |                   |
| FileBuffer   |  NavigationBuffer |
| FileWindow   |  NavigationWindow |
|              |                   |
|              |                   |
+----------------------------------+

Where NavigationBuffer is associated e.g. with the xref, diff, find-grep, or occur feature, I may either:

Switch to NavigationWindow with a keyboard command, and activate a command, that causes the point in FileBuffer to change, or
Click somewhere in NavigationWindow to the same effect.

Case (2) can be covered the same way for left-click and right-click events. Many modes however default to reacting only to middle-button clicks; In this case, selected-window and current-buffer remain the same before and after the command.

While I can probably find a workaround for the middle-click case, the solution seems like a messy workaround at this point; A cleaner solution would be preferable.

Footnotes

[1] RichieHH's Answer: In this case, there is M-, aka xref-pop-marker-stack, but setting the mark would still be nice for consistency.


texts:
When using emacs, C-S-Backspace seems to only delete one char and not the whole line.

After reading Here I see the text:

  "C-S-backspace (kill-whole-line) kills a whole line including its
  newline, regardless of the position of point within the line. Note
  that many text terminals will prevent you from typing the key sequence
  C-S-backspace."

This might explain my problem, but does not give me a solution.

Checking topics like this gives some explanation to possible Ubuntu based issues, but they seem to be GUI based. I'm using the Awesome window manager with the default configs. I don't see anything bound to those keys.

I'm using Ubuntu with Awesome WM. My terminal is XTerm. I'm using emacs 24.3.1.


texts: How to get org-mode to resume list numbering from where it left off

texts:
Related: https://stackoverflow.com/a/21475047/52310

I want to write something like:

1. foo
2. bar

intervening text

3. baz
4. quux

The two easy almost-solutions are:

Make "intervening text" part of the first list:

1. foo
2. bar

    intervening text

3. baz
4. quux

Explicitly set the second list's number:

1. foo
2. bar

intervening text

3. [@3] baz
4. quux

I'm exporting to LaTeX, but I'd prefer to avoid using anything LaTeX-specific.

I tried this, but it didn't work:

    1. foo
    2. bar <<list-end>>

    intervening text

    3. [@[[list-end]]] baz
    4. quux


texts: How do I limit the width of a table or columns in org-mode PDF export?

texts:
I'd like to format a table with a wide column nicely in PDF export from org-mode. Ideally it would be with a wrap on that column, but I can deal with a manual character or fraction of \textwidth for that column. I've tried a number of things, but I can't get it to change width. What do I need to do?

Sample:

#+ATTR_LATEX: :width .6\textwidth
| Column                    | Wide Column                                        | Column   |
|---------------------------+----------------------------------------------------+----------|
|                           | <30>                                               |          |
| Some stuff                | Lots and lots of stuff. Way too much. Like, a lot. |          |


texts: I'm wondering if there's any way, even if via advice or re-definition, to customize the evil ex prompt. Sometimes I invoke it instead of M-: to evaluate an expression, so I was thinking of showing a propertized string there to make it really stand out.


texts: how to generate dynamic json data with emacs (macros)?

texts:
I was in a meeting yesterday where I was presenting a program that referenced a certain json file with data like this:

[
{
  id: 1,
  text: '...',
  ...
},
{
  id: 2,
  text: '...',
  ...
}
]

In total there were around 6 of these objects in the array.  I was asked how the program would handle a set of 100 objects.  I tried simply copying the objects several times, then realized that this would be useless for my program unless the id incremented for each object.  Of course, I could write something in you-name-it programming language to create such a json file, but I suspected there must be some way of using an emacs macro to quickly generate such a list of objects on the fly.  Is this so?  What's the most emacs-y way of doing this?


texts: emacs-24: solid-colored mode-line with my color choice?

texts:
Is it possible in emacs-24 to set up a solid-colored mode-line with my color choice? ... for example, the entire mode-line would have a red background, and all mode-line text fields would be in foreground white?

I used to be able to do this in emacs-23 via color-theme.el, but now, all the "modeline*" settings that color-theme uses only seem to affect the buffer-name portion of the mode-line, and not that entire line.

Am I out of luck in emacs-24, or is there some way to color the entire mode line?

Thank you in advance.


texts: How to remove message `Indentation setup for shell type sh`

texts:
I open shell files at startup and often get this in *Messages*:

Setting up indent for shell type sh
Indentation variables are now local.
Indentation setup for shell type sh

All my files cause this warning, even if they have indentation, e.g.:

source /path/to/file.sh

var=0

foo() {
   exit 0
}

When Emacs open Python files, it guesses the indentation from the file and does not produce these messages.

How can I avoid these messages when opening files with shell scripts?


texts: Problem opening spacemacs on mac OS Sierra when clicking spacemacs icon.

texts:
trying to install spacemacs using the Alternate installation instructions, but when I load the app using the app icon on the Applications folder I get the following.

TL;DR: How to link env HOME=$HOME/spacemacs emacs command to the spacemacs icon.

But when I actually use the command env HOME=$HOME/spacemacs emacs I get it to open. Did I miss something?

PS: for someone coming from sublime what is the best editing style to choose: vim or emacs?

Thanks in advance.


texts: How to eliminate all advice from function?

texts:
Is there a way to remove all advice added to a function with advice-add?

advice-remove requires the original function to be passed in. Sometimes, when experimenting w/ advice, I'll add several lambdas as advice to an fn, and would like a way to clear them all out.


texts: indent cl-loop to respect `if else` statements

texts:
I have a hard time writing and reading cl-loops with they way they're indented by default as I can't easily tell what the control flow is:

(cl-loop for x below 10
         if (cl-oddp x)
         collect x into odds
         and if (memq x funny-numbers) return (cdr it) end
         else
         collect x into evens
         finally return (vector odds evens))

I'd like it to be indented like how it's shown in its documentation:

(cl-loop for x below 10
         if (cl-oddp x)
           collect x into odds
           and if (memq x funny-numbers) return (cdr it) end
         else
           collect x into evens
         finally return (vector odds evens))

I know this has to do with Indenting Macros manual page. And possibly this question on indenting a common lisp loop in emacs. Additionally, I've looked at a post on irreal and this question on the indentation of lisp forms.

The general idea I got from reading is to use (declare (indent n)) where n is an integer. I see this works for simple examples. However, how I want the cl-loop to be indented seems too complex for this. I need to tell emacs to recognize the specific if else keywords in the cl-loop.

I am confused as I don't see a clear way to properly indent cl-loop. Any ideas?


texts: Whats the recommended way to install yasnippet for an emacs prelude user?

texts:
Is doing mkdir ~/.emacs.d/personal/snippets/

the correct way and putting snippets there?

I've been reading https://github.com/bbatsov/prelude/issues/98

What I did:

;; personal.el
(prelude-require-packages '(
  yasnippet
))

;; yasnippet
(add-to-list 'load-path
             "~/.emacs.d/personal/snippets")
(require 'yasnippet)
(yas-global-mode 1)

Added this snippet to the snippets folder:
    https://github.com/AndreaCrotti/yasnippet-snippets/blob/master/snippets/perl-mode/sub

Then restarted emacs

opened up up a ruby file ( emacs is an alias that does a -nw emacsclient)

emacs app/controllers/application_controller.rb

now on a new line I press sub and then tab, but nothing happens. What am I doing wrong.


texts: How to redisplay dired buffer after changing listing-switches

texts:
This sample code doesn't work:

(defun toggle-hidden-in-dired ()
  (interactive)
  (setq dired-listing-switches
        (if (equal dired-listing-switches "-l --group-directories-first")
            "-la --group-directories-first"
          "-l --group-directories-first"))
  (revert-buffer))


texts: Can emacs be configured to support more terminals?

texts:
I recently switched from rxvt-unicode to st. This means I went from $TERM=rxvt-unicode-256color to $TERM=st-256color.

I'm happy with the switch and want to continue to use st. However, I quickly noticed that emacs was not rendering my colors appropriately. After some googling, I found this question. Following mndrix's advice, I added

(add-to-list 'term-file-aliases
    '("st-256color" . "xterm-256color"))

to my .emacs. This solved the problem. However, my start time is now really slow.

Now I'm wondering if there is another solution. On my system, the directory /usr/share/emacs/26.2/lisp/term has some el.gz and elc files corresponding to different terminals. For instance, this directory has xterm.el.gz and xterm.elc in it. I'm guessing that the fundamental issue is that this directory does not have st.el.gz and st.elc. Is it possible to add this support? If so, how might one go about this configuration?


texts:
The following Emacs Lisp you can set the background color of face whitespace-trailing:

(set-face-attribute 'whitespace-trailing nil :background "#ff0000" :foreground nil))

How can a face attribute be read back?

Asking since I'd like to temporarily change a face background color:https://emacs.stackexchange.com/a/29166/2418


texts: How Shall I Understand org-mode Habits Graph Colors?

texts:
The org-mode documentation has following to say about the colors in the habits graph:

Blue: If the task was not to be done yet on that day.
Green: If the task could have been done on that day.
Yellow: If the task was going to be overdue the next day.
Red: If the task was overdue on that day.

I have the following graphs:

The habits repeat daily and are defined like this: <2020-07-09 Thu 12:00 .+1d>
In this example I fail to understand what the documentation means? It’s pretty clear that the evening habit was never done in the past (hence everything is red and there is no star). But how should I read the first and second column for “Morning” and “Afternoon”? Why are they blue? When I hover over the first column, I don’t get a tooltip. When I hover over the second blue column (which has a star) the tooltip shows 2020-06-18. But when I take a look at this day, I see that I completed this particular habit at 13:21, after it was meant to be done on that day.
To me this looks like a bug and I would expect everything to be green with stars for the first two habits, but I’m probably missing something?


texts: I want to make an alias in eshell so that when I type gcc it actually does gcc -Wall -pedantic -std=c99 but when I make the alias, it just displays gcc -Wall -pedantic -std=c99 and doesn't actually compile the program. Any ideas?


texts: Using advices to flatten a single subfolder

texts:
One of Github's features i like is that it "flattens" path if a folder contains only one subfolder, i.e you have a src folder which has only main folder, so by clicking on src you go to the content of main. I'm using ranger for navigation and want to achieve the same behaviour. I've decided to try advices for the first time, but can't get it working:

(defadvice ranger-find-file (before flatten-subfolder (entity ignore-history))
    (interactive "DInitialDirectory: ")
    (message "Calling ADVICE")
    (let ((folder (or entity (dired-get-filename nil t))))
      (when (and folder (file-directory-p folder))
        (let* ((subfolder (f-directories folder))
               (nr-of-subfolders (length subfolder)))
          (if (eq nr-of-subfolders 1)
              (flatten-subfolder (car subfolder))
            entity)))))

My understanding was that when i call ranger-find-file, which has the following signature:

(defun ranger-find-file (&optional entry ignore-history) ...)

would first invoke my advice (flatten-subfolder) which would flatten (go down the path) folders and invoke ranger-find-file with the result of the advice above. Obviously it doesn't work, is there any way to do this?


texts: How to plot summaries of timestamps of different projects clocking in and out?

texts:
I've searched extensively online but have not found an easy solution. Maybe there is already an easy solution or some tips on doing this easily?

I am clocking in the amount of time I spend on different projects. I can summarize the clocktable using org-clock-report. However, I would like to visualize this data using either barplots for different projects (easiest), or a breakdown of how much time I spend on different projects as a function of the calendar year (most complicated).

Has anyone already tried this? Is there an easy way to parse the timestamps into a file format that makes it easy to plot in standard software such as excel or R?

Example org file:

*** Analysis
    CLOCK: [2016-06-06 Mon 21:13]--[2016-06-06 Mon 22:29] =>  1:16
    CLOCK: [2016-06-06 Mon 14:20]--[2016-06-06 Mon 17:31] =>  3:11
    CLOCK: [2016-06-06 Mon 09:50]--[2016-06-06 Mon 12:15] =>  2:25

*** Meeting
    CLOCK: [2016-06-07 Tue 09:07]--[2016-06-07 Tue 11:46] =>  2:39
    CLOCK: [2016-06-06 Mon 13:43]--[2016-06-06 Mon 14:20] =>  0:37

The idea would be to wrangle these timestamps into a file format that would be easily amenable to plotting (excel or R).


texts: How to sort file list in helm-find-files by date

texts:
How to sort file list in helm-find-files asks how to sort the file list so that directories float to the top.  My question is different:

Is it possible to sort the files returned by helm-find-files so that they appear sorted by modification time, rather than alphabetical order (i.e., as if they had been listed by ls -lt rather than ls -la)?


texts: find out name of terminal device emacs was started from

texts:
When I am running Emacs from a terminal, how do I find out the tty device name from inside Emacs?

I first thought that it can be done with M-x shell-command RET tty RET, but this does not work: instead of, e.g., /dev/tty1, I get not a tty.


texts: Switch to text mode instead of fundamental mode for org examples

texts:
#+begin_example
#+end

C-c C-' on example starts a buffer in fundamental mode.  Could it be replaced with text mode?


texts: In shift selection, retain the mark if it's already active

texts:
Under shift-select-mode, cursor keys behave like many other text editing environments: Shift+motion starts selecting (sets and activates the mark, in Emacs terms), and motion without Shift stops selecting (deactivates the mark, in Emacs terms).

So far so good, but Emacs isn't your basic editor. It has so many sophisticated motions that it isn't practical to manage a Shift variant for all of them.

This doesn't mesh well with commands that mark a region. For example, I type

foo

and move the cursor to the beginning, then press C-M-SPC. This results in the mark at the end of the sexp, i.e. after foo, and the point before the f. I would expect that pressing S-right will retain the mark and move the point. But it doesn't: since the previous command wasn't a shift-selectable command (a command with ^ in its interactive specification), pressing S-right at that point sets the mark before the f.

How can I configure Emacs so that when the mark is already set and active, Shift+motion doesn't move the mark? I always have transient-mark-mode on, that's not a concern.


texts: How do I hook fundamental-mode and all modes derived from it for modifying syntax for underscores

texts:
Here is the definition of fundamental-mode:
(defun fundamental-mode ()
  "Major mode not specialized for anything in particular.
Other major modes are defined by comparison with this one."
  (interactive)
  (kill-all-local-variables)
  (run-mode-hooks))

There does not seem to be a fundamental-mode-hook defined.
I would like to call some code for all "fundamental-mode" buffers and all derived modes from it, without having to itemize all such modes and explicitly call add-hook on all of their mode functions.
Is there a way or am I stuck paying the itemization cost?  If yes, then how do I do this inside all modes:
(modify-syntax-entry ?_ "w")

because after decades of Emacs usage, I've finally grown tired of my cursor getting hung up on every single underscore for every time I use M-f (ALT+f), across all new modes that are invented and that I install into my setup.


texts: Modify regexp in function to match only capitalized words

texts:
I have the following function

(defun fphp/find-unimported-classes ()
  (interactive)
  (mapcar (lambda (classentry)
            (ov-clear (classentry-overlay classentry))
            )
          classentries)
  (setq classentries '())
  (save-excursion
    (goto-char (point-min))
    (while (re-search-forward "$[A-Z]+" nil t)
      (backward-word)
      (backward-word)
      (setq word (current-word))
      (setq wordpoint (point))
      (forward-word)
      (setq endwordpoint (point))
      (forward-word)
      (if (string= (capitalize word) word)
          (add-to-list 'classentries (make-classentry :word word))))
    (mapcar (lambda (classentry)
              (goto-char (point-max))
              (setq word (classentry-word classentry))
              (message word)
              (setq classregexp (concat "\\(" (substring word 0 1) "\\)"
                                        (substring word 1) "\s"))
              (if (buffer-contains-string (concat "use [A-Z+\\]+" word ";"))
                  (ov-set classregexp 'face 'class-defined-face '(classentry-overlay classentry) t)
                (ov-set classregexp 'face 'class-undefined-face '(classentry-overlay classentry) t)
                )
              )
            classentries)
    ))

It's purpose is to match all unimported classes in the php code and it works quite well, however it matches also variable names, like:

$className

I want to modify it to match only capitalized words. The regexp is built here:

(setq classregexp (concat "\\(" (substring word 0 1) "\\)"
(substring word 1) "\s"))

How can I achieve it? Now it matches all cases of the first character.


texts: How do I apply a patch from gnus to a git repo?

texts: I've got an email with a dozen .patch files attached in gnus. I can save them to e.g. ~/Downloads and then apply them with magit-patch-apply-popup, but considering that I've got gnus open on the left (and I can open the patch in its own buffer by putting my cursor over it and pressing c) and the magit summary buffer on the right, I would think that I could just apply the patch right there. But I cannot figure out how to do this.


texts: My left pinky hurts. Can I press another key to act as Control?

texts:
My left pinky hurts due to repetitively pressing the C button when using Emacs org mode. Not working with Emacs is out of the question, but it needs some rest.

I would like to change theC key for something else for a while. Could I use, say, the ',' button instead?


texts: How do I format dates without padding the values?

texts:
I was not very statisfied with the leading zero that I got in my insert-date function.

It looks now as 09 jun 2015, instead 9 jun 2015.

To solve this, I looked into the source code of s.el and wrote a function for it.

(defun insert-date ()
  "Insert current date 1 jun yyyy."
  (interactive)
  (insert
   (if (string-prefix-p "0" (format-time-string "%d"))   ;; Checks if there is a leding zero.
       (s-right (format-time-string "%d") 1)             ;; If so, chop it off with the library s, then s-right.
     (format-time-string "%d"))                          ;; If not (for example, 10, 12, 25, 31), let it so.
   (format-time-string "%b %Y"))                         ;; Then the rest (jun 2015).
  )

After some tweaking, I still got the same error that there is a wrong type argument in sequencep 1. But I couldn't figure out.

Anybody have the golden hint?


texts: How to move the cursor to a newly opened buffer only when the newly opened buffer can be closed with q?

texts: Some buffers can be closed by being in them and pressing q such as the help buffer, doing C-h k M-x will open a help buffer describing the keybinding M-x. Although, the cursor will stay in the original buffer and when I done reading the help buffer, I'll move to it and press q. Is there a way to automatically move to the new buffer only when the new buffer can be closed with a q so I don't have to move to it after reading and can just hit q?


texts: file org-capture item under existing heading if it exists

texts:
I have the following org-template set up:

("mw" "Note" entry (file+headline "~/org/mathematica.org" "WIA")
  "* %f code review \n ** %T \n%? \n%a \n%i")

So that the heading name is determined by the file name and the "code review," and then there's a subheading using the date and time of the note.

If for example I've already made a note using this template while visiting the file foo.do, I would like the next entry to be with that one as in the following example:

>     * foo.do code review
>     **<2015-11-22 Sun 09:00>
>     first note
>     **<2015-11-22 Sun 10:00>
>     second note

But instead I get

>     * foo.do code review
>     **<2015-11-22 Sun 09:00>
>     first note
>     * foo.do code review
>     **<2015-11-22 Sun 10:00>
>     second note

How can I make all the foo.do code review notes be under the same heading?


texts:
On the left: emacs in console mode. On the right: emacs with GUI.

Running 24.5.1 on Arch linux. Both my console and emacs have the font set to Inconsolata 12. What can I do to make the emacs with GUI fonts look "smoother"?

[ETA more detail:]

I tried making a /etc/fonts/local.conf file which specified anti-aliasing. It made no difference. (I'm not using Infinality.)

According to this answer I should find out the GNOME settings and make a .Xresources file that emacs would use. But I didn't have any luck there.

From gnome-tweak-tool I had:

Hinting: medium
Antialiasing: Grayscale
Scaling Factor: 1.0

I couldn't figure out what "Antialiasing Grayscale" is equivalent to in Xresources-speak...

$ xrdb -query | grep Xft
Xft.dpi:    96
Xft.antialias:  1
Xft.hinting:    1
Xft.hintstyle:  hintmedium
Xft.rgba:   none

This is what was there before I made a .Xresources file and it seems basically correct? I tried changing Xft.rgba to rgb but I couldn't appreciate any difference.


texts: In Geben, how can you jump to the currently paused line from any buffer

texts: When debugging PHP with Geben and xdebug, how do you jump to the currently paused line (The line with a => mark in the margin) from any buffer.


texts: Ignore whitespace differences of Emacs' ediff-directories

texts: I'm aware of the ability of Emacs to ignore whitespace changes of a comparison of a file, but what about a session of ediff-directories? How can Emacs be configured to ignore files that are the same but for minor whitespace changes, particularly Windows/Linux line endings differences? I don't want to see lines for files that have no real differences in such an ediff session. Is there a way to filter out identical files and files that differ only by whitespace changes in an ediff session?


texts:
For me, one of Emacs' most useful functions is delete-duplicate-lines. I call it this way, which very helpfully leaves blank lines intact:

(defun delete-duplicate-lines-keep-blanks ()
  (interactive)
  (delete-duplicate-lines (region-beginning) (region-end) nil nil t))

However, I'd like to be queried. How can I direct Emacs to query me, showing me each duplicate line, and giving me the option to delete it or leave it intact?


texts: How to apply a patch to a package without upgrading?

texts:
When I tried to use google-translate.el, I got a Failed to search TKK error.

And according to this page the error caused by bug#11788.

So I have to upgrade Emacs 26 or apply the patch. But latest emacs in MacOS is 25.2. And I cound't find where is the *.el files for the patch.

How can I avoid this issue? I just want to use google-translate.el.

I'm using Emacs 25.2 (9.0).


texts: Can I automatically export org deadlines and scheduled tasks as an iCal file and import it with another calendar app?

texts:
I would like to update Google Calendar / iCal automatically by exporting my org deadlines and scheduled tasks in .ics format, then automatically importing them into a cross-platform calendar app. I have tried the org / Google Calendar integration and been unable to get it to work. Is it possible to use cron jobs or some other method to automate this task?

Update: I have used org-icalendar-export-to-ics to export my org file and then manually imported it into the OSX calendar app, and it then appears in my Google Calendar. I am wondering whether anyone has a way to automate this process. As a first step, I envision running a command from the terminal that launches emacs with an argument that sends the org-icalendar-export-to-ics command. Is that possible? After that, I'll have to set up a way to automatically import the .ics file into either OSX calendar or Google Calendar.


texts:
9 out of 10 times it happens when invoking magit with C-x g.
I noticed (sometimes) pressing 'g' for refresh inside a dired buffer crashes too.
There's no error shown. My -nw emacsclient just lands in a corrupted shell prompt, where I have to type reset to even start seeing characters I type in to the shell.
administrator@Administrators-MacBook-Pro-2$ emacs --version
emacsclient -a  -s example -nw --version
emacsclient 27.1
administrator@Administrators-MacBook-Pro-2$ brew upgrade emacs
Warning: emacs 27.1 already installed
administrator@Administrators-MacBook-Pro-2$ uname -a
Darwin Administrators-MacBook-Pro-2.local 19.6.0 Darwin Kernel Version 19.6.0: Sun Jul  5 00:43:10 PDT 2020; root:xnu-6153.141.1~9/RELEASE_X86_64 x86_64
administrator@Administrators-MacBook-Pro-2$

What I tried:
M-:
(byte-recompile-directory package-user-dir nil 'force)

note im not shown a backtrace because pretty much i get ejected to the shell.


texts: Indentation by using AST from external program

texts:
I'm pondering over doing indentation by using an AST created with an
external (non-emacs) tool. But so far I do not really know where to
start. Are there emacs packages which already did this? Any tips and hints
are welcome.


texts: Keep displaying current org heading info in some way

texts:
Often I have a problem that I browse through the content of the heading but I forget what is a heading I'm currently at. So I leave the mark, go back to the heading, read it, and jump back to the mark. It disrupts the workflow and wastes time.
I think the solution to this problem would be displaying the current heading (or entire heading path separated by "/" or similar) in the echo area while I browse/edit heading content or make it stick to the top in a similar way position: sticky in CSS3 works.
Are there any plugins or configuration options that address this issue?


texts: Trigger a function when a key is held down after X seconds?

texts:
I have highlight-symbol enabled with the delay set to 0. It's great, but unfortunately when I navigate by holding down j or k (evil-mode), the feedback is not great.

So I was wondering if it's possible to temporarily disable highlight-symbol as I'm holding down j or k. I've tried setting the delay to 0.1 or smaller, but it always seems to feel like it's 1 second.

(Now, I know there are better ways in navigating, but that's beside the question)


texts: Flycheck - Eslint: 'config file: missing or incorrect'

texts:
After following the installation instructions I received this error:
javascript-eslint (disabled)
    - may enable:  Automatically disabled!
    - executable:  Found at /Users/ben/programming/eslint_test/node_modules/eslint/bin/eslint.js
    - config file: missing or incorrect

I have tried many things, yet nothing worked. Out of desperation I reinstalled my MacOS in the hope that a fresh install would fix things.
My steps:

Fresh MacOS install. (Catalina, 10.15.6)
Installed Emacs through Brew
Installed the minimal amount of packages, like Flycheck and exec-path-from-shell (see config file below)
Made a simple Eslint project. (main.js, with eslint init)
C-c ! v in the main.js buffer
Received the error
From the terminal: eslint main.js -> success
From the terminal: eslint --describe-config main.js -> success

Running M-x describe-variable RET exec-path returns:
Its value is
("/usr/local/bin/" "/usr/bin/" "/bin/" "/usr/sbin/" "/sbin/" "/Applications/Emacs.app/Contents/MacOS/bin-x86_64-10_14/" "/Applications/Emacs.app/Contents/MacOS/libexec-x86_64-10_14/" "/Applications/Emacs.app/Contents/MacOS/libexec/")
Original value was
("/usr/local/bin" "/usr/bin" "/bin" "/usr/sbin" "/sbin" "/Applications/Emacs.app/Contents/MacOS/bin-x86_64-10_14" "/Applications/Emacs.app/Contents/MacOS/libexec-x86_64-10_14" "/Applications/Emacs.app/Contents/MacOS/libexec")

My config file:
(require 'package)

(add-to-list 'package-archives
             '("MELPA Stable" . "https://stable.melpa.org/packages/") t)
(package-initialize)

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(package-selected-packages (quote (exec-path-from-shell js2-mode web-mode flycheck))))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 )
(when (memq window-system '(mac ns))
  (exec-path-from-shell-initialize))

;; turn on flychecking globally
(add-hook 'after-init-hook #'global-flycheck-mode)

;; use local eslint from node_modules before global
;; http://emacs.stackexchange.com/questions/21205/flycheck-with-file-relative-eslint-executable
(defun my/use-eslint-from-node-modules ()
  (let* ((root (locate-dominating-file
                (or (buffer-file-name) default-directory)
                "node_modules"))
         (eslint (and root
                      (expand-file-name "node_modules/eslint/bin/eslint.js"
                                        root))))
    (when (and eslint (file-executable-p eslint))
      (setq-local flycheck-javascript-eslint-executable eslint))))
(add-hook 'flycheck-mode-hook #'my/use-eslint-from-node-modules)

No google search led me in the right direction. I tried this with a global eslint, and with a local one. Both fail.
Eslint version: 7.4.0


texts: Terminal capable of italics -- emacs not so much

texts:
I'm trying to get emacs (27.1) to render italics correctly in markdown mode.

The above screenshot comes from my GUI emacs.
But here's emacs 27 rendering italic text (markdown mode) in iTerm2. It jus shows underlined text.

Yet the terminal is clearly capable of rendering italics in that font. Here are italics being rendered in that same text in Joplin (iTerm2, font=Monaco).

I have italic text allowed in iTerm2. As far as  can tell the problem is emacs related. Yet the GUI emacs works fine, so perhaps some weird interaction between emacs and iTerm2?


texts:
I know I must be missing something simple, but I've recently upgraded my Linux OS to Mate 20.04.  As a result, my version of emacs is Emacs 26.3. I'm now running into incompatibility issues with MELPA packages.
I get numerous errors of the form:
gnus-notes         20210103.2050 incompat   melpa      Keep handy notes...
gnus-notes is an incompatible package.
     Status: Incompatible because it depends on Emacs 27.1.
    Archive: melpa
    Version: 20210103.2050
     Commit: 8cacba653f8912355d45847c5e5376eb83e6898f
    Summary: Keep handy notes of read Gnus articles with helm and org
   Requires: emacs-27.1, bbdb-3.1, helm-3.1, hydra-0.13.0, org-8.3, s-0.0, lv-0.0,
               async-1.9.1
   Homepage: https://github.com/deusmax/gnus-notes

Is there an archive repo I should be using?  A setting for my init.el file?


texts:
I would like to setup an org-capture template for my journal entries that mimics org-journal.el. The difference is, I want my journal to live in one file.

Here is an excerpt from the github page to see what it looks like:

* Tuesday, 06/04/13
** 10:28 Company meeting
Endless discussions about projects. Not much progress

** 11:33 Work on org-journal
For the longest time, I wanted to have a cool diary app on my
computer. However, I simply lacked the right tool for that job. After
many hours of searching, I finally found PersonalDiary on EmacsWiki.
PersonalDiary is a very simple diary system based on the emacs
calendar. It works pretty well, but I don't really like that it only
uses unstructured text.

Thus, I spent the last two hours making that diary use org-mode
and represent every entry as an org-mode headline. Very cool!

** 15:33 Work on org-journal

Here is what I have so far:

;; org-capture settings.
  (setq org-capture-templates
        `(("j" "Journal entry" entry
           (file+headline "~/org/journal.org"
                          ,(format "%s"
                                   (format-time-string "%A, %y/%m/%d")))
           ,(concat "* " (format-time-string "%H:%M") " %^{Title}\n%?")
           )))

This has three problems:

I can't figure out how to add a blank link in between entries.
Org-capture keeps adding a blank space to the left of %?. No idea what is causing this
The time stamp does not increment after the first time I run this?

Any ideas?


texts: Keep spacemacs from retrieving package archives at startup

texts:
I'm trying to figure out a way to speed up my spacemacs start time. The main offender at the moment is the refreshing of package archives at start. I was hoping that setting dotspacemacs-check-for-updates would achieve this, but alas, this has no effect on the packages (which actually makes sense to me).

Internet searches haven't really helped; maybe I've not searched the right words. Digging into the source code, I saw that if I globally set configuration-layer--package-archives-refreshed to a non-nil value, I can short-circuit the function configuration-layer/retrieve-package-archives to suppress this functionality.

This of course a dirty hack. Can someone tell me if there is some officially supported way of doing this and how?


texts:
I'm in a strange situation.

Emacs automatically backup all of my files except for some of my orgmode files.
And I can't understand why.

Do you have any idea how I can investigate and fix this?


texts: Weird keyboard behaviour by Emacs in a terminal

texts:
I am having problems to configure my EMACS in -nw mode using linux thorough ssh. I am trying to map Ctrl+Shift+z to redo using undo-tree-redo. I tried the following code

(defalias 'redo 'undo-tree-redo)
(global-set-key (kbd "C-z") 'undo)
(global-set-key (kbd "C-S-z") 'redo)

I also want to map some other key bindings using the Shift key, however, it seems that it is not mapped correctly. I tried to follow this solution Shift+Up isn't recognized by Emacs in a terminal. However when I try to get the escape function to say Ctrl+Shift+z using Ctrl+Q, it returns ^Z, which is exactly the same as whiotu the shift key!!!!

So the Shift key has absolutly no effect on the key binding. The shift key does work though, since I can use it to capitalize etc.

How can I solve this issue?

Note: some other keys also have a weird behaviour when using Ctrl+Q to insert the characters literally. For instance the return key gives ^M and the backspace gives ^?. I have absolutely no idea what's going on!


texts: How can I tell Helm's `completion-at-point` to ignore certain file endings?

texts:
When I'm using emacs-shell, I often try to run files for which a backup (with ~ ending) exists.

I use Helm, and if I try to auto-complete the name of a file called, say, seed-rand.rb, with an existing backup, I get a result like the image below:

completion-at-point really isn't helping me here—is there any way of telling it to ignore files ending with ~? (That's what it does when helm-mode is turned off.)

And if that's not possible, is there any way of just turning this helm feature off without toggling helm-mode every time I want to do so?


texts: How to resolve citations within an org-mode file?

texts:
When writing scientific papers within org-mode, the usual way to go is to specify citations, e.g., with the help of org-ref and then to export the whole thing to LaTeX/PDF, which does also resolve the citations based on a BibTeX database.

While this works out very well in everyday work, I would be curious to learn whether it is also possible to stay within org-mode proper, hence to have all the references automatically resolved and printed at the end of the org-mode file.

This would have two nice consequences that I miss so far:

The export to HTML would also include resolved references.
Similarly, the export with ox-reveal (for outputting slides) would include them too.

EDIT:

It turned out that the desired consequences are actually not so difficult to achieve. Using org-ref, don't forget (as I did) to make use of bibliography:your-bib-file.bib and bibliographystyle:your-bst-file.bst.

Yet the underlying question about self-contained org-mode files still remains.


texts:
To quote,

  By default, Auto-Revert mode works using file notifications, whereby
  changes in the filesystem are reported to Emacs by the OS. You can
  disable use of file notifications by customizing the variable
  auto-revert-use-notify to a nil value, then Emacs will check for file
  changes by polling every five seconds. You can change the polling
  interval through the variable auto-revert-interval.

Even auto-revert-use-notify is t, auto revert still polls for every 5 seconds.  I want to disable such a polling because it results a block every time it polls. The block is due to the files are on a fuse mounted disk (via vmware).


texts: Can't get directory local variables to work - Debugger encountered Lisp error

texts:
I've tried adding directory variables in several ways and I keep getting the same error. First, I was editing .dir.locals.el, but when that didn't work, I added each variable individually using M-x add-dir-local-variable.

Here is the code that was produced:

((nil
    (fill-column . 80)
    (tab-stop-list number-sequence 4 200 4)
    (tab-width . 4)))

This is the error I was getting:

Debugger entered--Lisp error: (invalid-function (nil (fill-column . 80) (tab-s$((nil (fill-column . 80) (tab-stop-list number-sequence 4 200 4) (tab-width $
 eval-region(98 186 t #[257 "\300\242b\210\301\207" [(186) ((nil (fill-column$ eval-defun-2()
eval-defun(nil)
call-interactively(eval-defun nil nil)
command-execute(eval-defun)

I've tried setting the local variable in the directory the one I'm trying to affect is located in and using the subdirectory instead of nil with no improvement. I've also tried just setting one local var at a time:

((nil
    (tab-width . 4)))

And using fully dotted pair notation:

((nil . ((tab-width . 4))))

And I'm still getting an error. Has anyone else encountered this error before? How do I fix it! I would love to be able to use directory variables on a project I'm working on! I'm working on a mac using Emacs 25.3.1, and I've in sshing into a linux machine with Emacs 24.5.1. I can't get my file to compile on either system. Any help would be greatly appreciated!


texts:
I am trying to use org mode to take notes in my math classes. It is awesome that org mode is integrated with LaTeX and partially with cdlatex. However, in a pure math class, the board is covered with things that draw on a wide variety of LaTeX packages and styles. Take abstract algebra for example: the symbols are often written in \mathcal or \mathbb, or a function is written in a way that would look best using \operatorname, or there's a commutative diagram, or an exact sequence where the arrows are labeled with \xrightarrow etc.

It's difficult to take notes on the fly in org mode if you have to type this all out. I am trying to get used to the workflow paradigm and organization style of org mode but the limited ability for LaTeX makes it challenging. For example:

I can put a "usepackage" header or a "newcommand" header at the top of an org-mode file; this will let me use more packages and speed up my typing by letting me write shortcuts, but I'd like to minimize the use of LaTeX headers in order to preserve the generality of the notes - if I refrain from depending on added packages or \newcommand, then I can still export the org files to HTML (with LaTeX through MathJax) if I want to. Is there any way for me to integrate packages or commands or something similar into my notes in a way that would still let me export to HTML if I wanted?
cdlatex has its functionality limited when you use it with Org mode: CDL is replaced with OCDL. I would love to be able to type ('b) after text and have it automatically wrapped in a \textbf, but this doesn't work in OCDL. What breaks if I just use the full CDL? Can I customize the features of cdlatex that can be enabled? cdlatex has TAB autocomplete for a certain list of environments - could I customize this to also autocomplete \operatorname, \textbf, or \mathbb?

Any advice you can give that would help me design a good note taking system would be appreciated!


texts: Delete auto-save file when killing Emacs without saving buffer

texts:
When I have unsaved buffers and I kill Emacs with save-buffers-kill-terminal (C-x C-c) I'm asked whether to save each buffer. Is it possible to delete a buffer's auto-save data when I answer n?

I had tried to add a function that deletes the auto-save data to kill-emacs-hook, but that would run even if I killed Emacs from the terminal, when the auto-save data would actually be useful.


texts:
After struggling with AUCTeX installation under Windows, I was suggested here to use ELPA and its automatic process to install the package.

Following this, everything went fine and I can now read, process, and export to pdf a .tex source within emacs.

Also, I have available the dvipng program and I can successufully reproduce the steps described here in the section dvipng setup.

However, it is the latex-preview mechanism which I cannot get to work. Different things happen in org-mode and AUCTeX:

AUCTeX :

After finding a .tex file, Preview, LaTeX and the rest of menus are available, and as said the process of generating a dvi and pdf flows without issues. However, the preview on toggle does not work correctly. I get the following error message:

LaTeX: preview-image-type setting 'png unsupported by this Emacs

I looked up the specific error string and got here, where it is suggested to change the output format from png to pnm in the preview-latex.el file. However, I cannot find this file!!!

org-mode :

I insert a LaTeX fragment into an org file (an equation), then with C-c C-x C-l I should have a preview of the output overlayed inline, but I do not see any change in the buffer. Still, I get no error message even if the variable org-format-latex-signal-error is set to non-nil (which should signal an error in image snippet creation). All I see in the minibuffer is the message:

Creating image...done. Use `C-c C-c` to remove images.

EDIT

I made the AUCTeX preview work...it involved downloading of dll and correction of launching command for - basically - ghostview. There are few steps involved, so I plan to write about them as soon as I have a minute.

org-mode preview does not work as of yet, it just shows a white image so I'll have to investigate that.


texts: How can I convert hexidecimal values to base 10 in hexl-mode?

texts:
A nice feature of viewing binary files with hexl-mode is it displays the equivalent ASCII values to the right of your hexidecimal lines.

Is there a way to make hexl-mode treat hex values as floats, doubles, or some other format instead of ASCII? If not, is there a way to easily do the conversion on a line or region basis and display the result in the same buffer?

Suggestions for modes besides hexl-mode are fine, but I would prefer to stick to the built-in modes if it doesn't require too much .emacs configuration.


texts:
I use async with Dired copy/move/rename, but deletion somehow does not work. On top of it when deleting +100 files the deletion is very slow. Anyone knows a remedy for either: 1. Faster file deletion, 2. Async file deletion?

I also just tried some deletions via Neotree and the outcome is the same, meaning very slow. Which means that both the packages are using the same deletion method, probably delete-file and delete-directory. The question still remains, why are they so slow?

Copying those exacts same file via Dired to a new location is faster than deleting them. To copy it takes 0.5s, to delete 17s !!!! Removal via any other application in the system takes the approriate close to 0s time...


texts:
I have Gnus set up to get mail via nnimap and it works fine, except for one small problem:  It shows all directories twice, once with a slash as the separator, once with a dot as the separator.  So I have a list that looks roughly like this:

12: Test/INBOX/Stackexchange
 *: Test.INBOX.Stackexchange

The directories with a dot as the separator are not subscribed, so at least I don't always see them, but they also cannot be opened (Emacs says they do not exist) and so they're pretty annoying.  Is there a way to get rid of them?  Maybe I need to delete some sort of cache to fix the problem.  I tried gnus-group-clear-data-on-native-groups, but that didn't help.


texts: Wierd behaviour and lag of markdown mode (due to indirect buffer?)

texts:
Problem

There is severe lag(>10s some times) in my markdown document (14k words) which I run within emacs. It appears that Markdown-mode seems to be computing something everysingle time I type any character and renders emacs unusable. I suspect it has to do with the above 2 pictures. The color rendering changes with every character.

Profiling was done and the contents is in this paste bin.  There seems to be the font-lock-fontify-keywords-region function that seems to be run twice, once as part of redisplay_internal C function (50%) and the other is the command execute (42%) function.

Further more the issue vanishes or is under much better control once indirect buffer is not running anymore. I need some guidance as to how to go further.

Things I did

Re-installed markdown-mode (to the latest available one), looked for a while on stack. Tried to remove the coloring scheme from my init file, but it still is there somehow. I use forward slashes or other special characters and checked with general syntax and that doesn't seem to be the issue. It exists even with very few characters.

When I copy and paste the same thing into another file, somehow it works well for now without any of the color rendering issues, but within a few days, I am back to the same thing.

Info

I am running Markdown mode on my Emacs 25.3.2 based on this installation on Ubuntu 16 on Acer Nitro 5 1050 GTX graphics card with 8gb ram.

Profiling

https://pastebin.com/QhGH1Nat

Running the following minor modes

Auto-Composition Auto-Compression Auto-Encryption
Auto-Fill Blink-Cursor Diff-Auto-Refine Electric-Indent
File-Name-Shadow Flyspell Font-Lock Global-Eldoc Global-Font-Lock
Line-Number Menu-Bar Mouse-Wheel Tool-Bar Tooltip Transient-Mark

init file

https://pastebin.com/FwsF390f

P.S
I am very new to handling errors in emacs and I feel completely helpless without emacs to write now. Help me find my errors or atleast give me general diretions


texts: Scroll by visual line in `centered-cursor-mode`?

texts:
Mouse scrolling with visual-line-mode in centered-cursor-mode is jumpy as anything when you're writing prose. A single line of text can be 10 or more visual lines.
Editing in refill-mode or auto-fill-mode sort of solve the problem but bring on their own set of issues, either by adding linebreaks where they don't belong, or by messing with the text editing.


texts: Set magit timestamp format with function

texts:
I would like to have my git timestamps in UTC. Currently attempting to commit using magit gives

Wrong type argument: sequencep, my/magit-timestamp-utc

Here's the code:

(defun timestamp-now()
  (format-time-string "%Y-%m-%dT%H:%M:%S%z" (current-time)))

(defun timestamp-utc ()
  (let* ((original-tz (getenv "TZ")))
    (setenv "TZ" "UTC0")
    (let ((timestamp (timestamp-now)))
      (setenv "TZ" original-tz)
      timestamp)))

(defun my/magit-timestamp-utc (&optional prompt default)
  (concat "--date=" (timestamp-utc)))

(setq magit-commit-popup
  '(:variable magit-commit-arguments
    :man-page "git-commit"
    :switches ((?a "Stage all modified and deleted files"   "--all")
               (?e "Allow empty commit"                     "--allow-empty")
               (?v "Show diff of changes to be committed"   "--verbose")
               (?h "Disable hooks"                          "--no-verify")
               (?s "Add Signed-off-by line"                 "--signoff")
               (?R "Claim authorship and reset author date" "--reset-author")
               (?u "UTC" my/magit-timestamp-utc))
    :options  ((?A "Override the author"  "--author=")
               (?S "Sign using gpg"       "--gpg-sign=" magit-read-gpg-secret-key)
               (?C "Reuse commit message" "--reuse-message="
                   magit-read-reuse-message))
    :actions  ((?c "Commit"         magit-commit)
               (?e "Extend"         magit-commit-extend)
               (?f "Fixup"          magit-commit-fixup)
               (?F "Instant Fixup"  magit-commit-instant-fixup) nil
               (?w "Reword"         magit-commit-reword)
               (?s "Squash"         magit-commit-squash)
               (?S "Instant Squash" magit-commit-instant-squash) nil
               (?a "Amend"          magit-commit-amend)
               (?A "Augment"        magit-commit-augment))
    :max-action-columns 4
    :default-action magit-commit))


texts: Filtering list of files to those recently edited

texts:
Suppose I have a list of files:
(setq files '("/path/to/file1" ...))

Is there a way to reduce this list to only those files which were edited within the past, say, 10 days?


texts:
I used to have a configuration for TAB which was doing something like this :

This is the code before hitting TAB.

template<typename T>
class A
{

    }; // This is where I hit TAB

The code auto-indented as below after hitting TAB:

template<typename T>
class A
{

};

The TAB key used to work as above but now it does only auto-complete.

Can I fix this ? I can use TAB with C-qTAB but it is hard to do always.

Here is my .emacs file

(add-to-list 'load-path "~/.emacs.d/jdee-2.4.1/lisp")
(load "jde")

(add-to-list 'load-path "~/.emacs.d")
(require 'linum)
(global-linum-mode 1)

(add-to-list 'load-path "~/.emacs.d/elpa/yasnippet-0.8.0")
(require 'yasnippet)
(yas-global-mode 1)
; care about this place
(define-key yas-minor-mode-map (kbd "<tab>") nil)
(define-key yas-minor-mode-map (kbd "TAB") nil)
(define-key yas-minor-mode-map (kbd "<backtab>") 'yas-expand)
; care about this place
(setq ac-source-yasnippet nil)

(add-to-list 'load-path "~/.emacs.d/auto-complete-1.3.1")
(require 'auto-complete-config)
(ac-config-default)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict")
(global-auto-complete-mode t) ; section1
(ac-set-trigger-key "TAB")
(ac-set-trigger-key "<tab>")

(defun my:ac-c-headers-init ()
  (require 'auto-complete-c-headers)
  (add-to-list 'ac-sources 'ac-source-c-headers))

(add-hook 'c++-mode-hook 'my:ac-c-headers-init)
(add-hook 'c-mode-hook 'my:ac-c-headers-init)

(add-to-list 'load-path "~/.emacs.d/iedit")
(require 'iedit)
(define-key global-map (kbd "C-c ;") 'iedit-mode)

(semantic-mode 1)
(defun my:add-semantic-to-autocomplete()
  (add-to-list 'ac-sources 'ac-source-semantic)
)
(add-hook 'c-mode-common-hook 'my:add-semantic-to-autocomplete)
(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ansi-color-names-vector ["#242424" "#e5786d" "#95e454" "#cae682" "#8ac6f2" "#333366" "#ccaa8f" "#f6f3e8"])
 '(cua-mode t nil (cua-base))
 '(custom-enabled-themes (quote (tango-dark)))
 '(font-use-system-font t)
 '(show-paren-mode t)
 '(uniquify-buffer-name-style (quote forward) nil (uniquify)))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(default ((t (:family "DejaVu Sans Mono" :foundry "unknown" :slant normal :weight bold :height 113 :width normal)))))
(setq-default indent-tabs-mode nil)
(setq-default tab-width 2)
(setq indent-line-function 'insert-tab)

Edit When I add JDE it fixed but now I cannot use auto-complete ? It doesn't complete anything.


texts: Jumping from gud-interaction-buffer to code

texts: I'm trying to use GUD more as a front-end to GDB. I mostly work in the interaction buffer as I do normally on the command line. However when I come across a particular line in the code (through bt or frame) how can I jump to the code buffer? It seems such an obvious navigation but I can't figure out what command it is.


texts:
I use emacs with AUCTeX for editing tex files. I also use flycheck for some other programming language.

How to disable flycheck in TeX mode ? I tried called flycheck-mode nil in the latex hook  but it doesn't work.


texts: Run flyspell-buffer automatically after emacs loads a (tex)-file

texts:
I want to load flyspell-mode and execute flyspell-buffer automatically after emacs loaded a tex file. I tried the following which loads flyspell-mode but doesn't seem to execute flyspell-buffer. What would be the proper way to to this? How do I have to change it if I want it on every file not just on LaTeX-files?

(setq ispell-program-name "hunspell")
(setq ispell-local-dictionary "de_DE")
(setq ispell-local-dictionary-alist
      '(("de_DE" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil nil nil utf-8)
    ("en_US" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil nil nil utf-8)
    ))

(add-hook 'LaTeX-mode-hook 'turn-on-flyspell)
(add-hook 'LaTeX-mode-hook 'flyspell-buffer)


texts: A few org files are not displayed as org mode

texts:
When I open file with C-x C-f (counsel-find-file &optional INITIAL-INPUT)

Most of the org files are opened as org-mode automatically, yet there are a few displayed as plain text as fundamental mode.

What's the problem it might be?

The example is the Chapter 5 of SICP

Issue M: and eval (cl-rassoc 'org-mode auto-mode-alist), get output

("\\.org\\'" . org-mode)

Emacs 26.3
GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.11) of 2019-09-23, modified by Debian

the machine info:

OS: Ubuntu 19.10 x86_64
Host: MacBookPro11,1 1.0
Kernel: 5.3.0-24-generic
Uptime: 7 hours, 54 mins
Packages: 2601 (dpkg), 2 (snap)
Shell: bash 5.0.3
Resolution: 2560x1600
DE: KDE
WM: KWin


texts: How do I search the auto-complete options?

texts:
Spacemacs by default comes with company for autocomplete.
When typing, it shows all kinds of symbols matching what I have typed so far. This list can be very long.

Is there any way to search in the currently available completions?

Example:
Say I want to add a key to an evil-mode keymap.

(define-key evil- will show a bunch of options but now I would like to filter those for the ones that also contain map.


texts: How do I inherit from prog-mode, whilst still supporting older emacsen?

texts:
I'm writing a major mode for a programming language, but I want to support older Emacs versions. prog-mode is relatively new. I want to inherit from prog-mode if it's defined, but still do something sensible otherwise.

What's the best approach? Should I defalias prog-mode on older Emacsen, or will that interfere with other modes if they do the same thing?


texts: replace checkbox with glyph via font-lock

texts:
I am trying to figure out how how to replace structural elements in org-mode with glyphs/abbreviations to make them more readable. Unfortunately, I'm getting stuck on replacing a simple checkbox [X] with  (glyph).

 (font-lock-add-keywords
     'org-mode `(
                  ("^\s*\\**\\(-\\|\\+\|[0-9]+\\|\\)\s\\(\\[X\\]\\)"
                      (3 (progn (compose-region (match-beginning 1) (match-end 1)
                                 "")
                            nil)))
                 )
     )

My goal is to replace the checkbox capturing group with the glyph, but no matter which group index I pick, I either get a pre-pended glyph or no glyph at all. More disturbingly, this messes with the rest of Org-mode's fontification when you toggle to fundamental-mode and then back to org-mode. Is this is breaking the syntax table or something? How do you avoid this happening?

Update

I think the problem is with the complex regex capture groups. I you just code this for the - [X] case (no OR expressions needed, one capture group), everything works and the other font-locks do not get messed up.


texts:
I want to select (by regexp) only text that start by - and end by whitespace

here text:

test-hello how-are again ok
maybe good but-some not good but-what about this

I use this regexp:

-.*\s-

but result is not correct:

The correct result is:

"-x "
"-f "
"-hello "
"-are "
"-some "
"-what "

How I can do this by regexp?


texts: Why do my org DEADLINEs appear with no warning?

texts:
I have org-deadline-warning-days set to 14.  Here is a deadline in my agenda file:

** TODO Do thing
DEADLINE: <2018-11-20 Wed>

In the agenda view for that date (20th Nov), I see:

next:       Deadline:   TODO Do thing

But no warning of that: for example, nothing on the 6th Nov.  I expected that having org-deadline-warning-days would show a warning on that day.  Why doesn't it?  How can I get a warning?

PS: even if I write the deadline like this:

DEADLINE: <2018-11-20 Wed -1d>

I still don't get any warning (which if I understand should show on the 19th in the agenda view in this case), only an entry in the agenda view on the 20th itself.


texts:
How to set it?

I tried

(add-hook 'ido-setup-hook
          (lambda ()
            (local-set-key (kbd "C-<RET>") 'ido-select-text)))

and

(define-key ido-common-completion-map (kbd "C-<RET>") 'ido-select-text)

Nothing worked.

EDIT:

I tried

(define-key ido-file-dir-completion-map (kbd "<C-return>") 'ido-select-text)

and

(define-key ido-common-completion-map (kbd "<C-return>") 'ido-select-text)

Not works again.

EDIT2:

Ultimatelly strange, even this not works.

(global-set-key  (kbd "<C-return>") 'ido-select-text)

What's going on??? Actually, cua-select-rectangle is invoked regardles of my binding.

My emacs version GNU Emacs 24.5.1 (x86_64-redhat-linux-gnu, GTK+ Version 3.18.9)\n of 2016-04-11 on buildvm-25.phx2.fedoraproject.org
Using in GUI mode and CUA mode.

C-h k C-<return>

Returns (in standard buffer and IDO buffer)

<C-return> runs the command cua-set-rectangle-mark, which is an
interactive autoloaded compiled Lisp function in `cua-rect.el'.

It is bound to <C-return>.

(cua-set-rectangle-mark &optional REOPEN)

Set mark and start in CUA rectangle mode.
With prefix argument, activate previous rectangle if possible.


texts: Leave noweb references in Org-Babel unevaluated with variables

texts:
I'm currently getting into Literate Programming with org-mode in Emacs. One of the key features to make it tractable as a programming style is macros. I would like to be able to do something like this:

#+BEGIN_SRC emacs-lisp :tangle yes :noweb yes
<<set-name(name="John Doe",email="john.doe@gmail.com")>>
#+END_SRC

#+NAME: set-name
#+BEGIN_SRC emacs-lisp :tangle no :macro yes :var name="" :var email=""
(setq user-full-name name
      user-mail-address email)
#+END_SRC

And to have the tangled result be

(setq user-full-name "John Doe"
      user-mail-address "john.doe@gmail.com")

Currently this is possible in lisp languages like so:

#+NAME: set-name
#+BEGIN_SRC emacs-lisp :tangle no :var name="" :var email=""
`(setq user-full-name ,name
       user-mail-address ,email)
#+END_SRC

However, it doesn't appear that this is possible with other languages with lesser macro features, like Java for example.

Is there a pre-existing way to do this kind of variable-substitution-based macro expansion in org-mode? If not, where would be a good place to start with implementing it?


texts:
I'm running Debian Jessie. I have installed emacs24-lucid package. I tried running emacs --daemon and got this:

Loading 00debian-vars...
Loading 00debian-vars...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
Loading debian-ispell...
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...done
Loading debian-ispell...done
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done
Loading /etc/emacs/site-start.d/50festival.el (source)...
Loading /etc/emacs/site-start.d/50festival.el (source)...done

Backtrace:
emacs[0x8130d29]
emacs[0x81189e6]
emacs[0x812fb9e]
emacs[0x812fc0b]
linux-gate.so.1(__kernel_sigreturn+0x0)[0xb775ed1c]
emacs[0x8194292]
emacs[0x819abac]
emacs[0x819b36d]
emacs[0x80ed071]
emacs[0x80ec057]
emacs[0x81857d0]
emacs[0x81b893d]
emacs[0x8185317]
emacs[0x8186873]
emacs[0x8184b09]
emacs[0x81a718b]
emacs[0x81a7867]
emacs[0x81857a7]
emacs[0x81b893d]
emacs[0x8185317]
emacs[0x818565b]
emacs[0x8185a03]
emacs[0x81a7fa5]
emacs[0x81857a7]
emacs[0x81b893d]
emacs[0x8185391]
emacs[0x818565b]
emacs[0x81b893d]
emacs[0x8185391]
emacs[0x818565b]
emacs[0x8184e11]
emacs[0x818793b]
emacs[0x81b9963]
emacs[0x8185391]
emacs[0x818565b]
emacs[0x81b893d]
emacs[0x8185391]
emacs[0x8186873]
emacs[0x8184b09]
emacs[0x8186f67]
emacs[0x8118ef4]
...
Error: server did not start correctly

Not sure what could be causing this. Any ideas?

EDIT: I can start server from within emacs. As a workaround, I am using an emacs instance as the "server".


texts: Prevent Spacemacs from creating double sr-speedbar

texts:
I'm trying to make Spacemacs and sr-speedbar work together smoothly.

Without using Spacemacs:

The command buffer is local to each buffer where it is called:

Left is sr-speedbar, right is the main buffer.

If invoke command buffer from sr-speedbar buffer, then it is local to sr-speedbar buffer:

Left is sr-speedbar, right is the main buffer.

After using Spacemacs:
The command buffer is occupying both of the windows,

And possibly because of this feature, oftentimes, it creates two sr-speedbar buffers, which is very annoying, using list-fontsets:

So how to roll back the command buffer to make them act like normal to prevent creating two sr-speedbars?


texts:
Since moving to Kubuntu 20.04 I have been getting this strange visual tearing in emacs (running in its own window). I find that as I move the point along the line with the tearing, it is corrected. Has anyone experienced this or similar issues?

Some system info:
KDE Plasma Version: 5.18.5
KDE Frameworks Version: 5.68.0
Qt Version: 5.12.8
Kernel Version: 5.4.0-59-generic
OS Type: 64-bit
Processors: 4 × Intel® Core™ i5-4690K CPU @ 3.50GHz
Memory: 15.6 GiB of RAM

01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Cayman PRO [Radeon HD 6950]


texts:
Very much like Restart emacs from within emacs, except I'd like to do this for an emacs daemon and client.

Specifically, I'm interested in the terminal client, but of course being able to restart from the graphical client would be cool.

EDIT: A quick glance at the Emacs source makes it look like stuffing a string to the STDIN of a terminal hosting a client cannot be done. :( Perhaps there's some other way?


texts: Increase spacing between physical lines only

texts:
How can I add spacing where there are linebreaks in the file, but not where a line is word-wrapped? This would be very useful for reading log files with long lines. Here's a mockup of what I'm after:

I found a variable called line-spacing, but it controls the spacing between all display lines:


texts:
I'm a new user to Emacs and I'm using ORG mode to start with.
When I create a list of items, sometimes I copy and paste data from other locations - forming a list of unstructured items.

How to make them with the same indent?
How to make them check list items by selecting them all in one go?

I tried all that is available here for indentation in vain. Where should I be looking for this information?


texts: Exiting visual-regexp search with a cursor motion command doesn't execute that command

texts:
I recently set up the visual-regexp-steroids package to try it out.  The one major sticking point so far has been that when I terminate the search by typing a cursor motion command (typically M-< or C-a), the cursor is just left where it is; I have to type the command a second time to make it work.

Looking at the source for both visual-regexp and visual-regexp-steroids, I don't find any configurable option for this behavior.  I also don't find any relevant issues filed against either package's Github page.

Is there any way to get the usual Emacs exit-search behavior when using visual-regexp or visual-regexp-steroids?

--

Here's what I tried just now:

I deleted ~/.emacs, started Emacs, and opened a file.  I evaluated (require 'package) and (require 'visual-regexp-steroids), then typed M-xvr/isearch-forward and typed some keys that matched some text present in the file.  Then when I pressed M-<, the search stopped, but the cursor was left at the end of the matching text.


texts: How to handle next-line in keyboard macro?

texts:
I created a keyboard macro to join lines in a buffer using:

F3 C-n M-x join-line RET F4.

It works fine, except when lines get too long and start to wrap – which makes this macro dependent on the width of the frame. next-line doesn’t seem to go to the next actual line, but to the “wrapping” part of the current line.

How to get around that issue?


texts:
Is there a ready-made function that sorts Chinese characters (by pinyin or stroke number) in Emacs in an org-table or line by line in regular text?

If not, how should one go about writing such function? (I just need a general direction as guidance, if it is too cumbersome to provide the full functioning code over here.)


texts: emacsclient, c-x #, c-x c-f and other confusion

texts:
I have used emacs for several years now and wanted to make the leap to daemon mode and using emacsclient.
What has prevented me so far is getting ride(closing) of buffers opend via emacsclient.
Note that with the examples below the daemon was already started with emacs --daemon

First problem is:

open a file via shell with "emacsclient -q -c a.txt"
open a b.txt from inside emacsclient via "C-x C-f b.txt"
executing "C-x #" in buffer b.txt switches to buffer a.txt, but does not close buffer "b.txt"
executing "C-x #" in buffer a.txt closes the client frame and kills buffer a.txt, but buffer b.txt remains open (runnig afterwards "emacsclient -q -c" and checking Ibuffer will show buffer b.txt as available.)
I can only get rid of b.txt by going into its buffer and executing "C-x k"

The first question is how can I get rid of b.txt by simply closing the frame which opened it via "C-x C-f".

The second problem is:

open a file via shell with "emacsclient -q -c a.txt"
open a file via shell with "emacsclient -q b.txt"
when being in buffer a.txt, executing "C-x #" closes buffer a.txt AND KILLS the frame, but buffer b.txt remains open (runnig afterwards "emacsclient -q -c" and checking Ibuffer will show buffer b.txt as available.)
the same holds when executing "C-x C-c", a.txt is closed, b.txt remains open
only when running "C-x #" first in buffer b.txt and then in buffer a.txt will keep the frame open until both buffers are closed

The second question is therefore similar to the first: how can I close all buffers associated to a frame by executing "C-x C-c", and, in case I use "C-x #" how can I keep the frame alive until the last buffer associated to it is close.

Any idea or suggestions.

Thanks a lot.

Cheers


texts: smartparens strict mode insert single quote before variable

texts:
I'm using smartparens-global-strict-modeand having issues quoting variables. How do I get something like 'varname? My current strategy, which seems ridiculous, is to do:

'|' (sp inserts both pairs)

'varname' (write the varname)

at this point, I do M-x smartparens-strict-mode, which toggles it off, delete the right ', then do M-x smartparens-strict-mode again to turn it back on. But there's got to be a better way, right? Am I missing something simple?


texts: Arabic in emacs shown as separate letters

texts:
I am trying to work with Arabic and English texts in the same buffer. They don't have to be in the same paragraphs.

A text like والإكرام و نوافج is shown as separate letters.

Contrary to English, in Arabic, the letters should change the form depending on their position (beginning, middle or end). I see the individual: و ا ل إ ك رام و ن وا ف ج.

Emacs recognizes that the Arabic text is left-to-right though. The backspace key deletes the last logical letter, that is,the letter to the right of the cursor.


texts: How do I build only the Emacs C source files and not the Elisp source files in the Emacs repository?

texts:
Running the default procedure:
~/emacs $ mkdir build
~/emacs $ cd build
~/emacs/build $ ../configure
~/emacs/build $ make

Results in building both the C source files and the Elisp source files.
What command (or target) do I have to pass to make in order for me to build JUST the C source files?