texts: Stop company-mode from completing dictionary words

texts:
How can I stop company-mode from autocompleting dictionary words? I only want it to autocomplete commands.

This is my config:

(use-package company
  :ensure
  :defer 4
  :init (progn
          (global-company-mode)
          (setq company-global-modes '(not python-mode cython-mode sage-mode))
          )
  :config (progn
            (setq company-tooltip-limit 20
                  company-idle-delay .1
                  company-echo-delay 0
                  company-begin-commands '(self-insert-command)
                  company-transformers '(company-sort-by-occurrence)
                  company-selection-wrap-around t
                  company-idle-delay .1
                  company-minimum-prefix-length 1
                  company-selection-wrap-around t
                  company-dabbrev-downcase nil
                  )
            (bind-keys :map company-active-map
                       ("C-n" . company-select-next)
                       ("C-p" . company-select-previous)
                       ("C-d" . company-show-doc-buffer)
                       ("<tab>" . company-complete)
                       ("<escape>" . company-abort)
                       )
            )
  )

UPDATE:
I just noticed that it autocompletes not from the dictionary (ispell) but from all words already existing in the current buffer. How can I stop it from doing so?


texts: Can I checkout a given commit from magit's log view?

texts: I'm exploring a git repository history using magit's log view using l l. Can I checkout a given commit from there without going to terminal?


texts: How can I use agenda view to find all task containing subtasks?

texts: The possibility within Org mode to organize tasks hierarchically makes it suited for managing projects. Hence the the overal project goal ("build a new house") can be the parent task with many subtasks (children task). During my weekly review I would like to make an agenda view that only shows me tasks that has subtasks. Is that possible? Or even more general, can I make an agenda view that only shows tasks of a certain hierarchical depth?


texts: Display tab characters as arrows of varying length

texts:
I would like to make tab characters ("\t") display as arrows of varying length, just like in editors such as Notepad++, gedit, Geany, etc. Here is an example with tab width set to 4 and space characters displayed as dots:

Is there a way to achieve the same functionality in GNU Emacs? Maybe by configuring the whitespace-mode?


texts: How to skip address and greetings in mu4e-conversation-mode?

texts:
Consider an email like:

Dear Ben,
[Body]
Best regards
John

If I read email in mu4e conversation mode I find the address (e.g. "Dear Ben," and the greetings "Best regards..." annoying and want to hide it automatically.
So is there a way to those parts of the email in mu4e conversation view (or mu4e generally) maybe by defining a list of keywords for addresses and greetings? I don't want to delete it from the message, I just want it hidden by default (but be able to show it if I want to).


texts: How to add a string at nth position of an ordered list of strings

texts:
The built-in function add-to-ordered-list is for symbols, not strings.  I have a list of strings and need to add another string to the list at a specific nth position.  How can I accomplish this?
TASK:  Add "--cleared" as the nth 3 position of the ordered list; i.e., "--cleared" will become the 4th string in the list of strings.  [I am using the nth N terminology to signify that the first position is nth 0 followed by nth 1 and so on.]
BEFORE:
'("%(binary)"
  "-f"
  "%(ledger-file)"
  "--empty"
  "--depth=3"
  "--no-total"
  "--amount"
  "'($1,000.00*a)/$1,000.00'"
  "--format"
  "hello-world"
  "bal")

AFTER:
'("%(binary)"
  "-f"
  "%(ledger-file)"
  "--cleared"
  "--empty"
  "--depth=3"
  "--no-total"
  "--amount"
  "'($1,000.00*a)/$1,000.00'"
  "--format"
  "hello-world"
  "bal")


texts: How to set font-height for all future frames?

texts:
I've set the font-family and font-size in a few different ways before, one of which was:

(custom-set-faces
 '(default ((t (:family "Liberation Mono" :height 150)))))

However, I learned that if you set it that way, future frames will not be able to use the values and they need something like:

(add-to-list 'default-frame-alist
             '(font . "Liberation Mono"))

But because I add set it from a variable, I do it like:

(add-to-list 'default-frame-alist
             `(font . ,custom-variable-font-family))

I'm not able to find a way to set the font-height using this method. I did try to set height, but it ended up setting the height of the Emacs frame, just like it's mentioned in one of the documentation pages here.

I also tried a few other keywords apart for font (some from the documentation and some from my own wild guesses), just like you can set the background-color, etc. But I haven't been able to do that. I wonder if it's even possible (I know it should be) to set the font-height across frames that way.


texts: How to stop bookmarks from remembering the cursor place?

texts:
Bookmarks remember the file together with the place of the cursor when the file is bookmarked.  But I just want the cursor to start in the beginning of the file when visiting it through bookmarks.

Then how to stop bookmarks from remembering the cursor place?


texts:
Is there a way to expand a macro using a list of arguments? I tried using apply but then I get an error that the "function" my/x-becomes-nil is invalid.
(defmacro my/x-becomes-nil (variable x)
  `(if (eq ,variable ,x)
       (setq ,variable nil)))

(let ((q 2))
  (my/x-becomes-nil q 2)
  ;;(apply 'my/x-becomes-nil (list q 2)) ;; How to make this work?
  q)


texts: `insert-file-contents` without the comments

texts:
The below command insert the contents of the file myfile.txt.

(insert-file-contents "~/myfile.txt")

Is there a way to tell emacs to not insert the comments (assuming the comment syntax is known to the user and is for example%).


texts: Infix calculator with standard order of operations

texts: I've been using quick-calc for years because it seems like the most sane calculator and it can do a lot of things. But is there really no calculator for Emacs that supports infix notation and uses the regular order of operations? I'm looking for a way to do calculations within Emacs where 50/10*100 evaluates to 500 as it should. Emacs calculators using a non-standard order of operations has screwed up too many of my calculations recently.


texts: Export :PROPERTIES: blocks with org-mode?

texts:
The org-mode manual says that it's possible to export property drawers, but trying with

 #+OPTIONS: d:t

does not export any :PROPERTIES: blocks like it used to.

Reading the Drawers chapter it seems it is indeed not possible anymore, at least with the latest org-mode version:

  You can select the name of the drawers which should be exported with org-export-with-drawers. In that case, drawer contents will appear in export output. Property drawers are not affected by this variable and are never exported.

Is there any tweak to regain that functionality, i.e. having #+OPTIONS: d:t export the whole :PROPERTIES: block, short of manually changing the .org file before export time?


texts: Column of programmatically updated dates in org-mode

texts: I'm trying to make a table in org-mode, the first column of which should be the Monday of each week starting with a date I specify. So, for example, if I specify Dec 14th, I would get a column with Dec 14, Dec 21, Dec 28, Jan 4, etc. Is this possible? If so, how?


texts:
Every time I use M-x magit-status b b to checkout a different branch, the projectile cache is of course out of date. I then use M-x projectile-invalidate-cache to force projectile to rebuild its cache and that does work fine.

How could I automate this? I have no idea how to check which magit-xyz command is triggered when using b b in magit-status. And even if I knew: How would I transparently "overwrite" that command to first call its previous definition and then projectile-invalidate-cache?


texts: recentf cleanup upon mode enabled: not saved in the actual recentf-save-file

texts:
When Emacs starts, it reports a non-existent file is removed from recentf. However, that removal was never saved to the recentf-save-file: the next time Emacs starts, the same removal is reported again. How can I ask Emacs to actually save that removal to the actual file?

Note: I'm using Emacs server and client.


texts: cycling through latex math mode and equation

texts:
Is there a way to cycle through \( x=1 \), \[ x=1\] and
\begin{equation}
x=1
\end{equation}

in any latex package? I find this function practical but I didn't know how to implement using elisp or maybe someone has already done that?


texts: Running out of L:/ etters: shortcut for path needed

texts:
I'm working with files which are stored on a server. The structure on the server is:

//SBS/share/path/to/somewhere/2007/
//SBS/share/path/to/somewhere/2008/
//SBS/share/path/to/somewhere/2009/
...
//SBS/share/path/to/somewhere/2015/

In every years folder are the folders of the year, sometimes up to 1000.

Emacs 24.4 is running on a Win 7 machine. I used to map the folders of the years with letters (X:), but I'm running out of letters now, 2015 is mapped to Z:.

If I wish to open a file of the year 2015, I do: C-x C-f, delete whatever appears in the minibuffer, type Z:, followed by the first letters of the folder. Without mapping the share to Z:, I'd have to type much more:
    //SBS/share/path/to/somewhere/2015/

Emacs can't handle the Windows shortcuts *.lnk. Windows can't map more shares than 26.

My general idea is that I could customise the command "find file" (C-x C-f) somehow.

What I'd like to have that I just type something like C-x C-f 2015 and get
in the minibuffer the line:

Find file: //SBS/share/path/to/somewhere/2015/

with the cursor on the point after the last "/" and the usual auto-complition working, so that typing foo will be completed to foo.tex, if this exists (or a folder called foo).


texts: Is there a possibility to have multiple agenda views open at once?

texts:
I have a custom agenda view which shows the Items I did last week and the items I have to do in this week. This view is based on a filter of TODO items. However, it would be good to see scheduled items and deadlines in another buffer.

Of course I could open another emacs instance and open there a different agenda, but is there another way so that I can examine two different agenda views within the same frame, but in different buffers?


texts: Is there any way to order helm results by commonly used?

texts:
It seems that the order of helm results is never useful... I either have to navigate through the long list or keep typing until I've narrowed the list enough.

Is there any way to sort the results in order of usage frequency?

Edit: That is, the most commonly selected helm results should appear at the top of the list, whether it's for files, commands, variables, etc


texts: Set auto-fill in markdown mode, but exclude code block headers

texts: I want to use auto-fill-mode in Markdown files. By default, it works fine, with one exception. I'm using the RMarkdown variant of markdown. This requires that code block headers remain on one line. They are frequently much longer than my fill-column, so if I use auto-fill, they get wrapped. How can I exclude these lines from getting filled?


texts: how to make HELM stop when TRAMP asks me for my password?

texts:
I have this problem:

Is this a bug? Is this something I can avoid now while a patch comes to Helm?


texts:
In addition to monitoring how much time I spend on a task, I'd also like to note what's going on in that time block. It'd be useful to have it appear in the clocktable, or some other means so that I can graph this column against the time. Is this in any way possible?

edit: for example, I want to rate each time block, on scale 1 to 10, how much work actually gets done, and I want to be able to graph this quality vs time.


texts: Is it possible to have multiple *Find* buffers in emacs?

texts:
If I execute a M-x find-name-dired command the output is a *Find* buffer containing the results.

However if I perform a subsequent find-name-dired the contents of the *Find* buffer are overwritten with the latest output.

Is there a means to execute multiple find-name-dired commands and keep the output buffer of each?

In other words, have multiple *Find* buffers?


texts: Is `loadup.el` hard-coded, such that `-nl` (aka --no-loadup) is futile?

texts:
I would like to create my own startup.el, and it seems that loadup.el is what causes startup to do its thing -- i.e., (load "startup").  I see that an option for starting Emacs is -nl or --no-loadup; however, neither of those have any affect on OSX.  Is loadup.el perhaps hard-coded into the executable such that a startup option to the contrary has no effect?

I have tried:

/absolute/path/to/Emacs -nl

and

/absolute/path/to/Emacs --no-loadup

I am using OSX, and have a very recent version of Emacs Trunk built from the master branch.


texts:
How can I get a scroll bar in spacemacs?

Simply doing this doesn't seem to have any effect for me:

(scroll-bar-mode t)

In the past, I think I recall enabling it and it having some kind of odd visual effect that didn't really resemble a useful scroll bar, but I can't reproduce that now.


texts: Setf and pushnew do not work on slot "options" of org-export-backend defined by cl-defstruct

texts:
Org-mode export backends are defined as instances of the cl structure org-export-backend:

(cl-defstruct (org-export-backend (:constructor org-export-create-backend)
                  (:copier nil))
  name parent transcoders options filters blocks menu)

The documentation string of cl-defstruct says:

  This macro defines a new data type called NAME that stores data
  in SLOTs.  It defines a make-NAME constructor, a copy-NAME
  copier, a NAME-p predicate, and slot accessors named NAME-SLOT.
  You can use the accessors to set the corresponding slots, via setf.

  …

  Each SLOT may instead take the form (SNAME SDEFAULT SOPTIONS…), where
  SDEFAULT is the default value of that slot and SOPTIONS are keyword-value
  pairs for that slot.
  Currently, only one keyword is supported, :read-only.  If this has a
  non-nil value, that slot cannot be set via setf.

The options slot of org-export-backend is not marked with the keyword :read-only.

Therefore setting backend options with cl-pushnew should work as in the next example Elisp snippet:

(require 'cl-lib)
(with-eval-after-load 'ox-ascii
    (cl-pushnew
     '(:ascii-upcase-title nil "ascii-upcase-title" 'org+-ascii-upcase-title)
     (org-export-backend-options (org-export-get-backend 'ascii))))

But this does not work reliable.
I had to remove it from an answer to a question about the ox-ascii export plugin.

If one calls M-x load-library RET ox-ascii RET after this setting, one gets the error

let*: Symbol’s function definition is void: \(setf\ org-export-backend-options\)

This error presents itself with the following message if one tries to export with org-export-dispatch:

Problems while trying to load export back-end ‘ascii’

What does cause this error? How can I prevent it?


texts: `mu4e-contexts` multiple gmail accounts using incorrect smtp credentials

texts:
I'm attempting to set up multiple Gmail accounts using mu4e-context's. I have a lot of the features working except one. I can switch between contexts, update my mail in each account (using offlineimap) and I can send mail.

The problem is that I have multiple lines in my .authinfo file, that have the same hostname - I was assuming that mu4e would be able to differentiate by username, this appears to not be the case. It doesn't matter which context I am in, the mail is always being sent from the account that is configured first in the .authinfo file.

I don't know how to make each context use separate credentials for logging into the Gmail SMTP Server.

I thought about attempting to set up some hostname aliases so that personal.gmail.com and work.gmail.com both resolve to smtp.gmail.com so that I can give them separate machine names in authinfo, but I am unsure how to achieve this (on OSX) or even if it's a sensible way to solve this problem (Ideally I'd not have to monkey around with config outside of Emacs).

My authinfo looks like this

machine smtp.gmail.com login personal@example.com port 587 password fakepassword
machine smtp.gmail.com login work@example.com port 587 password fakepassword

and the relevant parts of my mu4e-config is:

(setq mu4e-get-mail-command "offlineimap")
(setq mail-user-agent 'mu4e-user-agent)
(setq message-send-mail-function 'smtpmail-send-it)

(setq smtpmail-stream-type 'starttls)
(setq smtpmail-default-smtp-server "smtp.gmail.com")
(setq smtpmail-smtp-server "smtp.gmail.com")
(setq smtpmail-smtp-service 587)

(setq mu4e-contexts
      `( ,(make-mu4e-context
           :name "personal"
           :enter-func (lambda () (mu4e-message "Switch to Personal context"))
           ;; leave-func not defined
           :match-func (lambda (msg)
                         (when msg
                           (mu4e-message-contact-field-matches msg :to "personal@example.com")))
           :vars '(  (user-mail-address . "personal@example.com"  )
                     (mu4e-drafts-folder . "/personal/drafts")
                     (mu4e-sent-folder   . "/personal/sent")
                     (mu4e-trash-folder  . "/personal/bin")
                     (mu4e-maildir-shortcuts . (("/personal/INBOX" . ?i)
                                                ("/personal/sent"  . ?s)
                                                ("/personal/bin"   . ?t)))
                     (smtpmail-mail-address . "personal@example.com")
                     (user-full-name    . "Matt Valentine-House" )))
         ,(make-mu4e-context
           :name "work"
           :enter-func (lambda () (mu4e-message "Switch to Work context"))
           ;; leave-fun not defined
           :match-func (lambda (msg)
                         (when msg
                           (mu4e-message-contact-field-matches msg :to "work@example.com")))
           :vars '(  (user-mail-address . "work@example.com" )
                     (mu4e-drafts-folder . "/work/drafts")
                     (mu4e-sent-folder   . "/work/sent")
                     (mu4e-trash-folder  . "/work/bin")
                     (mu4e-maildir-shortcuts . (("/work/INBOX" . ?i)
                                                ("/work/sent"  . ?s)
                                                ("/work/bin"   . ?t)))
                     (smtpmail-mail-address . "work@example.com")
                     ( user-full-name    . "Matthew Valentine-House" )))))


texts: Internal and External link search broken in org 9.3

texts:
Links seem to be broken in org-mode 9.3

[[link-to-text]]
[[*link-to-heading]]
[[file:path/to/file::*heading]]
[[file:path/to/file::search-string]]

The following searches all bring point to the beginning of the buffers in question, without moving to the searched header or text.

I suspect this has something to do with this change over here:

  Version 9.3 Incompatible changes Change bracket link escaping syntax

  Org used to percent-encode sensitive characters in the URI part of the
  bracket links.

  Now, escaping mechanism uses the usual backslash character, according
  to the following rules, applied in order:

All consecutive \ characters at the end of the link must be escaped;
Any ] character at the very end of the link must be escaped;
All consecutive \ characters preceding ][ or ]] patterns must be escaped;
Any ] character followed by either [ or ] must be escaped;
Others ] and \ characters need not be escaped.

  When in doubt, use the function org-link-escape in order to turn a
  link string into its properly escaped form.

Can someone explain this to me?

The buggy code:

The buggy code is this:

(use-package mandoku
  :config
  (setq mandoku-base-dir "~/krp")
  (setq mandoku-repositories-alist '(("KR" "http://www.kanripo.org/api/v1.0")))
  (defvar mandoku-starter-packages
  (list
  'magit
    'json
    'org 'org-plus-contrib
    'mandoku 'mandoku-meta-kr 'mandoku-meta-zb
    )
  "Libraries that should be installed by default."))

The customized link used by mandoku, [[mandoku:meta:KR2a0007:10]] seems to be interfering with the normal functioning of org-mode links that do text search within buffers.


texts: What's the Emacs package that enables a "mini-mini-map" in the status bar?

texts:
I'm specifically talking about the package Spacemacs enables. It creates a tiny square with a horizontal bar, that goes up and down in accordance with your position in the file you have opened. E.g., if you're halfway down the file, the bar would be in the middle of the square.

Also, there's a number beside the square, with a percentage, giving you what percent down the file you are. So, in the above scenario, it'd say 50%.

Does anyone know what this package is, or how to enable this feature?


texts: How to stop dired printing "Reverting buffer ..."

texts: After setting dired-auto-revert-buffer to t, even when I'm working on a buffer of file that may produce some results, the message keep printing if there is a dired buffer behind current buffer. This is really annoying. How can I completely disable it? Thanks!


texts: Why is the emacs-25.1-2 binary for Windows so big?

texts:
why is it so big? almost twice the size of 25.1
what's new with it?


texts: What's the idiomatic way of writing an Emacs front-end to a command which supports streaming input and output like Telnet?

texts:
I would like to write an Emacs front-end to a server which supports Telnet connections, and I was wondering if there is an idiomatic way of doing this. Specifically, the program will work like this:

Use the telnet function to connect to the server.
Read the output of the telnet command so far, and transform it, and insert it into a buffer. This buffer will be different than the telnet buffer.
Send commands to the telnet server as the user interactively executes functions

What I don't understand is the following:

How can I programmatically read what the server is sending in the telnet process? Right now when I use the telnet function it creates a new buffer and switches to it, which is great for interactive use, but not for programmatic reading of output.
The same for inputting something to the telnet process: how can I send text to it?

I know that a lot of Emacs packages use the command line to do things, but those commands are, as far as I know, pretty straightforward: you run the command, it gives you some output, and then quits. However, in this case the command keeps working in the background, and I need to read its output and send it input.

Thanks!


texts: Is there a way to start org-mode agenda with a custom search?

texts:
I would like to start an org-mode agenda with a custom tag search (rather than starting the agenda and then doing the search).

The overall goal is to make a work and a personal agenda.  I can make the custom search commands easily enough:

(setq org-agenda-custom-commands
      '(("p" tags "-work")
        ("w" tags "+work")))

Normally I get to an agenda with a function like:

(defun just-agenda()
  (org-agenda-list)
  (delete-other-windows))

Is there a way to pass a custom search to the agenda when I call org-agenda-list?  I've seen a bunch of things that seem close in the docs but it feels like I'm missing something for how to do it.


texts: use-package :bind not working as expected

texts:
I frequently work with R and ess, and want to bind a shortcut to a function that clears the R console:

(use-package ess-site
  :ensure ess
  :bind (:map inferior-ess-mode-map
              ("C-c c" . clear-shell)
              )
  )

However, the keybinding is not set when I start emacs. I have to launch an inferior-ess-mode, then go to my config file and evaluate the code above for it to bind the function to "C-c c".

How can this be fixed?

Edit:

It also does not work if I use something that is not bound to anything, like C-c s. Also, there is no difference if I use :bind*. Only after I manually execute the code above it works. Same thing happens if I use another mode map, like ess-mode-map.

Also, the same thing happens with other modes and functions, like this for matlab:

(use-package matlab-mode
  :ensure t
  :config
  (load-library "matlab-load")
  (custom-set-variables
   '(matlab-shell-command-switches '("-nodesktop -nosplash")))
  (add-hook 'matlab-mode-hook 'auto-complete-mode)
  (setq auto-mode-alist
        (cons
         '("\\.m$" . matlab-mode)
         auto-mode-alist))
  (matlab-cedet-setup)
  :bind* (:map matlab-mode-map
               ("C-c C-c" . matlab-shell-save-and-go))
  )

The keybinding C-c C-c only works after manually evaluating the code while the matlab shell is already running. Before that it's bound to the function that it's bound to by default in that mode.


texts:
I work on both work and personal projects on my machine, and for my work projects, I prefer to use my work email, and vice versa.

In shell, I use direnv to set GIT_COMMITTER_EMAIL and GIT_AUTHOR_EMAIL.

How do I achieve something like this in magit?


texts: How to make `company-go` suggest completions from my own code?

texts:
My emacs go-lang setup is more or less the same as https://lupan.pl/dotemacs/.

I get suggestions from company-go for standard library (like fmt for example), but I don't get any suggestions from my own packages (that I am writing currently) whose sources reside in the same GOPATH.

Adding some explanation.  The following is roughly how my code is organised.

My code is in

$GOPATH/src/mydomain.tld/myname/myproject/core/
$GOPATH/src/mydomain.tld/myname/myproject/feature1/
$GOPATH/src/mydomain.tld/myname/myproject/main.go

In main.go, I import code like so:

package main

import (
    "fmt"

    "mydomain.tld/myname/myproject/core/"
    "mydomain.tld/myname/myproject/feature1/"
)

func main() {
      // I expect to get a list of functions inside feature1 package, or at least a list of types in it.
       variable1 := feature1.

}

Any idea can be done to make company-go suggest completions from my own code ? Once again, I get suggestions from standard library packages just fine.

I use emacs-27 on FreeBSD-13.0 (GhostBSD 19.2), go 1.11


texts: python interpreter within emacs fails on simple test on __main__ (syntax error)

texts:
This small program runs well in Terminal :

mac2011% cat bug.py
print(__name__ == "__main__")
#if True:
if __name__ == "__main__":
    print("main")
else:
    print("not main")
mac2011% python bug.py
True
main
mac2011% python --version
Python 3.6.9 :: Anaconda, Inc.

In Emacs:

mac2011% Emacs --version
GNU Emacs 26.3
mac2011% Emacs -q bug.py

the file opens in (Python ElDoc) mode.

Python menu

Start interpreter (C-c C-p)

Eval buffer (C-c C-c)

Python 3.6.9 |Anaconda, Inc.| (default,     Jul 30 2019, 13:42:17)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or     "license" for more information.
>>> python.el: native completion setup loaded
>>> Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/alba/Documents/projets/plot time series/bug.py", line 5
    else:
       ^
SyntaxError: invalid syntax
>>>

Replacing if __name__ == "__main__": by if True:, there is no more error.

Replacing "__main__" by "__main_", there is no error.

Can you reproduce the facts?

Do you have any explanation?

How to repair?

Same with Python 3.7.6.

My emacs comes from Emacs for Mac OS X.

Same with emacs 28.0.50 that I have just built.


texts: What's a good workflow for separating projects from subprojects in org-mode?

texts:
I often find that, using an agenda in block-mode, that my tasks (which are smaller bits of work) are mixed in with my projects (which are larger chunks.) I've wondered if there was a way for a block agenda to list my TODO projects in one block and my tasks (subprojects) in another block.

I've tried using the :PROJECT: tag. The problem is that when I do a regexp for everything that doesn't have a :PROJECT: tag I get things that I also don't want (like deadlines that shouldn't yet show up in the agenda, for example.)

One could define a PROJ state but that seems inelegant -- because it's not exactly a state, but a label. A "project" tag (or property) seems more appropriate.

I'm open to any ideas and I hope this helps other people who may have had the same question.


texts:
I've noticed that if function f is used to advise function g through advice-add, and function f is then redefined, function g's advice is not updated.

After digging into advice-add a bit, it is clear that advice-add uses add-function behind the scenes, which means that it extracts the value in the function cell of f and uses it to advise g. Therefore, when f is redefined, g is not affected.

I'm wondering why such a design decision was made. Is there a good reason that we shouldn't or couldn't allow updating f to update g's advice as well?


texts: Backup saved buffers to Dropbox (or other specific directory)

texts:
Is it possible to customize Emacs so that whenever I save a file, Emacs also copies it to a specific folder?

This directory could be, for instance, D:\my_backups or C:\Users\username\Dropbox\my_backups.

The copy should have the same name as the original file (no appended ~).
If the backup already exists, overwrite without asking.
I want to backup the same version that is being saved, not a previous version.


texts: Put a constraint on defcustom with variable type

texts:
I have a defcustom with :type variable,
and I would like to constrain the variable name to comply to a pattern.

How would I do that?

for instance let say I want the custom to only accept a variable name starting with some prefix.


texts: Retain point in magit while staging hunk by hunk?

texts:
I am trying to stage few hunks of a file using magit.

My point is on first hunk like this

Now if I press s to stage this hunk, it will stage hunk and moves point back to file like this

Now to stage next hunk, again I have to move point to hunk and press s.

Instead of this, if magit can retain point position, it will be much easier for me to stage hunks very easily.

If I remember correctly old magit versions (1.x) had this desired behavior? How can I get back that behavior?


texts: Harvard style citation in org-mode, output problems

texts:
Trying to cite papers in Harvard style by using org-ref (scimax). I found two posts about it in this forum : post#1 and post#2.
The problem that I am facing is that the output of .org file contains 1 or 2 citations in Harvard format and all others are in other format.
Could someone explain me the reason and a proper solution for that ?
My org file contains the following :
#+creator: Emacs 27.1 (Org mode 9.3.7)
#+LATEX_HEADER: \usepackage[round]{natbib}
#+LATEX_COMPILER: xelatex
#+latex_header: \usepackage{harvard}

Some content here ..... and some references [citep:Artetxe2017]. Some other references [cite:mikolov2013exploiting].

bibliographystyle:apalike
bibliography:./ref/references.bib

About the output:
The first reference is outputted properly but the next one is numeric; the only difference between two citations is the first one starts with a capital letter and the other does not. Is this the only problem ?


texts: Combine two directories into a virtual directory and bookmark it?

texts:
How can I define two separate directories, create a virtual directory out of them in dired, and also bookmark that?  I want to launch the bookmark and get the combined view.

I know dired+ has something close, but as far as I can tell, this gives you a list of directories.  Iwant the content of these directories instead.


texts: Org Mode export options: do not export TODO keyword sections

texts:
I read in the manual, and here that

#+STARTUP: overview
#+TASKS: nil

* TODO Config tasks                                                :tasklist:
** TODO todo1
   SCHEDULED: <2020-02-16 Sun>
** TODO todo2
   SCHEDULED: <2020-02-17 Mon>
   :LOGBOOK:
   - State "TODO"       from              [2020-02-13 Thu 01:26]
   - State "TODO"       from              [2020-02-13 Thu 01:26]
   :END:

#+tasks: nil should stop the exporting of todo items. It doesn't using the md backend. What am I doing wrong?

My org export config is as follows:-

** Self documenting config file
   #+begin_src emacs-lisp

    (use-package ox-gfm
      :defer 3
      :after org
      :config
      (defun config-export-to-markdown()
        (interactive)
        (if (and (eq major-mode 'org-mode) (file-exists-p (concat (file-name-sans-extension (buffer-file-name)) ".md")))
            (org-gfm-export-to-markdown)))

      (add-hook 'after-save-hook 'config-export-to-markdown))

   #+end_src


texts: org-clock-sum gets the time logged for a header and all of its children. Is there a way to get the time logged ONLY for the top level header (but not its children?).


texts: Is there a way to show/open a file from a URI/URL

texts:
Is there some way to download and show a file from a URI/URL?

I now I can use wget and then open the downloaded file and I guess I could even try to write myself a small function to do this.

But most likely someone did before me so is there a function/package that will let me get a file from the internets (would be great if it did not save the file somewhere first) and open it in a new buffer?


texts: How can I get C/C++ context-sensitive completion with Company?

texts:
Semantic seems to be able to do this, but I cannot get it to work as I would expect it to.  For example, if I #include "Type.h" and declare Type t, using semantic-complete-analyze-inline when point is after t. consistently gives me the error

  Cannot find types for `Type t'

instead of giving me all of the public (or otherwise appropriate) members of t.

How can I get the result I'm looking for here?  Ideally, how can I use whatever Semantic might provide as a backend for Company?


texts: Can I programmatically get access to the yanked region?

texts:
You are likely to want to do things to the text that you just yanks / pasted (wrap it in brackets etc).

Is there a way to know what you just yanked? If so I would quite like select it (put the mark at its beginning and the point at it's end).

The obvious things that come to mind are advice for the yank functions.... but I'm hoping that there are some magic variables for this.


texts: Org-mode: why do headlines with parenthesis in them change color?

texts:
Here's an example:

* my item (note)

The note causes the text in the headline to change color, from the headline's usual color to my default text color. How do I disable this?


texts: How to communicate package changes to repository users?

texts:
I have a package for interacting with GRASS GIS processes, available on MELPA. The rate of development and number of users are both quite low, so there's no need for a mailing list or any formal communications with my users.

However, I've just introduced some changes to the configuration options that will require some attention from my users - how can I communicate this to them, given that for most of them all they will see is the updated package coming in from MELPA? Is there a way to pass a message on to users that they will see the first time they run code after a certain change has been made? What is best-practice in this regard?


texts: Add a shortcut to change state to TODO and SCHEDULE entry for today

texts:
I'd like to try a new approach to my org-mode and schedule tasks for today every morning. I usually set them to TODO only, but scheduling would also allow me to see how much I procrastinate some of them.

Is there a way to bind those two, so assign a shortcut to switch to TODO and assign SCHEDULED for todays date? Doing this manually is a bit too tedious.


texts:
Some commands use Emacs' minibuffer to prompt for input.

I occasionally do something which moves the focus to another window and away from the minibuffer.  In these cases I cycle windows with C-x o until I regain focus on the echo area or point and click with the mouse.

What's the Emacs command to immediately focus the minibuffer or prompt?

Writing the Elisp to automate this action should be trivial but I'd rather use a built-in command or function if one's available.


texts: Setting up an maintaining my window layout

texts:
I'd like to have my Emacs frame setup with a neotree window on the left, my active source code or text file taking up the majority of window's space.
I'd like to have Emacs put virtually all other windows at the bottom of the window space (messages buffer, REPL's, compilation logs, etc)

I've been researching display-buffer-alist and so forth but I'm new to customizing Emacs so my grasp of terminology my incomplete.

Is there some combination of display-buffer-alist settings or some elisp that can maintain this setup as I work?


texts:
I do not prefer python-mode. I would like a generic way so that I can understand emacs.

I wish the file be saved and python file command then be run as if in a shell.


texts: Emacs shell not picking aliases from bashrc

texts:
NOT Working: /bin/bash: Psu: command not found

M-! cmd Psu

Working

M-! cmd ls

.bashrc

cat ~/.bashrc | grep Psu
cat ~/.bashrc | grep aliases

 alias Psu='sudo pacman -Syyu'
if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases

.bashprofile

cat ~/.bash_profile | grep -A 2 bashrc

if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

.bashaliases

cat ~/.bash_aliases

if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

I've read and followed: https://emacs.stackexchange.com/a/28999/21118

What am I missing?


texts: Can I use formula to manipulate text in org mode table?

texts:
I can use following code to create sum of numbers. But how can I append some text?

#+TBLFM: $4=$2+$1+$3

For example

| 名字   | 内容1        | 内容2                | 结果 results  |
|--------+--------------+----------------------+--------|
| Mr. 域| dear | happy | dear Mr. 域 happy  |


texts:
I want Emacs to default to Emacs bindings, but to be able to define a list of modes in init.el that enable evil-mode.

I want something similar to this:

http://wikemacs.org/wiki/Evil#Enter_an_emacs_mode_in_a_given_state

but in reverse, where evil is explicitly enabled by mode, rather than Emacs bindings being enabled by mode.


texts: How do I install company-mode via `ensure-packages-installed`?

texts:
I use a function, ensure-packages-installed to "bootstrap" packages in my .emacs file. This ensures that if the package isn't already install. The follow is at the top of my .emacs:

;
; Set up Emacs package system.
;
(require 'package)
;(add-to-list 'package-archives
;             '("elpa" . "http://elpa.gnu.org/packages"))
(add-to-list 'package-archives
             '("melpa" . "http://melpa.org/packages/"))
;(add-to-list 'package-archives
;             '("marmalade" . "https://marmalade-repo.org/packages/") t)
(package-initialize)

; fetch the list of packages available
(or (file-exists-p package-user-dir)
  (package-refresh-contents))

(defun ensure-packages-installed (&rest packages)
  (mapcar (lambda (package)
    (unless (package-installed-p package)
      (package-install package))) packages))

(ensure-packages-installed
  'company-mode
  'exec-path-from-shell
  'evil
  'haskell-mode
  'intero
  'idris-mode
  'org
  'projectile
  'solarized-theme
  )

However, when I add company-mode to the list it, I get the following error:

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

error: Package `company-mode-' is unavailable

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.


texts: How can I generate the  HTML tag from org-mode?

texts:
I'm trying to migrate my current blogging platform (Pelican) where I wrote the
posts using Markdown to a one based in org-mode (still considering how).

One of the problems that I found is that I have used the <abbr> HTML tag in
several of my articles --thanks to the Markdown Extra markup *[abbr]: definition
that I could use with Pelican-- but I can not find a way in org-mode to export that
tag.

Is there any way to generate this tag from org-mode?


texts: Magit: Is it possible to edit text directly in "Unstaged changes"?

texts:
Windows 10, Emacs 25.1, Magit

Execute command magit-status and press "TAB".
Here result:

If I want to change this text I go to my editor (e.g. Notepad++) and edit text.

The question is:

Can I directy edit text in magit buffer when files are in Unstaged changes?


texts: How to change the default transient level temporarily? ("Show hidden magit commands")

texts:
Many commands that are rarely used in magit are hidden by default.  Magit uses the transient.el library for popups and the visibility of infix and suffix commands are controlled by transient-default-level.
For example: At the default level (4), magit-branch transient 1 hides orphan, worktree, and shelving suffix commands (levels 6,5,&7 respectively).
I want to invoke the "new orphan" command, but I don't want to persist the visibility of that command or other commands (even for the remainder of the current session).
How can I conveniently change the default transient level temporarily, so that I can invoke a hidden command once?
The two ways I know of are:

Change the transient level for the command using C-xl (transient-set-level), invoke it, and then change it back.

Change transient-default-level programmatically (ex: (setq transient-default-level 6)), invoke the command, and change transient-default-level back.


texts: What's the equivalent of `helm-find` in ivy/counsel? I want to find files **recursively**

texts:
helm-find is

  Preconfigured ‘helm’ for the find shell command

I need the same functionality with ivy/counsel.


texts:
What are the OA and OB inserted by emacs?

It happens, I think, when I press  ESC  several times. I use emacs in the -nw mode.

I would rather do without these insertions.


texts:
I would like to add to the eshell-predicate-alist in my ~/.emacs.d/init.el file as described in https://www.masteringemacs.org/article/complete-guide-mastering-eshell and http://www.howardism.org/Technical/Emacs/eshell-fun.html. However, when I do:

(require 'eshell)
(defun eshell/e (file)
  "Open the FILE in the current buffer."
  (find-file file))

(defun eshell/ee (file)
  "Open the FILE in a new buffer."
  (find-file-other-window file))

(defun eshell/clear ()
  "Clear the eshell buffer."
  (let ((inhibit-read-only t))
    (erase-buffer)
    (eshell-send-input)))

(defun eshell/x ()
  "Exit the shell."
  (insert "exit")
  (eshell-send-input)
  (delete-window))

(defun eshell-org-file-tags ()
  "Help the eshell parse the text the point is currently on, looking for parameters surrounded in single quotes.  Return a function that takes a FILE and return nil if the file given to it does not contain the 'org-mode' #+TAGS: entry specified."

  ;; Step 1. Parse the eshell buffer for our tag between quotes
  ;;         Make sure to move point to the end of the match:
  (if (looking-at "'\\([^)']+\\)'")
      (let* ((tag (match-string 1))
             (reg (concat "^#\\+TAGS:.* " tag "\\b")))
        (goto-char (match-end 0))

        ;; Step 2. Return the predicate function:
        ;;         Careful when accessing the `reg' variable.
        `(lambda (file)
           (with-temp-buffer
             (insert-file-contents file)
             (re-search-forward ,reg nil t 1))))
    (error "The `T' predicate takes an org-mode tag value in single quotes.")))

(add-to-list 'eshell-predicate-alist '(?T . (eshell-org-file-tags)))

I get an error message on startup of Emacs, that the symbol's definition is void for eshell-predicate-alist.

Emacs version is: GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9)

How can I get this to work? At my workplace I have a newer version, where this works without issue, even without the (require eshell) at the top.


texts:
I've been struggling with the basic org-element-parse-buffer (see here) usage. Specifically, how do I make it work? It's not interactive, so it has to be called from within an org-mode buffer, I'm guessing in a source code block. I try this solution:

#+begin_src emacs-lisp
(let ((parsetree (org-element-parse-buffer 'headline)))
  (org-element-map parsetree 'headline
                   (lambda (hl) (org-element-property :title hl))))
#+end_src

#+RESULTS:
| JANUARY | 2018-01-23T16:54:53 | 2018-01-23T19:37:21 | 2018-01-24T02:37:07 |

and get the results in a results table format. Good. But how do I get the whole buffer as an AST (one big nested list) as advertised?

#+begin_src emacs-lisp
(org-element-parse-buffer)
#+end_src

I get org-babel-insert-result: Wrong type argument: markerp, nil

I still have hope that some year I'll be productive with Emacs/org-mode....


texts: how to make `C-l` override `centered-cursor-mode`?

texts:
I love centered-cursor-mode. It keeps my cursor in the center of the screen always.
However, on rare occasions, I need to use C-l recenter-top-bottom to "scroll" in order to view text lower than the center position allows.
In the meantime, I am forced to disable centered-cursor-mode and than use recenter-top-bottom, but I'd really prefer if there was a way to make C-l override  centered-cursor-mode


texts: Changing the name of the function key  leads to problems

texts:
I want to change the name of the function key <mouse-1> like so:
(define-key input-decode-map (kbd "<mouse-1>") (kbd "<jd:m1>"))
And thus bind the new name to an arbitrary function like so:
(define-key global-map (kbd "<jd:m1>") 'mouse-set-point)
But when testing the changes I get this error:

Debugger entered--Lisp error: (error "mouse-set-point must be bound to an event with parameters")
  call-interactively(mouse-set-point nil nil)
  command-execute(mouse-set-point)

Why does this functionality work for all other key functions but not the mouse key functions?
For example this works just fine:

(define-key input-decode-map (kbd "<tab>") (kbd "<jd:tab>"))
(define-key global-map (kbd "<jd:tab>") 'indent-for-tab-command)


texts: How do I get org icalendar export to *not* include the date in the calendar item summary?

texts:
I write my org-mode entries like this:

*** Some Event <2015-10-11 Sun 18:30-19:30>

    Some description

icalendar export used to automatically use "Some Event" as the icalendar item's SUMMARY, but now (somewhere between versions 7 and 8.2.10) it uses all of "Some Event <2015-10-11 Sun 18:30-19:30>" as the SUMMARY string, which is just wrong (it knows that last part is a date and uses it to create the icalendar .

The only way I have found to fix this is to create a SUMMARY property, like so:

*** Some Event <2015-10-11 Sun 18:30-19:30>
    :PROPERTIES:
    :SUMMARY:  Some Event
    :END:
    Some description

This is, however, awful for maintenance, because now I have to write and/or edit "Some Event" in two places.

Is there a way to have the date automatically excluded from the summary?


texts:
To use directory-files-recursively in Emacs 24.x, I'm adding the following to a file cider-compat.el:

(eval-and-compile
  (unless (fboundp 'directory-files-recursively)
    (defun directory-files-recursively (dir regexp &optional include-directories)
      ...)))

Byte-compiling the file, however, gives an error in Emacs 24.x:

In toplevel form:
cider-compat.el:191:1:Error: the function `directory-files-recursively' might not be defined at runtime.
make: *** [cider-compat.elc-test] Error 1

Why is this? The eval-and-compile seems to work fine for other defuns, e.g. internal--build-binding.


texts: magit "empty ident name (for ) not allowed" on commit

texts:
On Windows 10, after staging a file in magit and attempting to commit it I get this error message instead

empty ident name (for <(null)>) not allowed


texts: Prevent AucTeX from changing font within some tags

texts:
When I'm using AucTex, I tend to have problems with how the package formats the fonts I use within tags such as \textit{}. It appears that AucTeX wants to display an italicized version of the buffer's font, but if it does not exist, I get some garbage characters.
[
Is there some way I can prevent AucTeX from requesting a non-existent italic version of the font I'm using when I use these commands?


texts: Org-mode tables exported as latex arrays within eqnarray environment, how?

texts:
If I have constructed a blocked array using an org-mode table, I can easily export the table as, e.g., a pmatrix array as presented below. However, the pmatrix is exported within a math environment (\[..\]). How can I change that to, e.g., an eqnarray environment in order to attach an equation reference?

So, I have this code:

#+ATTR_LATEX: :environment pmatrix :mode math :math-prefix N= :math-suffix ,
| A   | B |
| B^T | D |

which is exported to

\[
N=\begin{pmatrix}
 A & B \\
 B^T & D \\
\end{pmatrix},
\]

I wish to replace the \[..\] by eqnarray, i.e., produce

\begin{eqnarray}
N=\begin{pmatrix}
 A & B \\
 B^T & D \\
\end{pmatrix},\label{eq:normal}
\end{eqnarray}

Is this possible using org-mode options or do I have to re-write the back-end? If so, where in the back-end should I start?


texts: How to set emacs to recognize backtick and tilde with a Colemak keyboard layout?

texts:
I've just installed emacs 24 on my Windows 7 32-bit OS. Usually, I activate Colemak keyboard layout and use it to do all sorts of typing (in browsers, spreadsheets or word processors). It works fine and has tilde (~) and backtick (`) on a key in the top left corner of the keyboard, between the Esc key and the Tab, at the left of key 1.

In emacs, most of the Colemak keys are recognized but that key doesn't work. If I press it, emacs' cursor stops blinking and after 4-5 seconds types 'sssssssssss' or whatever alphabet key I pressed after that key. For now I've managed to get tilde to work by putting (set global-key [f2] "~") and was thinking of associating F3 with backtick, but I was wandering if there's a way to make emacs recognize that key. That way I would get backtick by pressing the ordinary key and tilde by pressing it in combination with Shift.

EDIT

I have downloaded the Colemak layout from the official Colemak Forum that caters to all users, whether on Windows, Linux or Mac. A zip file can be downloaded from section [5.1 DOWNLOAD AND INSTALL] of a thread titled "DreymaR's Big Bag of Keyboard Tricks - PKL/Windows Edition!". The decompressed zip file has some folders and files inside, among them a pkl.exe. I have placed a shortcut to this file, next to Windows' "Start" button and everytime I log into my OS I double click it and launch Colemak. The 2 most important files contained in the zip file are pkl.ini and layout.ini, the latter being inside layouts > colemak-eD_ISO folder.

pkl.ini allows one to set the locale or language of the keyboard by adding this line layout = colemak-eD-Lat_ISO:Colemak[eD]-ISO-It and commenting out any other similar lines so they don't interfere. The layout.ini allows you to customize certain keys. I, for instance, tweaked it to allow CapsLock to write capital letters just like it does in QWERTY.

Below are 2 "Display help images" that come with the colemak bundle. The first is Ordinary keyboard, the second one shows changes as Shift is pressed. They resemble very much my keyboard layout. As it turns out, it's the top left corner key that doesn't get recognized by Emacs.

EDIT 2

The main reason why I need backtick to be recognized is so that I can use keyboard shortcuts in AUCTeX to get Greek alphabet. By default, to get the Greek letter alpha you can press backtick and a. This spurs EMACS to immediately substitute 'a' with 'α'. That's the use behind my question. I tried to work-around this problem by adding this line in my .emacs file: (setq LaTeX-math-abbrev-prefix  "'") but writing words such as didn't or ain't became problematic since EMACS kept substituting the single quote followed by letter 't' with Greek letter 'tau'.


texts: Cannot set sql-buffer variable from within a SQL buffer

texts:
I'm trying to link a SQL buffer to SQLi buffer by calling sql-set-sqli-buffer but nothing happens when the function is called. I'm doing this because I want to start muliple SQLi buffers with each of them having their own SQL buffer linked as instructed in C-h f sql-interactive-mode:

  Sample session using two connections:

  Create first SQLi buffer by calling an entry function.
  Rename buffer "SQL" to "Connection 1".
  Create a SQL buffer "test1.sql".
  Create second SQLi buffer by calling an entry function.
  Rename buffer "SQL" to "Connection 2".
  Create a SQL buffer "test2.sql".

I did exactly as described above but it doesn't work for me. The linkage is lost when the SQLi buffer is renamed to what other than *SQL*. Apparently the linkage is maintained by a local copy of the variable sql-buffer but the instruction above doesn't seem to reflect how this varaible is set. So I try to do this manually by calling sql-set-sqli-buffer and it still doesn't work.

The version currently used is Emacs 26.2.


texts: An efficient set data structure in elisp

texts: Does elisp provide a builtin efficient set data structure, similar to set in Python and std::set in C++?


texts:
Wanderlust uses "mime-view" internally for displaying mail messages. Sometimes "text/plain" messages actually have very long lines (like "text/flowed".

If in mime-view I toggle visual-line-mode message is displayed correctly. I've tried to add the following hook:

(add-hook 'mime-display-text/plain-hook
  (lambda ()
    (visual-line-mode t)))

Unfortunately it doesn't work - visual-line-mode is set, but message is still displayed unwrapped. Any ideas how that could be solved?


texts: How can I search between the lines with multiline search?

texts:
I use C-u 4 M-x helm-swoop for interactive search also show several surrounding lines (this is analogous to grep -C 4).

When I find the word I narrow my search interactively, for example,
C-u 4 M-x helm-swoop foo bar
And this is analogous to grep -C 4 foo files | grep bar.

I want to narrow my search more and search only code between the lines #+BEGIN_SRC python and #+END_SRC.

#+BEGIN_SRC python
    search this code with "grep -c"
#+END_SRC

How can I do it with helm-swoop or helm-occur? Is there another solution?


texts:
Background:

I use gnus under emacs -nw (so this question is about text-based usage, not the GUI).  Depending on the value of the $TERM environment variable, gnus will, for example, highlight quoted text in articles, using different colors depending on the depth of quoting (the number of > characters at the beginning of each line).

I personally prefer plain black text on a white or light background. I usually run emacs -nw in a terminal emulator with color disabled; in that case it isn't an issue.

But for some ssh clients on mobile devices (particularly JuiceSSH on Android), there doesn't seem to be a way to disable color in the terminal emulator. And the default color scheme seems to assume I have a black background; since I use a white background, yellow text is essentially illegible.

One workaround I've found is to set $TERM to vt100, but that requires quitting and restarting emacs.  (I run it under GNU screen, so I commonly view the same Emacs session on different terminal emulators.)

Finally, the question:

Is there a command or configuration option in emacs or in gnus to tell it not to use color highlighting without quitting and restarting either emacs or gnus? A global configuration for emacs would be ideal, but something specific to gnus would do nicely.

If that's not practical, a decent backup solution would be a straightforward way to use a color scheme that's legible on a white background.


texts: I would like to perform significance arithmetic in calc-mode. For example, I want 5000 to have one significant figure, and 5.0e3 to have two significant figures. Calculations should preserve significant figures according to the rules of significance arithmetic. How can I accomplish this?


texts: How to use emacsclient in terminal to switch git branches?

texts:
I'm trying to make a setup that will use emacs as a command line tool to switch git branches.

The idea is to run some command in terminal, something like emacsclient -t -e "(magit-checkout)". This will run emacs window with (magit-checkout) command executed in my terminal. I can then select a branch from the list, press enter, emacs will then checkout this branch, window will close and I'm back to my terminal.

I can't make it work though, running emacsclient -t -e "(magit-checkout)" just flashes emacs window in my terminal and closes it immediately. It works almost as I want it to work with (magit-commit) command (the only thing that doesn't work is that emacs window won't close after the operation is done). But it doesn't work with (magit-checkout). Is there any way to make it work the way I described?


texts:
The sheer number of backslashes my regexps require is pretty crazy. Does elisp have regexp literals, so I can write something like

rx"some\(regexp\)"

instead of

"some\\(regexp\\)"


texts:
I work mainly with javascript and typescript. And I have enabled lsp-mode  in Doom Emacs. But I am not very happy about the descriptions and information shown to me on hover. It is not very useful and its spread out in opposite corners of the window.

take this example when I hover over .get() - emacs vs vscode.

VSCode show me that the parameters is of type <P ResBody, ReqBody> whereas Emacs give me <ParamsDictionary, any, any>

In Emacs I have "to go definition" to get that more precise/accurate information.

I don't really understand what controls this behaviour, lsp-ui or something else? If someone have some good information or link on how to make this in my eyes slight more useful.

Thanks


texts:
windows 10, emacs 26.1.

To highlight symbol I use package highlight-symbol

http://nschum.de/src/emacs/highlight-symbol/

Nice.

But I need symbol "=" to be a separator.

As you can see the test=this is highlight. But I don't like this. I need to highlight only word test. Of course I can press SPC between test and =. But it not comfortable. Suppose I have 100 symbols =.

Same result in text-mode:

Has any alternative for this package? Better that this package.


texts: `find-grep` (aka `grep-find`) not finding a line when in an upper directory

texts:
[Top-posting an update] Results of deeper inquiry, after filing a bug report. It appears that the failure is related to a recent update to the cygwin environment. Where previously the single-quoted parameter '*.log' to the -name option to find was passed to find as a single-quoted '*.log', the current behaviour has that '*.log' expanded to a list of files if there are .log files in the directory in which the find-grep is started.

Changing the invocation to

find . -type f -name \\*.log -exec grep -nHE 'ERROR:' {} \;

causes the literal *.log to be passed to find as desired. More research will be needed to find exactly where the name expansion is happening, but for now this works.

**** end of top-posted update ***

GNU Emacs 24.5.1 (i686-pc-mingw) with a cygwin environment installed at C:/cygwin64 on a Windows 7 machine.

M-x find-grep (aka grep-find), then:

find . -type f -name '*-2017-12-12_09.22.57.log' -exec grep -nHE 'ERROR:' {} \;

finds a number of ERROR: lines in various .log files at various depths in the directory hierarchy where I am working.

One particular file with an 'ERROR:'

./PFF/PFF/PFF.bat-2017-12-12_09.22.57.log

is not found unless I change down a directory level, starting in ./PFF, or unless the parent directory name is [at least] one character longer or shorter (but see below.) e.g. the ERROR: line is found in

./PFF/PFFm/PFF.bat-2017-12-12_09.22.57.log

or in

./PFF/PFF-/PFF.bat-2017-12-12_09.22.57.log

but never in

./PFF/PFF/PFF.bat-2017-12-12_09.22.57.log

whether the original ./PFF/PFF directory is renamed or copied to a [longer-named] parent (when copied, I have both ./PFF/PFF and ./PFF/PFFx directories.)

Then it gets weird - if I have a copy of the ./PFF/PFF directory named ./PFF/PF or ./PFF/P, the ERROR: lines in both copies of the .log file are found (one in each of the directories;) if the duplicate directory is named with three or more characters (e.g. ./PFF/PFM) the original ./PFF/PFF log file is not found (or grepped; not sure yet which.)

It might be worth mentioning that the ./PFF directory does have two other subdirs in addition to ./PFF/PFF (./PFF/PFF_FILE_HANDLING and ./PFF/PFF_CAPTURE_FF) so it doesn't appear that the problem is that ./PFF/PFF is all alone.

find . -type f -name '*-2017-12-12_09.22.57.log' -exec grep -nHE 'ERROR:' {} \;

at the command line works as expected.

Now, I'm leery of find-grep (one of my go-to tools.)


texts: GNUS says sending email failed, but mail was sent [Unable to open server nnimap]

texts:
I have tried solve this for many many hours ;(
macOS 11.1, Emacs 27.1 (brew), Gnus 5.13, msmtp 1.8.14 (brew)
I use GNUS to read maildir that is synced using mbsync. I can read mail using GNUS but sending gives me
Warning: Opening nnimap server on office365...failed: ; Unable to open server nnimap+office365 due to: office365/imaps nodename nor servname provided, or not known
Sending...
Sending via mail...
Opening nnimap server on office365...
Server nnimap+office365 previously determined to be down; not retrying
Opening nnimap server on office365...failed:
gnus-inews-do-gcc: Can\u2019t open server archive

The mail is sent but GNUS think it is not. I can send email from the command line without any error or warning, so this should not be a msmtp configuration problem
cat msmtp-test.txt | msmtp -a default my.mail@gmail.com

The msmtp exe pointed out by the sendmail-program is verified to be used. I tried just about everything, the simple
(setq sendmail-program "/usr/local/bin/msmtp")
(setq send-mail-function 'message-send-mail-with-sendmail)
(setq smtpmail-debug-info t smtpmail-debug-verb t)

and many other settings I found on various pages.
Any hints what is going on or how to debug this is appreciated,
kent


texts: I'm on Prelude, and there is no way I can type a \. I was thinking maybe I should create a keybinding but I don't know how to create it to output a character such as \. Any help welcome! Thank you!


texts: How to use org-drill to memorize org-drill?

texts:
Say I want to memorize the cloze deletion syntax of org-drill by this topic,

The problem here is when the answer is revealed the text is only displayed partially like it's been interpreted as a cloze deletion.

Any tricks or suggestions on this kind of "meta" stuff ?


texts: After a crash, I can recover-this-file, but, if I don't know which of many files may have been unsaved at the time of the crash, how can I find out?  Can I recover them all in one go?


texts: Does `car` on an non-lazy function generated list evals the whole list?

texts:
I want to get in a huge directory the first file which satisfies some condition, something like

(require 'seq)
(require 'f)

(defun lazy-filter-file (pred path)
  (car (seq-filter pred (f--files path t))))

(setq fake-filter-file-fn (lambda (x) x))
(lazy-filter-file fake-filter-file-fn path)

And I want to know whether f--files will walk the whole directory, or just find the first file which satisfied the condition and stops. And can you also explain why?

If not lazy, how can I make it lazy?


texts: esc-right and M-right function differently in org-mode headers

texts:
I'm on macOS 10.12.5 and Emacs 25.2.1. For some reason M-right is interpreted as M-f. ESC-right is correctly interpreted as ESC-right. I can't see anything in the macOS keyboard shortcuts list that might be capturing M-right/left. How might I figure out what's going on here?

I ended up switching to mitsuarhu's Emacs osx port instead, which doesn't have this problem. I noticed that terminal Emacs in iterm2 also doesn't have this problem. I guess terminal.app is capturing M-right and turning it in to M-f for some reason.


texts: org: Internal link with automatically updating description, is it possible?

texts:
I use the CUSTOM_ID property for internally linking to headers.
When I insert a link somewhere, I can either:

leave its description empty, which results in the buffer showing #<id>; or
put the header manually as the description, but if I ever change the header the description won't sync to match.

Is it possible to leave the description empty, but have the buffer show the header?
Even if it requires some manual "refresh" or reloading the file (revert-buffer) for the descriptions to update, I would be happy.

BTW, I'm using spacemacs, though I don't think it's relevant.


texts: Enable mode if file content contains a matching string

texts: I would like to enable rjsx-mode whenever a file I open contains a specific string, or a regex like import.*react for example. Is there a way to do something like this in emacs?


texts: Git commit uses fundamental mode after magit update

texts:
I recently updated magit to 20151025.1115, which gave me a message about git-commit-mode incompatibility.  I now, instead, have a package git-commit at version 20151022.933 (from the magit project) installed alongside magit, both through the M-x list-packages interface).  In my global git config, core.editor=emacs -nw.  My emacs is  version 24.5, compiled from source (Gentoo linux).

Before this update when I ran git commit from a terminal (outside of emacs), I would get an emacs instance in a mode aware of git commits -- "syntax" highlighting and C-c C-c to commit.

After this update when I run git commit, the emacs window is in Fundamental mode.  I can still commit with C-s C-x but the mode is not git aware and I lose helpful text coloring of my commit message.

What do I need to change to get my terminal-launched commits to use a git-aware mode for commiting?   Commiting within magit works as expected, I am just trying to "fix" the behavior from a git-launched emacs -nw session.


texts:
Especially when copying text from things like Google docs, I would like Emacs to automatically remove smart double quotes, smart single quotes, and all manner of em-dash and en-dash characters, replacing them with their ascii equivalents.

Is there a way to configure Emacs to do this automatically? Or, baring that, a function I can call that will do it on the buffer or region?


texts: How can I read -mdoc /-mandoc man pages using `M-x woman`?

texts:
I have been successfully using M-x woman to access the linux man pages.
But when I tried to read the tmux manpage using woman, it did not work.
But M-: (man "tmux") works.
Using woman to access tmux man page gave me this error

WoMan formatting buffer...
woman-decode-region: WoMan can only format man pages written with the usual `-man' macros

and the man page shows up without any formatting as below:
.Dd $Mdocdate: March 25 2013 $
.Dt TMUX 1
.Os
.Sh NAME
.Nm tmux
.Nd terminal multiplexer
.Sh SYNOPSIS
.Nm tmux
.Bk -words
.Op Fl 2CluvV
.Op Fl c Ar shell-command
.Op Fl f Ar file
.Op Fl L Ar socket-name
- snip -

Later I learned that that's because the tmux man pages are generated using a new -mdoc macro instead of the -man macro.
Is there a way to read -mdoc generated man pages using woman? I prefer that vs doing M-x man because the cache generation for completing-read is much faster and accurate with M-x woman.
I am using the latest versions of tmux (2.1+) and emacs (25.0+) from the master branches of their gits.


texts:
I am trying to delete a file that is owned by root from Emacs dired opened as a regular user.

I get the following error:

(file-error Removing old name Permission denied /opt/file)

How can I execute this command with root privileges?


texts: How to find files by content across lines with helm

texts: Within helm I'd like to find all of the files that have the content 'foo' and 'bar', even if 'foo' and 'bar' are on different lines.


texts: orgmode - calculate difference between two remote tables

texts:
I use below code to calculate the difference between two columns from remote tables but the output is all zero!
#+name: tbl1
| x |
| 1 |
| 2 |
| 3 |

#+name: tbl2
| y |
| 1 |
| 1 |
| 1 |

#+name: tbl3
| diff |
|    0 |
|    0 |
|    0 |
#+TBLFM: @2$1..@>$1=remote(tbl1,$1) - remote(tbl2,$1)


texts:
I am using Emacs 24.3.1. on Ubuntu.

I am trying use compile in emacs: (M-x compile), I choose my Makefile.

It answered me -*- mode: compilation; default-directory:"path" -*-
Compilation started at Wed Nov  9 10:48:00. status is Compilation:run, I wait, wait and it will never say nothing more. To leave this process I must kill it.

My Process List:
compilation     run     compilation   /dev/pts/14  /bin/csh -c make -f ../Makefile

When I run it from terminal everything works.

I did one test more I run grep function (M-x) grep -nH all "main" ./* . It is the same problem. Grep:run Compiling but I don’t have any results and a grep process is running. To leave this window again I must kill it.

I sure that any packages don’t have impact.

Did someone have similar problem? Can you share how to repair it?


texts:
Suppose I have an org-table like this:

| 2018-09-09 |        |        |        |        |
| 2018-09-10 |        |        |        |        |
| 2018-09-11 |        |        |        |        |
|          X |        |        |        |        |

X marks the location of the caret. If I invoke org-table-copy-down (shift+enter) 1998 will be inserted in the current cell. I suppose because 1998 = 2018-9-11. How can I get it to insert 2018-09-12 instead? I'm hoping that org-mode can be smart enough to understand that the column is about dates.


texts:
In a situation where Emacs is not behaving like I want, what can I do to troubleshoot the problem? What steps can I take to find and fix the problem myself?

Or, failing that, how can I gather useful information that so that people here (or on the mailing list or other forums) can help me with my problem?

My Emacs includes many packages, a collection of snippets copy & pasted (or killed & yanked) from all over the internet, and my own custom elisp, some of which I don't recall writing, or no longer understand. Is there a way to make sense of all of these complications?


texts: Storing and Loading Non-Static/Multiple Configs

texts:
I'm writing an emacs wrapper to a set of scripts that require a lot of config settings to run.

These can be variously environment variables, command line parameters and so forth.  They should be user visible and tweakable.  They will store things like a bunch of directory locations for data files and config switches to be passed into the underlying tool.

If these were fairly static options I'd make each option customizable and create a specific group to hold them, just like other emacs config.

The difference I have is that I may want to have several different configurations that I switch between regularly - perhaps several times a day.

It doesn't feel like making these customizable options is perhaps the right way to store them.  To me customizable variables have a single copy stored and change infrequently (in my custom.el file)?

I could instead store all these values in a non-emacs solution such as an ini or yaml file and load the yaml as part of wrapper prior to executing the script.

But I was wondering if there is a more emacs-standard way of maintaining multiple custom configs that can easily be switched between?

The only thing I can think of is to use defvar with a * in the doc-string to make variables change-able using set-variable.  This doesn't presume they are set in a specific place like the normal use of customize.  However this is perhaps now deprecated in favour of customize?

I guess in this case each config file would be an e-lisp file setting each of these options.  This doesn't feel much different from having the options as standard lisp global variables however.

Any advice or ideas how to achieve this?  Perhaps custom is the right tool and I have misunderstood its purpose or there is something else?


texts: How to format shell commands run from Dired?

texts:
I want to execute a formatted shell command on a file from within Dired. I am aware that I can use dired-do-shell-command to run a shell command on a selected file file by entering

! <command>

to run

<command> file

Ideally I want to run

! <command> file <additional-arguments>

In other words I want to be able to specify where in the command file appears. I tried running

! <command> {} <additional-arguments>

and reading the doc for dired-do-shell-command, but neither of those gave me the solution to achieve this.


texts: How to debug emacs config / need to rerun org-mode after startup

texts:
I run emacs on Windows and I start with this command:
C:\path-to\emacs.exe -q --load "C:/path-to-git-tracked-config-folder/.emacs" --debug-init

Emacs starts without error from --debug-init.
When I open a .org file the major mode is set correctly to org-mode.
But some essential settings are not applied untill I manually run M-x org-mode (font settings, hide the stars and activate org-bullets). Also the agenda is empty untill the manual run.
How can I track down the bug in my config responsible for this behaviour?


texts:
emacs version 26.3 OSX 10.14.1
Following is my .init file. It is present at ~/.emacs.d

(require 'package)

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

(package-initialize)
(add-to-list 'load-path "~/.emacs.d/elpa/") ;; on may 01 2020
(require 'popup) ;; dependancy
(require 'auto-complete)

(setq backup-directory-alist `(("." . "~/.saves"))) ;; this work totally fine

In my home directory ~/.emacs.d/elpa is present

How do I enable that auto-complete works?

I don't know if the path for elpa is being read although I've added it to the list.


texts: Align vertical columns of numbers on the decimal point

texts:
I wrote this post in Emacs. In order to make the tables look nice, I decided to adjust the spacing so that decimals line up neatly. The original format from the database looked like this:

emacs                11505 227          3.6       3.3         1.9         68.9          93.5        68
vi                   1087  289          11.1      6.9         2.9         71.7          96.2        9
wolfram-mathematica  2993  360          4         2.2         1.9         66.7          92.5        51

That's pretty close, but I want the columns right justified and all the ones digits lined up.  The fourth column should look like:

 3.6
11.1
 4

I played around with the align commands and could not find a way to automatically align the table on the (optional) decimal point. For some reason, these instructions fail to align anything at all:

  Figures can also be lined up with respect to the decimal point, using M-- M-x align.


texts: Org export: Specifying common image properties for html and latex

texts:
Suppose I want to have the same image attributes for HTML and LATEX export I have to specify them twice as in the following example:

#+CAPTION: Example image
#+ATTR_HTML: :align center :width 100px
#+ATTR_LATEX: :align center :width 100px
[[file:image.png]]

Is there also a way to specify the attributes just once such that it applies automatically to both HTML and LATEX export.


texts: Global semantic summary mode not enabled at startup

texts:
I have used customize-group on semantic to set global-semantic-idle-summary-mode to t. My .emacs has this entry in custom-set-variables : '(global-semantic-idle-summary-mode t).

However, on starting emacs and opening a C++ source file, I don't see the idle summary at point.
On disabling and re-enabling idle summary mode with two calls to M-x global-idle-summary-mode, the summary items start showing up.

How do I set this up correctly?


texts: How do I define a function to execute as a command with M-x?

texts: I wish to M-x my-func and let my code run. This seems basic but where can I get more documentation about this, if possible inside emacs itself?


texts: org src block php formatting adding commas to phpDoc

texts: In the editing mode (C-c ') I formatted php code using TAB button. But in org mode src block it adds 2 comma to phpDoc.


texts: orgmode - summary table as different group from input table

texts:
I need to summary a table according to one column and sum the specific rows of another column.

e.g. The summary table is generated from the input table. input table column 1 grouped to IN and OUT, column 2 is the sum of IN or OUT columns.

#+NAME: summary
| Item  | Value |
|-------+-------|
| IN    | $5.0  |
| OUT   | $7.0  |
| Total | $13.0 |

#+NAME: input
| Item | Value |
|------+-------|
| IN   | $1.5  |
| OUT  | $2.5  |
| IN   | $3.5  |
| OUT  | $4.5  |
|------+-------|

#+BEGIN_SRC elisp :results output :var input=input
(let (item (in 0)(out 0))
  (dolist (line input)
    (setq item (car line))
    (setq val (string-to-number (substring (cadr line) 1) 10))
    (if (string= item "OUT")
        (progn
          (setq out (+ out val))))
    (if (string= item "IN")
        (progn
          (setq in (+ in val)))))
  (print in)
  (print out)
  (print (+ in out))
)
#+END_SRC

#+RESULTS:
:
: 5.0
:
: 7.0
:
: 12.0

Currently, I use elisp to calculate it but I know formula maybe better but I don't know how to do it!


texts: Matches from re-builder different from re-search-forward and search-forward-regexp due to double backslash

texts:
Following Org mode refiling gobbles a newline and absorbs the next heading where Org mode refiling has gobbled some of the next heading, I want to search for those gobbled headings where the stars are not preceded by newlines. I wrote this regular expression with re-builder:

[^
\\*]\\*

It shows 16 matches and I confirmed that some are relevant. But search-forward-regexp with the same expression matches every character. I suspected it was due to escaping the backslash in the re-builder literal, which uses double-quotes, and search-forward-regexp with

[^
\*]\*

works to find lone stars.

I did not see double backlashes in the manual page.

Why does this happen, and when do backslashes need to be escaped?


texts:
Is it possible to disable ivy-mode for file prompts?

In a past I used find-file to copy current file name or path to file.

dired-do-rename also is broken by Ivy: no default completion for current file + editing key binding extremely altered / navigation disabled...


texts:
I checked my ess/lisp/ess-mode.el file and it has the line of code I'm expecting for this to work (below). Anyone know why this would happen?

(define-key map [(control return)] 'ess-eval-region-or-line-and-step)


texts: Line/word selection with emacs -nw and word wrap

texts:
When I attempt to select a line with emacs -nw that is word wrapped I only get the first part of the line.

However when I try and select the same line in vi I get the desired behavior

In addition.  If I select both lines and try and paste the command into another window I get the line break which breaks the command.  VI does not do this.  I have tried using
(setq term-suppress-hard-newline t) with Wmacs 25.1 but no luck.
This is happening in an xterm.


texts: How can I get sessions.el to save my registers?

texts:
I am trying to get session to work, and I am especially keen on having my registers persistent between sessions. I installed the package sessions.el via Melpa (M-x list-packages) and I added this to my .emacs

(require 'session)
(add-hook 'after-init-hook 'session-initialize)

and I also added this as recommended in the session.el file (even though desktop is not enabled)

(setq desktop-globals-to-save '(desktop-missing-file-warning))

This doesn't seem to be working though. I tried saving my registers but they are not persistent across sessions. I tried changing the value of session-globals-include via M-x customize-group RET session RET to include register. This is what emacs added to my .emacs file after the changes in custom

 '(session-globals-include
   (quote
    ((kill-ring 10 nil)
     (session-file-alist 100 t)
     (file-name-history 200 nil)
     search-ring regexp-search-ring
     (register-alist 100 t))))
 '(session-use-package t nil (session)))

Still, when I try to invoke a register using C-x r j r (the set register from the previous session), it says "Register doesn't contain a buffer position or configuration". I am not even sure anything is being saved between sessions. What am I doing wrong?


texts:
How do you hide columns when inside the ibuffer window?

I don't want to see

Size
Mode
Name

Sometimes I just want to see only the column Filename/Process

What I tried:  googled ibuffer hide columns


texts:
There is some support for defclasses as alists in EIEIO but I was wondering if there is any support to read/write a defclass as a property list (plist)?

e.g. using the example

(defclass record () ; No superclasses
  ((name :initarg :name
         :initform ""
         :type string
         :custom string
         :documentation "The name of a person.")
   (birthday :initarg :birthday
             :initform "Jan 1, 1970"
             :custom string
             :type string
             :documentation "The person's birthday.")
   (phone :initarg :phone
          :initform ""
          :documentation "Phone number."))
  "A single record for tracking people I know.")

it would be good to be able to create an instance of this class and then be able to marshall it into a plist (e.g. for over-the-wire transfer)

(:name "Sam" :birthday "Jan 1, 1980" :phone "0123456789")

and be able to do the opposite: take a plist (and the class name 'record) and turn it into an instance of record.

There is some ambiguity around using the slot name, initarg, or accessor name,  so I'd suggest just using the initarg for everything to be consistent.

When there is a hierarchy involved, it would be good to include the name of the class in the plist, e.g.

(:type 'record :name "Sam" :birthday "Jan 1, 1980" :phone "0123456789")

I am only really looking for support for Algebraic Data Types: products (simple classes) and coproducts (children of a parent, sealed traits in scala terms).


texts: emacs not opening PDF files in external viewer

texts:
I have configured Emacs to open certain file types with external viewers:

(progn
    (require 'openwith)
    (openwith-mode t)
    (setq openwith-associations '(("\\.pdf\\'" "evince" (file))))
    (setq openwith-associations '(("\\.jpg\\'" "eog" (file))))
   (setq openwith-associations '(("\\.png\\'" "eog" (file))))
)

While eog file types are indeed opened with the eog program, when I navigate to a PDF file (with C-x C-f) this is what I see:

In contrast, when I navigate to png files they are opened in an external eog viewer as intended.


texts: How to display whole words as a different symbol?

texts:
In this video (time-linked, only a few seconds) the word function is displayed as f, but can still be edited so the underlying text remains as-is.

How can this be done in emacs? (using plugins or built in features).


texts: What is the error in this org mode code?

texts:
Code :

#+OPTIONS: num:nil
#+OPTIONS: toc:nil
#+LATEX_HEADER: \pagenumbering{}
#+LATEX_HEADER: \usepackage[right=1.5cm]{geometry}
#+TITLE:
#+BEGIN_FLUSHRIGHT

Manoj

DOB: XX XX 1987

PH 123456789

{{{date}}}

#+END_FLUSHRIGHT

* Past, Medical and Personal History  Patient complained of constipation since 2 months.  Patient is getting infrequent stools with frequency of * . Type of stool according to Bristol scale:  II  . Patient is getting pain during defecation. Patient noticed bleeding seperate from the stool .  Patient gets abdominal discomfort when constipated and feel better after defecation .
* History mnnmnm   Mucosal breaks more than 5 mm long, none of which extends between the tops of two mucosal folds suggested grade B reflux esophagitis by LA classification.
* Examination
- jhj
- hjhj
- jkjk
* Investigations    hjhjComplete blood count, s creatinine, Serum sodium and pottasi

* Rx

1. abc  20 mg 1 tab  20 minutes before breakfast once daily

2. cde  20 mg  20 minutes before breakfast once daily (1-0-0-0)  x

Error:-

    Debugger entered--Lisp error: (void-variable Pas)
  eval(Pas nil)
  eval-last-sexp-1(nil)
  eval-last-sexp(nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)

Intermittently it exports to pdf through latex correctly, but mostly fails.

Details
Windows 7
Emacs GNU Emacs 24.5.1 (i686-pc-mingw32)
Org Org-mode version 8.2.10 (release_8.2.10
Kindly help


texts:
I am new to emacs and would like to make a simple function to automate a series of commands I use repeatedly.

In auto-fill-mode after I edit the text I often need to re-wrap the lines. (I am writing in LaTeX with each sentence starting on a new line.) To do this I type M-a,C-SPC,M-e,M-q. This is equivalent to backward-sentence, set-mark-command, forward-sentence, fill-region.

How can I wrap these together in one simple command?

This is my non-working attempt:

(defun fill-sentence()
  "In auto-fill mode, select current sentence and re-wrap it."
  (interactive)
  ((backward-sentence)
   (set-mark-command)
   (forward-sentence)
   (fill-region)))


texts: Unicode and `url-unhex-string` and something like \345\205\266\344\273\226

texts:
I need to use Emacs built-in url.el url-unhex-string to decode uri (e.g. /%E5%85%B6%E4%BB%96/other)

It works, but all non-ascii (I guess it should be Unicode) characters are all converted into integers with backslashes (e.g. /\345\205\266\344\273\226/other

Can I encode these integers back to correct characters? Emacs built-in function is prefered.


texts: How do I center text when exporting an Org file to an .odt file?

texts:
I would like to know how to center the text in a file exported from Org-mode to .odt

Example of what I want:

* TODO center text

--->

                               * DONE center text

Bonuses if it will automatically center when I type, or press enter.

Edit: I want to do this and then export to odt.


texts: How do I do simple addition in org mode?

texts:
I have heard that you can do math in org-mode through tables, but looking it up comes up with things about LaTeX and other confusing subjects.

This is what I want to do:

|   |   1   |      2     |   3  |
|a.b| a1+b1 | a.b1+a2+b2 | etc. |
| a |   a1  |      a2    | etc. |
| b |   b1  |      b2    | etc. |
Total: a.b1, 2, 3, etc.

How can I do this? And is it possible?


texts: Why org-babel-tangle-file tangles source blocks to different files?

texts:
I try to use emacs --batch in Makefile to tangle my .org files.

Here's my test org file (t.org)

* Another Header

  #+BEGIN_SRC emacs-lisp
    (message "Hello")
  #+END_SRC

* Header 1

  #+BEGIN_SRC emacs-lisp :tangle yes
    (provide 't)
  #+END_SRC

I use this command to try to tangle it to lisp/t.el:

emacs -Q --batch --eval 'require (quote org))' --eval '(org-babel-tangle-file "t.org" "lisp/t.el" "emacs-lisp")'

Instead of get single file (lisp/t.el), I got 2 tangled files:

t.el at current directory:

(provide 't)
lisp/t.el:

(message "Hello")

Is that the expect behaviour? How could I tangle all the source blocks to single file (lisp/t.el)?

Emacs: 25.0.94.1 (Built from source)
Org-mode: 8.3.4
OS: Ubuntu 16.04


texts: I would like to open emacs in dired mode . files and folders should be organised in most recent file first order. Moreover I would like to highlight the Org files for easy selection. Is this possible?


texts:
I'm trying to make EIN work within Emacs, but right now (with IPython 2) it seems that it's not possible. This errors arise:

REQUEST [error] Error from parser ein:json-read: (json-readtable-error)
ein: [error] Error (parse-error) while opening notebook list at the server 8888.

But while trying to solve this problem I started to wonder if there is really any advantage of using the notebook over an IPython shell with all the added functionality that Emacs gives.

So the question is: which are the advantages of using EIN over the IPython shell inside Emacs? Is there a way to save an IPython session to a file?


texts: More than one value for properties (multiple values)

texts:
I would like to assign, for example, more then one responsible person to a task.
I thought to use properties like
:PROPERTIES:
:RESPONSIBLE: Kate
:RESPONSIBLE+: Aaron
:END:

But my agenda search for RESPONSIBLE="Aaron" has no results.
One reason not to use tags is, I can easily search for tasks without a responsible person, if the values were numbers, I could use operators like > and it does not clutter the headings with a lot of tags.
Is there a way to do this with properties?
Or is there a different way to make agenda search include, e. g., a todo with multiple responsible persons?


texts: How should comint-derived modes keep track of buffers and processes?

texts:
Having written a couple of custom comint-derived modes, I often find it tricky to decide how to keep track of buffers and processes: for instance, to associate different source buffers with different interpreters.  Is it better to keep a reference to the buffer or the process?

Given a buffer, one can find its associated process using get-buffer-process.  Conversely, given a process, process-buffer returns its associated buffer.  Both buffers and processes also permit an extra layer of indirection by looking them up by unique name, but this seems fragile compared to just keeping a reference to the object itself.

One possibility seems clearly bad, since it violates the principle of storing data once-and-only-once: namely, keeping references to both the buffer and the process.

Most comint- functions for sending input take a process rather than a buffer as an argument, which argues for hanging on to the process object, not the buffer.  On the other hand, buffers tend to stick around longer than processes: a process might finish or be killed and a new process started in the buffer it previously used.

Are there other convincing arguments for referencing the process or its buffer?


texts: How to make ryo-modal not insert undesired keys?

texts:
According to its project page ryo-modal, ryo-modal keeps unmodified all keys that weren't allocated for it.

Notice that other keys are unmodified, so pressing r would insert r into the buffer.

My question is: how can I make ryo-modal issue a message when a non-allocated key is pressed and not insert it? Something like (message "The pressed key" unknown-keystroke " is not recognized")?


texts:
I often find myself debugging some stuff in the installed Emacs
sources, which are in *.el.gz form.  And the ability to rgrep
would be quite handy. Is this readily possible?


texts: sr-speedbar shows compilation warning at startup

texts:
In my .emacs I have (require 'sr-speedbar). It works fine, but at startup I always see the compile-log-buffer with Warning (bytecomp): reference to free variable 'helm-alive-p'.

According to this question it has to be some wrong definition somewhere, but where?

I guess it has to be in the elisp code in the package, but there is also a .elc-File. I am a newbie to elisp, so I don't want to break anything. How do I get rid of this warning?


texts: can I quickly clean up html files with emacs (prelude)

texts:
How do you clean up an html file?

For example, this file has one too many empty line between the div tags.
I would like cleanup to leave only one blank line there.

      foo

      abc

What I tried in my emacs prelude

M-x help
d PATTERN   Show a list of functions, variables, and other items whose
              documentation matches the PATTERN (a list of words or a regexp).
entered 'clean html'

  Nothing found


texts: Function to copy the whole line if no region is selected

texts:
I want to bind this function to M-w, so that it copies the region if one is selected, otherwise it copies the whole line silently, without having any other side-effects like moving the cursor to some other places.
I saw some examples, but they all do some additional stuff that I don't like, like moving the cursor to the next line.
I'm not an expert in Elisp, but some functions I saw might be buggy, because their bodies contain "\n", to refer to "newline", which is obviously wrong, because not all systems use this convention.


texts: Is there a view that can show time entered per day?

texts:
Basically I am after a method to find missing times.

Currently I use this code to view times per task.

#+BEGIN: clocktable :link t :maxlevel 10 :block week :scope file

But I can not view if i am missing times with in any particular day.


texts: Automatically pressing enter and y in emacs when prompted for input

texts:
In python.el there is a command (python-shell-switch-to-shell) that opens an ipython shell.

Problem is, it first asks me where to start the REPL and then whether to make a dedicated process. I always answer <RET> and y. Is there a way to send these signals to emacs automatically?

(I know there are other workarounds, but modifying the python layer in spacemacs is probably too much of a bother.)


texts:
Currently I can grep (in command line) the gzip files I receive using the command zgrep -a something logs.tar.gz it outputs every line inside the logs.tar.gz but without the file where it was found, so is 80% useful.

Then I turned to emacs but when I do the equivalent command zrgrep I get only the Binary file ./logs.tar.gz matches, when I click it opens the tar.gz file, but I don't see the matches.  I tried to visualise it by installing ascii with el-get without success and read over the different greps. Unfortunately I didn't find any clue on how to grep the open gz file in the buffer, it always refers to a physical dir. So currently I need to uncompress it and do the regular grep (that works well)

Is it possible to have the possibility to pass the command -a to get it in ascii text?

or

Is there any possibility to run a grep (or equivalent command) on the buffer I have the gz file open?


texts: Setting the default font from menu bar does not stick

texts: I am running emacs 24.4.1 on Kubuntu 15.04 and when I open a new frame, Emacs' own default font (i.e. its default default font) is used as the font for that new font, rather than the default font that I have set and saved. So I have to set the default font again every time I open a new frame. How can I fix this?


texts: Why does Emacs not pick up all of my Mac OSX keyboard layout?

texts:
I'm using the custom keyboard layout found at https://www.kaufmann.no/roland/dvorak/macosx.html.

When I use Emacs in gui mode, most keys are fine, but the 10-keys -- which the layout redefines like a telephone keypad -- are not remapped. That is, they give the number written on the key and not the remapped one.

I'm curious: how is it even possible for Emacs to see keys differently from every other application?

Update

Another example, emacs binds cmd-left and cmd-right to switch between frames. It also ignores my settings in macos Settings which are usually cmd-` but I have them on cmd-$ for Move Focus Next Window. How can emacs override the system-wide keys?


texts: How to move the cursor to the beginning/end of a shift-selected region by a left/right motion?

texts:
In most modern editors, after canceling a selection by a left/right motion, the cursor will be moved to the beginning/end of the previously-selected region correspondingly.  Similarly, if we cancel a selection by a up/down motion, the cursor will be moved up/down one line from the beginning/end of the previously-selected region correspondingly.

Could we have the same behaviors in Emacs under shift-select-mode?

I tried to define my own movement function:

(bind-key* "M-l"
  (lambda (arg)
    (interactive "^p")
    (if (use-region-p)
        (goto-char (region-end))
      (syntax-subword-forward arg))))

But it doesn't work.  The goto-char never run even if I am selecting a region.  Is it because I used (interactive "^p")?  Any solution?


texts: How to highlight in the mode-line that a compilation process is running in AUCTeX?

texts:
As compiling LaTeX documents can take a while, I would like to be able to quickly and effortlessly check whether the compilation process is still runing. How can I achieve this with AUCTeX? I know I could take a look at the log with C-c C-l and scroll to the bottom, but that doesn't really feel effortless. On the other hand, constantly following the log buffer (as with TeX-show-compilation) is not nice either. Instead, I imagine, e.g., some (maybe animated) tag/icon appearing in the mode-line similarly to "Loading" when updating the package information:

Update

As giordano has pointed out, actually the tag "Compilation" appears somewhere in the mode-line, yet this is easy to overlook. I guess my question then is whether it is possible to make this tag more visible, similarly to the TeX output buffer:


texts: How can I tell if a buffer is already visible?

texts:
I'd like to have the following code in my library:

(when (not (buffer-visible-p es-results-buffer))
  (delete-other-windows)
  (view-buffer-other-window es-results-buffer))

However, I haven't been able to find a function for buffer-visible-p. Is there such a function?


texts: How can I use multiple cursors in evil/spacemacs

texts:
There are multiple multiple-cursors implementations for emacs.

I have the impression that extra work has been required to make them work well in evil and spacemacs in particular.

I imagine the competing implementations have their pros and cons.  As a newcomer to multiple cursors, I'm interested in the best all-rounder.

How can I make that work?  I'm not sure which is most relevant to the problems: evil or spacemacs, but I'm using spacemacs.


texts: How to set the foreground color of the cursor face?

texts:
I tried to set the foreground color of the cursor face, but it does not seem to work. Setting the background color works fine, but setting the foreground color does not have any effect.

I would like Emacs to act in the same way as my terminal. When I move the cursor over the text the foreground color does not change.

When I do the same in Emacs the foreground color becomes white.

How can I stop Emacs inverting the text at the cursor?


texts: How to disable specific flycheck-warning messages in LaTeX-mode?

texts:
Currenty I am on LaTeX-mode-hook using flycheck.

(setq LaTeX-item-indent 0)
(add-hook 'LaTeX-mode-hook 'turn-on-auto-fill)
(add-hook 'LaTeX-mode-hook 'hl-todo-mode)
(require 'tex)

(add-hook 'LaTeX-mode-hook (lambda ()
  (TeX-global-PDF-mode t)
  ))

(setq flyspell-issue-message-flag nil
      ispell-local-dictionary "en_US"
      ispell-program-name "aspell"
      ispell-extra-args '("--sug-mode=ultra"))

(dolist (hook '(text-mode-hook))
     (add-hook hook (lambda () (flyspell-mode 1))))
    (dolist (hook '(change-log-mode-hook log-edit-mode-hook))
      (add-hook hook (lambda () (flyspell-mode -1))))

For example I am getting following flycheck-warning message when I write function() into my .tex file:

You should put a space in front of parenthesis. [36]

[Q] Is there any way to ignore specific flycheck-warning messages?