texts: Fast/efficient way to keep a running word count

texts:
I am trying to implement a minor mode that displays in the modeline the current word count and the number of new words since the file was last opened.

There are some existing implementations with this type of functionality (e.g., nanowrimo.el). But as far as I can tell, all of the implementations I've found so far seem to re-count the entire buffer after each change (i.e. after each character insertion or deletion, kill, yank, undo, etc.) This makes emacs a bit slow and unresponsive on on large files. This would seem to be a very common problem, but I haven't found a solution.

I am trying to keep track of the current word count in a variable and use before-change-functions and after-change-functions to update that count after every insertion, deletion, kill, yank, undo, etc. This involves counting only the changed character(s) and the immediately surrounding characters. (For example, if a space is inserted between two non-word characters, the word count increases by 1.) This approach is much faster/more efficient - but I haven't quite figured out all the details to make it work.

Is there existing code that already does this, either using change hooks or any other method? Or, any thoughts about a good approach to do this?


texts:
I'm a very limited git user and most of the time, I just want to stage commit and push my code without too much ceremony.

What's the git add -A equivalent for magit? (I want to do it programmatically)


texts: In-line latex fragment position in org-mode

texts: The in-line LaTex equation images are slightly higher than the rest of the font, maybe because of the image borders. This is really a small thing but could it be better aligned at the bottom?


texts: How to replace the expression with evaluation result using Elisp interpreter?

texts:
When I do bulk calculations in a scratch buffer, it is annoying to have to delete the actual expressions after they are evaluated (I want them to be deleted on evaluation).

Example:

(+ 2 2)

Pressing C-u C-x C-e gives:

(+ 2 2)4

What I want instead is only this (the expression has been removed):

4

Is there a command that I'm not aware of? I'm curious if there is an easy work around before I write something of my own.


texts: How to diagnose why semantic-imenu does not correctly parse a file?

texts:
When spelunking through Java code, I rely heavily on the semantic integration through the use of helm-semantic-or-imenu to navigate to different functions in a file.

This works great for simple to moderately-complex Java files, however, some complex Java files show an empty semantic imenu. There are no errors in the log, only the customary:

Parsing NettyTransport.java (LALR)...done

And then the imenu is empty.

How can I diagnose and/or fix the semantic parsing for these Java files so they correctly show functions/vars/etc in the imenu?

For reference, a Java file that silently fails semantic parsing can be found here.


texts: Combining diacritics not combining visually

texts:
The first two characters in the left buffer are LATIN SMALL LETTER A and COMBINING CIRCUMFLEX ACCENT. Together they should display as â, just like LATIN SMALL LETTER A WITH CIRCUMFLEX, â.

However, as you can see, the circumflex is appearing next to the a, not above it.

The screenshot is from GNU Emacs 26.1, emacs -Q on Ubuntu 18.04. The characters display correctly in other applications. What's going wrong and how can I fix it?


texts: On "really edit the buffer", have emacs run ediff-current-file automatically?

texts:
Context

When emacs detects that a file was changed outside of an editing buffer.

Observed

emacs will ask:

  somefilename changed in disk; really edit the buffer? (y, n, r or C-h)

(Incidentally, sometimes it happens even when there is no actual change, e.g. remote file on a server with drifted clock, but the question is interesting in all cases.)

Wished

emacs would ask:

  somefilename changed in disk; really edit the buffer? (y, n, r, d or C-h)

Pressing d would show the difference between versions, e.g. ediff-current-file which allows to walk the differences interactively.

Additional information

That would be similar to what Debian package management does when it detects that a config file locally customized gets updated by a newer version of its owning package. For an example see A new version of configuration file /etc/default/grub is available, but the version installed currently has been locally modified - Unix & Linux Stack Exchange

Search before you ask

I usually find my way to solutions (e.g. emacsclient - From an external script, open file and run some simple expression whether emacs already running or not - Emacs Stack Exchange) but after searching on this I could not find any pre-existing solution.

I'd consider adjusting this myself but am not proficient enough in emacs-lisp and emacs internals.

Sketch of solution

Pressing C-g then 'M-x ediff-current-file` does the job, at the cost of some keystrokes.
The goal here would be to run ediff-current-file on one keypress at the above prompt.


texts:
It seems that once customizable variables are loaded, the Customize interface is not updated on subsequent re-evaluation of those variables, even with eval-defun (C-M-x).

For example, adding a :prefix to a defgroup and C-M-xing does not update the names of customizable variables in that group in the Customize interface.

Why is this happening, and what can be done to "force update" Customize?


texts: How do I write a simple `completion-at-point-functions` function?

texts:
I'm considering writing a major mode for editing Magic: the Gathering decks.

Most of it seems pretty straightforward but I have one question. There are about 15 000 unique Magic cards available (cards with unique names that is). I would like to be able to complete against them by writing a completion-at-point-function. I've been looking for some simple, basic example of a capf function that just completes against a set of words to base my mode on but have failed to find anything so far. Do you know of any good example for this to get started? And do you believe it would be easy to get good performance or would I have to write my own data structure (I'm thinking like a Trie maybe).

Obviously I'd need to find a way to sync with new cards etc and in the future maybe even be able to search for cards by other characteristics than just the card name but that can wait.


texts: Is it possible on Cider to eval on a repl and print as a comment every evaluation on a buffer?

texts:
If I want to demonstrate something, is it possible that I can run a command on cider and it prints after each line the result of evaluating that line ?

(def xx {:a "a" :b "b"})
(:a xx)
(:c xx [])

And, after running (something similar to):

(def xx {:a "a" :b "b"}) ; => #'ns-name.playground/xx
(:a xx) ; => "a"
(:c xx "nothing") ; => "nothing"


texts: Exporting highlighted source code to pdf in Org-Mode

texts:
I'm trying to export some python code with syntax highlighted to a pdf, from org-mode. Even though I can export to html without any issues I could not find a way to export it to pdf.

n.b. I'm using spacemacs but also tried without success with vanilla emacs.


texts:
I am using matlab-emacs to debug a matlab script from inside of emacs with GUD.  Everything seems to be working as expected except that I don't see any breakpoint indicators in the fringe.

This is important to me for two reasons:

It is nice to easily see where all of the breakpoints are in the code. It makes it much easier to know what to expect when I "continue."
It lets me toggle breakpoints on and off. When the breakpoint indicator is there, I can check for it in code, and know whether I should toggle the breakpoint on or off.

Is there a way to get breakpoint indicators for Matlab debugging?


texts: how to get Emacs to locate the error in my init file without relaunching?

texts:
When there's an error in one of my init files, I get a vague message like this when I launch Emacs:

Warning (initialization): An error occurred while loading /Users/im/.emacs.d/init.elc:
(wrong-type-argument listp helm-find-files-actions)

It doesn't tell me which of my many configuration files contains the error, or which line. Searching my files doesn't help because, guess what, the function helm-find-files-actions doesn't actually appear in any of my init files. To track down the offending line of code, I have to do $ emacs --debug-init.

Is there no way to get Emacs to automatically tell me where the offending line is without having to quit and run $ emacs --debug-init? I know I can bisect + eval the files manually but that's even slower. It would be so much better if, when there's an error in one of my init files, Emacs could:

tell me which init file
tell me the line number that contains the error
ideally, open that init file and take me to the offending line

Is this possible with Emacs, or am I living in a fantasy world?


texts:
I am just starting to use Org-Mode as a getting things done application and having some trouble with the Line Spacing (not sure if that is the correct term) between entries.  For instance see below:

* TestPrimaryLevel1

** TODO Testing Spacing Level2

*** Data associated with Testing Spacing Level3

*** More data associated with Testing Spacing Level3

There is an extra carriage return between each of the entries that I do not want to be there.  How can I default it to not adding that extra carriage return?


texts: Org-mode: manually sorting headlines column view

texts:
I love that we can quickly re-order our outlines with the M-<Up|Down> arrow keys. For whatever reason, I can't get this to work in column view. I would like to enable this behavior.

Any ideas how to get this done?

Thanks!


texts: How to re-enable syntax highlighting of code that have been disabled by #if preprocessor statements

texts:
Code between #if SYMBOL and #endif is greyed out in cc-mode if the SYMBOL has not been defined within the current file.

The project that I´m currently working on has a common code base for Mac and Windows so there´s a lot of #if WINDOWS and #if MAC in there. This results in lots of code in the editor that is grey and without syntax highlighting since these symbols are defined in some other compilation unit.

How can I enable syntax colouring in the current editor without editing the file? I can always add a #define SYMBOL 1 above the #if SYMBOL but this does not feel right?


texts: How to tangle all the source code blocks inside a sub-tree using the properties drawer?

texts:
I have a chapter heading in a literate program, in which all source-code is tangled into a single file called test.hs. It is irritating and error-prone to have to repeatedly type
the :tangle code/src/test.hs for every new code block

Hence I would like to use the properties drawer of that chapter to once and for all tell Emacs to tangle ALL source code it sees inside this subtree to go into the file test.hs

My attempt at trying this did not work. How do I fix it?

 ** New Chapter
 :+PROPERTIES:
 :tangle: code/src/test.hs   (This does not work!)
 :END:

  #+BEGIN_SRC haskell
    import qualified Data.Map as Map
    main = print "Hello World"
  #+END_SRC

  Here's the `add` function to add two numbers.

  #+BEGIN_SRC haskell
   add a b = a+b
  #+END_SRC


texts:
Is it possible to write a function with completion that act on region?

A mix of:

(defun function-style (style)
  (interactive
   (list
    (completing-read "Style: " styles-list)))
     ...

And

(defun function-style (beg end)
      (interactive "r")
       ....


texts: Is it possible to extract a list from a table in org-mode?

texts:
I have an org-mode table

| name      | band     |
|-----------+----------|
| lennon    | beatles  |
| mccartney | beatles  |
| harrison  | beatles  |
| starr     | beatles  |
|-----------+----------|
| page      | zeppelin |
| plant     | zeppelin |
| jones     | zeppelin |
| bonham    | zeppelin |
|-----------+----------|
| mason     | floyd    |
| waters    | floyd    |
| wright    | floyd    |
| barrett   | floyd    |
| gilmour   | floyd    |

I'd like to programmatically extract the following list from this table:

* Beatles
  + lennon
  + mccartney
  + harrison
  + starr
* Zeppelin
  + page
  + plant
  + jones
  + bonham
* Floyd
  + mason
  + waters
  + wright
  + barrett
  + gilmour

Is this possible?


texts: Running some functions from emacsclient doesn't work

texts:
This works:

emacsclient  -s emacs -e "(call-interactively 'find-file)"

But this one doesn't:

emacsclient  -s emacs -e "(call-interactively 'newline)"

In fact, none of the functions I tried to run via Terminal with emacsclient didn't work except find-file. Built-in functions tend to turn nil while functions I wrote tend to turn errors like *ERROR*: End of buffer, although I can run the same function directly in emacs without any problem.

The function that turned the above error message is this:

(defun test (&optional args)
  (interactive )
  (forward-char 2)
)

How can I get this to work?

OS X 10.8
Emacs 24.5 (9.0) desktop version


texts: Is there continuous scrolling and double page viewing in pdf-tools?

texts: pdf-tools jumps from the end of one page to the next page. Is there a ways to activate some kind of smooth scrolling? Also is there a way to display a double sided layout on my screen?


texts: How do I run an external command on an org mode source block?

texts:
I'm writing a screenplay using Fountain mode. My org file is set up so there are multiple screenplays in a given file, for example

* Number one!
#+begin_src fountain
  INT A PARK IN SAN FRANCISCO

  EMPEROR NORTON
  Being desirous of allaying the dissensions of party strife now existing within our realm, I do hereby dissolve and abolish the Democratic and Republican parties.
#+end_src

* Number two!
#+begin_src fountain
  INT LETTERS DISPLAYED OVER A DESK

  PHILIP II OF MACEDON
  You are advised to submit without further delay, for if I bring my army into your land, I will destroy your farms, slay your people, and raze your city.

  letter is replaced

  SPARTA
  If.
#+end_src

I want to run an external command to convert one of these screenplays into a pdf. Fountain mode does not have the export functionality I want. It currently has some, but it is being removed in a future release.

If I had the screenplay in a file by itself, I could run a command in bash using wrap: wrap pdf my-screenplay.fountain. But it's not in a file by itself; it's a single source block.

So I'd like to be able to run a command on this single source block.

No org feature I've looked at seems to do this cleanly, although I might be missing something. I've looked at Org export, Org tangle, and Org publish, but as far as I can tell, they only act on a file as a whole.

How can I pass the contents of a single source block to an external command? Ideally I'd also be able to get the name of the headline before the command, so I can name each exported pdf differently.


texts: How to find where a given function is called from in gtags

texts: I am using gtags and can jump to where a function is defined. Howeve I am not able to find inside a function where it is begin called from. Is there anyway to find where a function is called from?


texts:
Say, you create a new buffer (Fundamental), type a shell command and want it executed. Like you can do in a *scratch* buffer with lisp code (C-x C-e). Or you have a text file, that has text interspersed with shell commands. Or a shell script, and you want to execute one of the commands. Is there a way?
Or maybe you have an url in a buffer, and you want to do xdg-open URL. Or a path to a directory, and you want ls DIR. Is this possible? Maybe, like, M-! xdg-open , and then somehow paste the url into the minibuffer?


texts: Search region instead of search inside region

texts:
When a region is active, emacs searches (Ctrl+Sor Ctrl+R) within that region.

I would like to change that so that it searches in the whole buffer with the region as pattern.

Any toughs ?


texts: Can I write elisp code to act on the text in a buffer

texts:
I am fairly new to emacs and I want to learn emacs Lisp. In particular, is it possible to write elisp functions in, say, the scratch buffer to do some complex text-processing on my program file example.cpp whose buffer I would have open in another frame.

Indeed if I could write some elisp code to do text-processing across all the files in the project folder that would be even better!

I am using Spacemacs


texts: How show in Dired+ count of selected files and size?

texts:
Windows 10, Emacs 25.1, Dired+ (20170818.1411)

In Total commander when I select any files it show count of selected files and total size of selected files.

Here example:

It's very helpful.

But in Emacs in dired mode I can't get this information.
Here example:


texts: Disable pretty entities for empty subscripts and superscripts in Org mode

texts:
Is there a way to disable pretty display for empty subscripts and superscripts in Org mode? So "X_{}" wouldn't be prettily displayed, but everything else, e.g. "X_{1}", would be.
I ask because there seems to be a subscript (and superscript) conflict between pretty entities in org-mode and electric-pair-mode. Typing  "X_{" automatically adds the closing "}" (because of electric mode) which then hides the entire "_{}" (because of pretty entities), thus making it seemingly impossible to put the cursor between the "{" and "}" without disabling pretty entities.
Somewhat relevant: I'm aware of the org-pretty-entities-include-sub-superscripts variable.
This might be a good opportunity for me to learn some elisp. If you think so, please let me know, and if you have any tips, I'd most grateful.


texts: How to loop over every line in a buffer?

texts:
I am searching for some kind of reduce function, which loops through every line of a buffer, but I can not find it. Does anybody know the name of such a function?

Something similar to Perl

while (<>) {
  ...
}

Or a dolist for buffer lines.


texts:
Emacs defines ` to be used for abbrevs in f90 mode. How do I change this so some other key, like e.g. # ? I think, I found the relevant lines in f90.el:

(defvar f90-mode-map
  (let ((map (make-sparse-keymap)))
    (define-key map "`"        'f90-abbrev-start)
    ...

but my attempts at mimicking this syntax usually lead to errors.

Thanks in advance for any help.

Update:

So I followed the advice of Aaron Harris and added:

(eval-after-load 'f90
  '(define-key f90-mode-map (kbd "#") #'f90-abbrev-start))

to my .emacs. Now when I open a Fortran file and hit

C-h k #

I get the following text:

  # runs the command f90-abbrev-start, which is an interactive compiled Lisp
    function in `f90.el'.

  It is bound to #, `.

  (f90-abbrev-start)

  Typing C-h or? lists all the F90 abbrevs.
   Any other key combination is executed normally.

But still

`su<SPACE>

is expanded to subroutine while

#su<SPACE>

is not. Do I misunderstand something here?


texts: ibuffer: how to automatically create groups per project

texts:
I'd like to group my buffer list in ibuffer by project. Project is meant in the Projectile sense of the word.

I don't want to change my Emacs configuration every time I'm working on a new project. Is there a way to achieve this automatically?


texts: What should/shouldn't I do when keeping .emacs and .emacs.d in version control?

texts:
Like many people, I manage a lot of my dotfiles via a version control repository (Mercurial on Bitbucket, private, in my case). This is handy when setting up a new machine or propagating configurations among different machines.

So naturally I added my .emacs and .emacs.d to this setup.

Then I installed some packages, and ended up adding *.elc to my .hgignore, just like I omit *.pyc files from my Python repos.

Are there other things I shouldn't be tracking, e.g. generated files that are environment specific and won't be useful/correct when cloned to another platform? (I use Linux and OS X on the desktop, and FreeBSD on the server.)

Are there any setup tricks that are commonly used to make this kind of sharing more valuable? With my shell file setup I'm still looking for good ways to cherry-pick individual files across branches for example.


texts: How to postfix with a string each line of a multiline selection?

texts:
Reminder:C-x r t string <RET> replaces rectangle contents with string on each line (string-rectangle). https://www.gnu.org/software/emacs/manual/html_node/emacs/Rectangles.html

Can I use this, or an analogue command, starting from:

{Curiosity
{Killed
{The Cat

to get:

{Curiosity}
{Killed}
{The Cat}

?


texts:
Can I use polymode for styled components inside tsx or jsx files? For example:
// MyComponent.tsx

const x = 1;
const y = 2;

const myStyle = css`
  background-color: red;
  padding: ${x + y};
  margin-left: ${y}
`;

I want the stuff inside the css block to be in css-mode, except for the interpolated bits, which I want to be in the host mode (ie typescript-mode).
I can get the css bit working sort of like this:
(define-hostmode poly-css-in-ts-hostmode :mode 'typescript-mode)

(define-innermode poly-css-in-ts-innermode
  :mode 'css-mode
  :head-matcher "css`"
  :tail-matcher "`"
  :head-mode 'host
  :tail-mode 'host
  :init-functions)

(define-polymode poly-css-in-ts-mode
  :hostmode 'poly-css-in-ts-hostmode
  :innermodes '(poly-css-in-ts-innermode))

But I'm not sure how to get the nested ${/* ts or js code */} blocks working.


texts: How to view email address details in mu4e?

texts:
I started using mu4e for email and would like to see the details of email addresses of both sender and original recipient. My default view is

From: Some sender

and I would like to see their address, which I can do by replying to the email, when I see:

To: Some sender <name@email.com>

I would also like to see the email address of the original recipient in case of forwarding of multiple addresses, e.g. to know which address to fill in a form to unsubscribe.

I believe both of these are HTML headers, but the "headers" keyword means the email list view in mu4e.

How can I see these addresses?


texts: How do I convert scheduled recurring entries into clocked data?

texts:
I use org-mode for scheduling and logging in tasks. I clock in non-recurring tasks, however I find it strenuous to clock in recurring tasks. Is there any way I can mark the recurring task done and the scheduled time for the task is converted into clocked data as soon as I mark it done?

Example,

* TODO Task 1
SCHEDULED: <2016-10-04 Tue 10:00-10:30 ++1d>

After I mark it done, the task should read

* TODO Task 1
SCHEDULED: <2016-10-05 Wed 10:00-10:30>
:LOGBOOK:
- State "DONE"       from "TODO"       [2016-10-04 Tue 11:42]
CLOCK: [2016-10-04 Tue 10:00]--[2016-10-04 Tue 10:30] => 0:30
:END:


texts: How to specify prefix argument in key binding

texts:
The description of C-x C-e mentions:

...Interactively, with a non '-' prefix argument, print output into current buffer.

I understand this to mean this logic is triggered when I issue C-u C-x C-e, but how would I bind this to C-c c? How do I specify the prefix in the binding?
Same for C-SPC:

With prefix argument (e.g., C-u C-SPC), jump to the mark, and set the mark from position popped off the local mark ring (this does not affect the global mark ring).

My normal binding looks like this:
(global-set-key (kbd "C-c ,") 'pop-global-mark)


texts:
I'm working on a textobject based on ffap-guesser. I'd like for yif to yank the file-at-point. This works great, except when there is no literal file at point, and ffap is doing some of it's more creative guessing.

For example. Running ffap-guesser on

(require 'config-company)

Yields "/home/pythonnut/.emacs.d/modules/config-company.el". Ideally, yif would yank that string instead of what's in the buffer.

I mostly care about yanking, but obviously it would be cool if this worked for other operators. (Deleting, for example, would delete the range that ffap-guesser used to guess?)

Can this be done reasonably?


texts: What is the difference or functionality between the available tex packages enumrated below

texts:
sorry to disturb you. I am trying to migrate all the workflow of writing tex files and managing citations into emacs but I'm completely lost by the overwhelmed plethora of packages and I'm not sure what is their purpose or if more than one of those are doing the same thing or have the same functionality.

Could someone please describe their difference and functionalities. Are some of those dependencies of others in the list below. In other words what are the main ones that come with eamcs installation and what are those that built on top of those basic bundled packages?

helm-bibtex, org-ref, org-bibtex, auctex, reftex, bibtex, Ebib

BTW, if anyone knows of any descent package that can take a directory of pdfs and extract and create .bib file automatically please let me know.

So far there's an option in org-ref for this but fails whenever there's no doi in the pdf.

It seems that tools such as mendeley or zotero are more robust in this aspect. 90% of the time they get it right.

Does anyone know how they work behind the scenes and maybe we can port that functionality a.k.a robustness into emacs.


texts: How to show just one minor-mode in modeline

texts:
When I'm writing I really only want to see the word count, and ultimately that's the problem I'm trying to solve.
There's a modeline indicator that, but to see it, I have to see all the other minor modes I have installed.
I could diminish all of the other minor modes, but when I install a new minor mode, I have to go in and diminish again.
Plus, if I would like to make this modeline a package, I wouldn't be able to tell the other person using it which minor modes to diminish. They'd have to go do that themselves.
Is there no way to tell emacs: I just want to see this minor mode in the modeline, and not others?


texts: `error' called with 1 args to fill 0 format field(s)

texts:
I'm getting an error called with 1 args to fill 0 format field(s) error when byte-compiling cider-repl-history.el with Emacs 24.4 and 24.5. No such error is reported for Emacs 25.1.

Line 422 of cider-repl-history.el is a cl-assert. The docstring for cl-assert says:

  Other args STRING and ARGS... are arguments to be passed to `error'.

In this case we are passing in a STRING, but no ARGS. I suspect this is a resolved bug, but I'm can't find anything by searching the bug archive.

How is this best handled? We have byte-compile-error-on-warn set to t.


texts: Modifying auto-indent in emacs with python

texts:
I often write python code in which a function returns a value.  Often I will define that value higher up in the code as "returnvalue" or some similar name.

Then the next line is indented differently.  This is because emacs believes (falsely) that I just used the command "return value"

I end up with things like this:

def square(x):
    returnvalue = x*x
return returnvalue

where it should be

def square(x):
    returnvalue = x*x
    return returnvalue

Since indentation level is fundamentally important for python, this is a big deal.

I really like the auto-indenting, but I'd either like to somehow get it to recognize that if return isn't followed by white space, it should treat it as any other line of code.  Alternately I'd like it to simply not treat return as a special word at all.  Is this possible?

More information:

For what it's worth, I'm using Aquamacs (on Mac OS X).  In ~/Library/Preferences/Aquamacs Emacs/ it says

(custom-set-variables
  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(aquamacs-additional-fontsets nil t)
 '(aquamacs-customization-version-id 215 t)
 '(aquamacs-tool-bar-user-customization nil t)
 '(default-frame-alist (quote ((fringe) (right-fringe) (left-fringe . 1) (internal-border-width . 0) (vertical-scroll-bars . right) (cursor-type . box) (menu-bar-lines . 1) (tool-bar-lines . 1) (background-color . "black") (background-mode . dark) (border-color . "black") (cursor-color . "yellow") (foreground-color . "white") (mouse-color . "sienna1"))))
 '(ns-tool-bar-display-mode (quote both) t)
 '(ns-tool-bar-size-mode (quote regular) t)
 '(visual-line-mode nil t))
(custom-set-faces
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(autoface-default ((t (:inherit default))))
 '(fundamental-mode-default ((t (:inherit autoface-default))) t))

I don't have a .emacs file and ~/Library/Preferences/Aquamacs Emacs/Preferences.el is empty.  When I run emacs from the terminal command line it opens in the window and doesn't automatically indent.


texts: Meaning of magit status buffer: Head, Merge, Push

texts:
Can someone explain what the top three lines of the magit status buffer mean? Especially Merge: origin/master Commit message

Head:     master Commit message
Merge:    origin/master Commit message
Push:     origin/master Commit message

Using the console my working directory seems clean and everything is pushed/pulled to/from my remote, so why does the Merge appear in magit status?


texts:
I added this to my init.el:

  ;; Transparent Emacs
  ;;(set-frame-parameter (selected-frame) 'alpha '(<active> [<inactive>]))
    (set-frame-parameter (selected-frame) 'alpha '(88 70))
    (add-to-list 'default-frame-alist '(alpha 88 70))

Which make the background of emacs transparent. However when I removed this code from the init.el, the change persists. Why?


texts: How can I create dizzee services programatically?

texts:
I've just come across dizzee,
an Emacs package for managing subprocesses; it lets you create
functions that stop, start or restart shell commands.  For example:

(dz-defservice foo "script.sh" :cd ("/path/to/foo"))

This macro, dz-defservice, will create the functions foo-start, foo-stop
and foo-restart that will run/kill "somecommand.sh" in the directory
"/path/to/foo", and collect its output in a buffer.

This is perfect for a project I'm working on, where I want to run a
bunch of commands in separate directories all at once.  The commands
all have the same name, but do different things depending on the
directory they're in.

One way of doing this would be to write separate entries for each
service like so:

(dz-defservice foo "script.sh" :cd ("/path/to/foo"))
(dz-defservice bar "script.sh" :cd ("/path/to/bar"))
(dz-defservice baz "script.sh" :cd ("/path/to/baz"))

But of course, this seems perfect for a list (particularly as I'll be
adding more components in the future).  So what I want to do is have a
list be input to dz-defservice, which in turn seems like it's perfect for dolist:

(setq my--project-components '(foo bar baz))

(dolist (i my--project-components)
  (dz-defservice i "shell.sh" :cd (format "/path/to/%s" i)))

That was my first attempt; it only ended up redefining the functions
i-start, i-stop and i-restart over and over again.  Next I tried using
quotes in dolist, since it's a macro too:

(dolist (i my--project-components)
  `(dz-defservice ,i "shell.sh" :cd (format "/root/%s/" element)))

but that gives me this error:

Compiler-macro error for cl--block-wrapper: (wrong-type-argument symbolp (\, i))

I'm obviously misunderstanding something here, so can anyone tell me how
to use a list to create these different service entries?


texts: annotate C's function list static or not in Speedbar

texts:
Is there any way to configure Speedbar to tag functions in the buffer static or extern for C?

If not, how can I make it?


texts: Wrong indentation of block directives in rst-mode

texts:
I'm having issues with indentation of block directives in rst-mode.
Colons in the directives are always indenting, and I always have to backspace to
get it back on the right line.
But even backspace is annoying because the indentation means it will actually
jump past the desired indentation point, and I then need to use  to get
it to the correct place. I know this is because the indentation for these
directives end up being 3 spaces instead of the usual 2/4, but would think that
rst-mode would be smart enough to know to do the right thing.
Normal Return
.. contents:: TOC
   :param 1: On the correc line
      :param 2: indented
         :param 3: every newline

Ctr Return
Everything except the first line uses ctrl-return
.. contents:: TOC
   :param 1: ok
             :param 2: massive indent
                       :param 3: whelp ...

What I really want
.. contents:: TOC
   :param 1: this
   :param 2: is what
   :param 3: I want


texts: Magit allows renaming various Git references. I can't see how to rename a tag with Magit commands.


texts: are braces `{` and `}` used at all in elisp?

texts:
What is the convention for using { and } characters in Emacs Lisp if they are used at all?

Do macros make use of them?


texts: How to widen helm buffer names in `helm-buffers-list`?

texts:
One of the things I find annoying in emacs-helm is the size of the column showing buffer names in helm-buffers-list. I have searched the documentation and couldn't find how to customize the width of this column.

Is this even possible?


texts: Can Dired (or Dired+) detect symlinks in Windows?

texts:
Can Dired(+) be made to show symlinks in Windows?

A picture is worth a thousand words:


texts: Is it possible to see the cursor of other emacsclients?

texts:
I'm trying to run Emacs server in order to collaborate on org files in our office.

emacsclient makes it quite easy to have everyone connect to the same instance of a file and we can see real time changes, but we can't see each others' cursors, making it a little awkward when someone adds something right underneath where you're typing.

Is it possible to make all clients' cursors visible to each other client?  If so, would it be possible to have other clients' cursors styled differently as to not make the whole thing very confusing?


texts: Can you detect if a byte-compiled elisp file was not compiled by the current emacs?

texts:
Is there a way to tell if the current *.elc files were not compiled with the current Emacs?
I am trying to detect an error where emacs is updated, but old .elc files are left in the user elpa directory and they are not compatible.


texts: Map maximizing window and frameset-to-register/restore frame configuration to C-x 1

texts:
Currently C-x 1 maximizes the current window. What I wish to have is to use C-x 1 to

maximize the current window (if there are more open) AND store the current frameset to an arbitrary register (eg. 1) OR
restore the previously saved frameset from that arbitrary register, if there is only 1 window open.

My problem is that I do not know, how to check whether there is only 1 window open (or do another checking necessary).
So far, I have this:
    (defun maximize-window-or-restore-frameset ()
      (interactive)
      (frameset-to-register 1)
      (maximize-window))
    (global-set-key (kbd "C-x 1") 'maximize-window-or-restore-frameset)


texts:
I want to perform the same task as in the function below, but without having to press ENTER every time I select an option.

(defun my-fun ()
  (interactive)
  (setq something (read-string "Options:\n [m]: Do A.\n [n] Do B.\nINPUT: "))
  (pcase something
    ("m" (insert "m pressed\n"))
    ("n" (insert "n pressed\n")))
  (my-fun))

What is the correct way to do it? It is probably a basic function (some alternative to read string?), but I haven't been able to find it.


texts: Switch buffer to the file path in current cursor position

texts:
My .emacs file contains multiple file names as,

(load "~/.emacs.d/others/keymaps.el")
(load "~/.emacs.d/others/py.el")
(load "~/.emacs.d/others/web.el")

Is there a way any library, gives way for me to keep the cursor in the middle of file path and jump straight to the file content on pressing a shortcut.

(load "~/.emacs.d/others!!(cursor here)/py.el")

When the line cursor is in the middle of a file path, it must switch buffer to ~/.emacs.d/others/py.el


texts: Suppress creation of slot accessors for cl-defstruct :include slots?

texts:
Is it possible to suppress creation of slot accessors for slots included via :include?  For example, in the following:

(cl-defstruct person name (age 0) sex)
(cl-defstruct (astronaut (:include person (age 45)))
  helmet-size
  (favorite-beverage 'tang))

How can I prevent the accessor astronaut-name,astronaut-age, and astronaut-sex from being created?

It's possible to do the following after definition, so it is mostly a curiosity about the capabilities of cl-lib.

(setf (symbol-function 'astronaut-name) nil)
(setf (symbol-function 'astronaut-name--cmacro) nil)
...


texts: High CPU/memory usage and abnormally large savehist file?

texts:
I'm starting to use Spacemacs and occasionally I get stuck with Emacs beginning to require infinite amount of CPU and memory. Inspecting my .emacs.d/.cache folder reveals that the file savehist is 1.16 GB large... Deleting this file made Emacs work again.

Googling returned no result for me. Is there any precedent of such an abnormality, and how might one try to debug and fix it.


texts: Emacs how to run a command that requires a default editor remotely from with local Emacs?

texts:
I frequently use TRAMP to edit files on a remote machine but I also want to use Emacs for remote configuration and management.

On any system there are some commands that run with the VISUAL and EDITOR variables which open local edits.

Usually there is a corresponding file that these programs edit but these files should not be edited directly as there is syntax checking that occurs after the files are edited.

So if I am using TRAMP from my local machine, and I run a command such as crontab -e on the remote machine (over tramp-term or ansi-term) it will open the default editor on the remote machine.

Frequently I am ssh'd in as my own user account, so this will often open a second instance of Emacs in my local Emacs' shell.

This is very bad for key command interception etc.

Is it possible to make the default editor for commands like visudo and crontab my local Emacs?


texts: C-r in term-mode doesn't access reverse-i-search

texts:
I find that in term-char-mode with bash, C-r doesn't activate the
shell's reverse-i-search function.  How can I do that?

PS.
Apologies: I was using multi-term mode and had somehow convinced myself
the problem was derived from term mode.


texts: Set tangle-mode 444 for all source blocks in buffer

texts:
How can I tangle all source blocks write protected? The first line of this
example is ignored instead of being applied to all blocks as expected:

    #+PROPERTY: header-args:conf :comments link :tangle-mode (identity #o444)

    * Fail: File is NOT write-protected
    #+BEGIN_SRC sh :tangle .NotWorkingReadOnlyDotFile
    echo helloHello
    #+END_SRC

    * Pass: File IS write-protected
    #+BEGIN_SRC sh :tangle .WorkingReadOnlyDotFile :tangle-mode (identity #o444)
    echo helloHello
    #+END_SRC


texts: Is the unwind-protect's clean form always evaluated?

texts:
I have this loop:

(catch 'QUIT
  (while
      (search-forward-regexp "\\([^\n\\]\\(?:\\\\\\\\\\)*\\|^\\(?:\\\\\\\\\\)+\\)%.*\n"
                 nil t)
    (save-excursion
          (let ((b (make-marker))
        (e (make-marker))
        MatchedStringOverlay
        ACTION)
        (set-marker b (match-beginning 0))
        (set-marker e (point))

        (setq MatchedStringOverlay (make-overlay b e))
        (unwind-protect
        (progn
          (overlay-put MatchedStringOverlay 'face '(:background "OliveDrab1"))
          (setq ACTION (read-char "Opzioni per eliminare la stringa commentata:
- [y] per eliminare la stringa con relativo \"newline\"
- [l] per eliminare la stringa mantenendo il \"newline\"
- [n] per mantenere la stringa commentata
- [q] per uscire da questo loop:
"))
          (cond
           ((char-equal ACTION ?y)
            (replace-match "\\1"))
           ((char-equal ACTION ?l)
            (replace-match "\\1\n"))
           ((char-equal ACTION ?n)
            nil)
           ((char-equal ACTION ?q)
            (throw 'QUIT (remove-overlays b e)))
           )
          )
          (read-string "UNWIND EXIT"))

        (read-string "NORMAL EXIT")
        )))
  )

in which the unwind cleanup-form is always evalueted, but I need it to be evaluate only when something goes wrong (e.g. a quit of the script).

Where is my mistake? I thought it shouldn't be evaluate since the body form of unwind-protect exits normally.

The loop is meant to interactively remove some kinds of commented lines in LaTeX code, letting me choose if removing also the corresponding newline.


texts: How to extract text properties into a string?

texts:
Is it possible to separate text properties and convert them into a string? For example, with a string with properties:

#("gfsd \"fsgfd\"

sdfdsgfs \"fsdfs\"s sfg fdg fdffffffffffffff" 0 5 (fontified t) 5 6 (fontified t syntax-table (15) face font-lock-string-face) 6 11 (fontified t face font-lock-string-face) 11 12 (fontified t syntax-table (15) face font-lock-string-face) 12 14 (fontified t) 14 23 (fontified t) 23 24 (fontified t syntax-table (15) face font-lock-string-face) 24 29 (fontified t face font-lock-string-face) 29 30 (fontified t syntax-table (15) face font-lock-string-face) 30 56 (fontified t))

I would like to extract the properties

0 5 (fontified t) 5 6 (fontified t syntax-table (15) face font-lock-string-face) 6 11 (fontified t face font-lock-string-face) 11 12 (fontified t syntax-table (15) face font-lock-string-face) 12 14 (fontified t) 14 23 (fontified t) 23 24 (fontified t syntax-table (15) face font-lock-string-face) 24 29 (fontified t face font-lock-string-face) 29 30 (fontified t syntax-table (15) face font-lock-string-face) 30 56 (fontified t)

as a plain string.


texts: Strange behavior Org-mode latex export label

texts:
Currently, I've experienced some strange behavior of latex labelling of org-mode exported file.

Normally, I use the label style like #+NAME: fig:name for figure and table labelling, which corresponds to the label in the LaTeX file as \label{fig:name}, and works fine with the org-ref reference style [[ref:fig:name]]. The sections I do not intentionally label will be added a label like \label{sec:1} in LaTeX file.

However, I found sometimes the org-mode exported file will generate a different label style like \label{sec:org76fd1b6}}, and the #+NAME: tag is not correctly translated to the label I want. Indeed, putting something like #+CAPTION: label:fig:name XXXX still works, but looks much uglier.

The question is: how is such behavior invoked and how to avoid it?

Tested system: OS X 10.11, Emacs 25.1, org-mode 20161102 and org-ref 20161101


texts: How find org entries that are missing a certain property?

texts:
I have this long sub-tree, I want to find the entries that I haven't set a certain property on yet.

* Big list
** foo
   :PROPERTIES:
   :QUUX:     1
   :END:
** bar
   :PROPERTIES:
   :END:
** baz
   :PROPERTIES:
   :QUUX:     2
   :END:

I'm trying to use org-sparse-tree, but can't figure out how to write the predicate.

It should return the bar entry in the example, the entry with no QUUX property.

edit: currently using org-column-view to find the blank cells.


texts: Can lisp code executed via (load ...) access it's own file path?

texts:
If a script runs using (load /path/to/file.el), is there a way for the script that runs to access it's own path? (similar to Python's __file__)

Asking this because I'd like to construct a relative path from a .dir-locals.el file.


texts:
I would like to fill (wrap) a long heading in org mode. I don't see mention of how to do so in the org manual.

If I manually wrap the line by inserting a newline, org mode does not recognize the wrapped text as a heading.

Is this possible?

Note: org-fill-paragraph does not do this:

(defun org-fill-paragraph (&optional justify)
  "Fill element at point, when applicable.

This function only applies to comment blocks, comments, example
blocks and paragraphs.  Also, as a special case, re-align table
when point is at one.

If JUSTIFY is non-nil (interactively, with prefix argument),
justify as well.  If `sentence-end-double-space' is non-nil, then
period followed by one space does not end a sentence, so don't
break a line there.  The variable `fill-column' controls the
width for filling.

For convenience, when point is at a plain list, an item or
a footnote definition, try to fill the first paragraph within."
  (interactive)
  ; ...


texts: How to modify-face for a specific buffer?

texts:
I work with a lot of tabular data files and use stripe-buffer.el make them easier to read. But I also work with more than one, so I'd like to make it easier to distinguish among them as well and want to change the stripe colors per buffer.

I can change the face globally using:

(modify-face 'stripe-highlight "black" "#cce7ff")

Is there a way to do this locally to a single buffer?


texts: I am using wgrep but somehow for those read-only files (under version control), it always reports not to apply changes. Even the var of wgrep-change-readonly-file is set to t. Any idea how to fix it?


texts: How to cancel a mini-buffer prompt from elisp, eg: "... changed on disk; really edit this buffer?"

texts:
Sometimes I get a mini-buffer prompt to check if I want to edit the buffer.

Instead of answering this, I would like to revert all buffers, however this prompt remains.

How could I cancel this prompt? (which is no longer needed when reverting all buffers)


texts: Reduce the space between elements in modeline

texts: In the demo, there are 6 spaces between main.c (buffer name) and [parse-early_param (from which-func), 4 spaces between which-func and 53%, and 2 or 3 spaces elsewhere. How can I set the space between them just 1 (or maybe 2) in order to save space in the mode line?


texts: Is there a function to select the current source code block in org-mode?

texts:
I would like to write a function that pretty-prints the current source code block into a PDF. I know I can use ps-print-region-with-faces, but it would require that I first select the source code block.

Is there a function in org to do this selection?

thank you in advance

Edit:

the answer is org-babel-mark-block (answered by bertfred in a comment)

org-mark-element selects the block but also selects the BEGIN_ END_ markers.


texts: Is it possible to "protect" strings from formatting?

texts:
I'm working on a latex document

\documentclass{exam}
\printanswers

% to use the tag
% \usepackage{catchfilebetweentags}
% \ExecuteMetaData[file.tex]{tag}

%<*afterclass>

\begin{document}

\begin{questions}
  \question What is the first sentence of \emph{Moby Dick}?
  \begin{solution}
    \emph{Call me Ishmael.}
  \end{solution}

\end{questions}

\end{document}

%</afterclass>

As the document grows, I find myself often issuing C-x h TAB to fix my formatting.

The problem is that this key sequence takes the two strings

%<*afterclass>
%</afterclass>

and places a space after the % character:

% <*afterclass>
% </afterclass>

This causes problems in another script. Is it possible to "protect" these two lines from this formatting?


texts: Where is ispell private dictionary located on Spacemacs?

texts:
My Spacemacs help ispell-personal-dictionary says:

ispell-personal-dictionary is a variable defined in ‘ispell.el’.
Its value is nil

Documentation:
File name of your personal spelling dictionary, or nil.
If nil, the default personal dictionary, ("~/.ispell_DICTNAME" for ispell or
"~/.aspell.LANG.pws" for Aspell) is used, where DICTNAME is the name of your
default dictionary and LANG the two letter language code.

But there is no "~/.ispell_DICTNAME" or "~/.aspell_DICTNAME" on my system:

$ ls -A .isp*
ls: cannot access '.isp*': No such file or directory
$ ls -A .asp*
ls: cannot access '.asp*': No such file or directory

ispell is working and I accidentaly added a misspelled word to it.
Now I want to remove the entry from my ispell private dictionary.

How to find the ispell private dictionary location?

System Info :computer:

OS: gnu/linux
Emacs: 25.3.1
Spacemacs: 0.200.10
Spacemacs branch: master (rev. 4bb4cb46)
Graphic display: t
Distribution: spacemacs
Editing style: vim
Completion: ivy
Layers:
elisp
(c-c++ emacs-lisp evil-snipe git ivy org shell spell-checking)

System configuration features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GCONF GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 MODULES XWIDGETS

UPDATE 1:

aspell doesn't seem to be on my system:

$ aspell -h
bash: aspell: command not found.

UPDATE 2:

I found aspell, but it's unresponsive:

$ pwd
/usr/share/bash-completion/completions
$ ls aspell
aspell
$ aspell --lang=en dump config
bash: aspell: command not found...
Install package 'aspell' to provide command 'aspell'? [N/y] n
$ aspell -h
bash: aspell: command not found.
$ sudo ./aspell -h
sudo: ./aspell: command not found

UPDATE 3:

To uninstall aspell, I commented spell-checking in ~/.spacemacs, and restarted Emacs.

Then I reinstalled as described in https://github.com/syl20bnr/spacemacs/tree/master/layers/+checkers/spell-checking#install and restarted Emacs again.
Emacs opening page said:

Found 3 new package(s) to install...
--> refreshing package archive: melpa-stable... [2/2]
--> installing package: flyspell-correct-ivy@spell-checking... [3/3]

Still have same result with absolute path:

$ sudo /usr/share/bash-completion/completions/aspell -h
sudo: /usr/share/bash-completion/completions/aspell: command not found

UPDATE 4:

From Spacemacs help - SPC SPC h d v ispell-program-name:

ispell-program-name is a variable defined in ‘ispell.el’.
Its value is "/usr/bin/hunspell"

From command line:

$ hunspell -v
@(#) International Ispell Version 3.2.06 (but really Hunspell 1.5.4)
$ hunspell -h

I googled: emacs private dictionary location

Still not finding the location of my private dictionary.


texts:
I've been using emacs for a while, but am being quite dismayed by some quite hectic pinky-pain, so have just started using Chris Done's god-mode, which is great, I like it so far.

The problem is that with a few buffers open it's hard to easy know if I'm in god-mode in the given buffer.

I'm not accustomed to this "vim" way of doing things and am being confused by which buffer is currently in "god-mode".

So the question is generally:

How do I make a buffer (either in the mode-line or in some other place) more distinctive in some way when I'm in a particular minor-mode, in my case in god-mode, so I don't have to move my eyes to the mode-line or test by pressing something.


texts: c-basic-offset is not influencing indentation of c/cpp files

texts:
No matter how I set this value I get this message when I try to describe it.

Its value is 2
Original value was set-from-style
Local in buffer .... ; *Global value is 3*

I don't know what is preventing the global value from applying. Any suggestions.


texts: How to discard stderr when running a shell function?

texts:
If I run

(setq some-variable (shell-command-to-string some-command))

...and the execution of the command in some-command results in some output sent to stderr, this stderr output ends up in some-variable.

How can I discard the stderr output, so that the result consists exclusively of the output sent to stdout?  (Better yet would be to capture the stdout and stderr outputs in separate variables.)

Note that it is not enough to add something like 2>/dev/null to the command in some-command, because the stderr output may come from a shell initialization file (e.g. .bashrc), and thus would not be captured by the 2>/dev/null redirection.


texts: doom-modeline module with line(w) status

texts: As the title implies, what package or feature does line(w) denote? When active, it deletes lines in evil-insert-state upon pressing Enter and then i immediately afterward.


texts: What causes Emacs to maximize on startup?

texts:
I have just move to MS Windows 10, and installed emacs.  Emacs starts with the frame maximized.  I don't want that.  I tried the -geometry option.  First an initial frame is evident.  Then a smaller frame corresponding (I think) to the -geometry specification.  Then the frame maximizes.

How can I prevent that maximization?

I grabbed a .emacs file from the Internet that set up some defaults that I like. This default behaior is one I don't like, but I can't see where in the .emacs file this it is specified.


texts:
I would like to be able to switch to an open window by typing the name of the buffer which is displayed in it.
It would be something like C-x b which opens the selected buffer only if it is not opened in another windows and in that case the focus switch to that window.


texts: Setting projectile-keymap-prefix with use-package

texts:
I use persp-mode and projectile both of which are installed using the use-package package and both want to prefix their keymaps with C-c p. The projectile readme says that you can define a custom keymap prefix with the projectile-keymap-prefix variable. (Similar is true for persp-mode.)

Whether or not I set this variable within the use-package directive or outside, the actual prefix does not change even though describe-variable shows the value as "^C^P". I still have to access projectile commands via C-c p. (The same is also true for persp-mode if i set the persp-keymap-prefix var to something other than C-c p.)

Why does the actual prefix that needs pushed never update with the custom prefix, and how do I fix this?

Here is the relevant code. For both libraries I still have to access their keymap actions via C-c p despite setting their keymap-prefix vars:

   (add-hook 'after-init-hook
    (lambda ()
     (progn
      (use-package persp-mode
       :config
       (setq persp-keymap-prefix (kbd "C-c o"))
       (setq persp-nil-name "Home")
       (persp-mode 1))

      (use-package projectile
       :diminish projectile-mode
       :config
       (setq projectile-keymap-prefix (kbd "C-c C-p"))
       (projectile-global-mode)))))


texts: How can I associate a schema with a json file using lsp-mode/lsp-json

texts:
If you read the documentation for lsp-mode-lsp-json here, this is the section that deals with setting schemas:

Available configurations
lsp-json-schemas
Default: nil
Associate schemas to JSON files in the current project

I have no idea how to use that. Is there an example somewhere?

lsp-json-schemas is a variable defined in ‘lsp-json.el’.
Its value is nil
Documentation:
Associate schemas to JSON files in the current project
You can customize this variable.
This variable was introduced, or its default value was changed, in version 6.3 of the lsp-mode package.

I googled, but can't find an example of how to use this variable anywhere.


texts: auctex failing to render formula previews

texts:
I am trying to get auctex on emacs to preview formulas but it doesnt seem to work and when I click preview, it produces the following error:

PDF2DSC sentinel: Wrong type argument: arrayp, nil

I have emacs, auctex and ghostscript installed on a windows 10 machine. Any help would be greatly appreciated.


texts: How to know that any other key except certain was pressed

texts:
When I'm writing a php program I often face the following situation:

step 1: '[' pressed:
Result:
[<cursor>

step 2: ']' pressed
Result:
[]<cursor>

step 3: move the cursor between '[]':
Result:
[<cursor>]

My idea was to save 1 keystroke and do step 3 automatically when '[]' sequence was pressed.

Currently I did the following:

;flag to signal us the '[' was pressed
(defvar *kb--bracket-pressed* nil)
;activate flag
(defun bracket-pressed ()
      "[ key pressed"
      (interactive)
      ;activate flag
      (setq *kb--bracket-pressed* t)
      (insert "[")
      )

(defun back-bracket-pressed ()
      "] key pressed"
      (interactive)
      (when *kb--bracket-pressed*
            (insert "]")
            (backward-char 1)
            ;deactivate flag
            (setq *kb--bracket-pressed* nil)
            )
      )

;when php-mode is activated
(local-set-key (kbd "[") 'bracket-pressed)
(local-set-key (kbd "]") 'back-bracket-pressed)

The problem is: I don't know how to reset the flag to nil, when any other key except "]" was pressed after "[".


texts: How can I stop org-mode treating a number followed by a full stop as a bullet point?

texts:
I'm using org-mode to write some documentation. After changing some wording, fill-paragraph has arranged things so there's a number followed by a full stop at the start of a line. Like this:

Blah blah blah blah blah blah blah blah blah blah blah blah blah blah
64. Blah blah blah blah blah blah blah blah

Blah blah blah blah blah.

When I export to HTML, org-mode then makes an ordered list item of that one line, making things look a mess. Is there anything I can do to indicate that a particular number followed by a full stop should never be treated as a list item?

I use the list behaviour elsewhere, so I don't want to globally disable it.


texts:
windows 10,
Emacs 26.1,
Dired+

Suppose I has 3 files and sort it by name in dired mode.

Smt like this:

OK. Now I sort it by date, press s

Here result:

OK.
Now I edit file 3.txt and after save data in this file I return to dired by press dired-jump (C-x C-j). And here result.

As you can see it again sort by name but I need to sort by date. Why dired+ not save my sort mode?


texts: Programmatically Start Clock of Specific Heading? (Org-Mode)

texts:
I'm aware of C-c C-x C-i (org-clock-in) which starts the clock on the current heading.

Question: Is there a way to programmatically target a specific heading with this command? That is, if I have

* Task A
** Task B

Is there a way for me to execute a command which starts the clock for Task B no matter where I am?

EDIT: I have since discovered helm-org-agenda-files-headings, when -- when called -- allows you to search and jump to any heading across your agenda files. This is nearly perfect except you can't programmatically go to the first match with something like (helm-org-agenda-files-headings "Task A/Task B") You can only (helm-org-agenda-files-headings) with no arguments.


texts:
Just when is it appropriate to put the asterisk * into the interactive spec of a command function? The elisp manual says the effect is to cause an error if the command is attempted in a read only buffer, so clearly this should be done when, in some sense, the command modifies the current buffer.
But this is not precise enough; is the mere possibility of a modification sufficient grounds? What about a command like untabify which could potentially modify my buffer but in fact it never does because I never use physical tab characters?
On the other hand, pretty much any command can be made a no-op by a zero prefix argument, so I guess if I wanted to be sure a modification would in fact occur I'd never use the asterisk.
I just wish the manual were more explicit about this. What is your interpretation?


texts: Using a number in register as prefix argument

texts:
How can I use a number in a register after C-u ?
For example my register looks like 1: 24, and I want to do C-u 24 x.


texts: Using replace-regexp-in-string without case folding

texts:
I'm trying to use replace-regexp-in-string (see function below) and I need to detect the boundary between a lower case and upper case character. Apparently let-binding case-fold-search to nil doesn't work? I'm trying this in the latest pretest

GNU Emacs 25.0.94.1 (x86_64-apple-darwin13.4.0, NS appkit-1265.21 Version 10.9.5 (Build 13F1603)) of 2016-05-17

as well as

GNU Emacs 24.5.1 (x86_64-apple-darwin13.4.0, NS apple-appkit-1265.21) of 2015-04-10 on builder10-9.porkrind.org

(obviously on a Mac)

(defun spread-upcase-filename (filename)
  "fooBar.h => F O O  B A R . H"
  (let ((case-fold-search nil)
        (str (replace-regexp-in-string "\\([a-z0-9]\\)\\([A-Z]+\\)"
                                       "\\1\x01\\2" filename t)))
    (setq str (mapconcat 'identity (split-string str "" t) " "))
    ;;(setq str (replace-regexp-in-string "\x01" "" str t))
    (upcase str)))

From the documentation I've seen so far, case-fold-search is supposed to be
dynamically-bound rather than lexically-bound, but it doesn't seem to have any effect.


texts: How to copy output from ess to the kill ring?

texts:
Q: how can I automatically copy output from ess to the kill ring?

Background

I use ess to conduct statistical analysis.  On occasion, I need to copy its raw output into another buffer (usually something like the raw output from xtable to a .tex file).

Doing it by hand

Right now, after I send code to the running process, I have to:

switch to the output buffer
manually mark the relevant output
copy to the kill ring
move on with my day

That's laborious, error prone, and breaks my train of thought.
Boo hiss.

Can I do it automatically?

How can I automate the first three steps?

I want to send code to the running process (R, in my case) and
copy the output to the kill ring.  Does this functionality already
exist in ess?

Related posts

(I could probably adapt the answer in this
post
if necessary, but I don't want to reinvent the wheel.)


texts: Company-mode in groovy-mode: How to get completions other than lowercase?

texts:
I'm using groovy-mode with company-mode enabled; completion suggestions are in all lowercase. Whereas, in java-mode -- a built-in package, and others such as python-mode, ruby-mode, company is giving camelCase suggestions.

How can we get similar behaviour in groovy-mode?


texts: How to attach multiple files in `message-mode`?

texts:
To attach one file when in message-mode (e.g. when posting from Gnus), one does C-c C-a. What's the recommended way for attaching multiple files ?

Repeating C-c C-a can become tiresome after a while, because it asks three questions everytime.


texts: specify global-abbrev-table in a separate file

texts:
I know one can define where abbrev files are saved with something like this

(setq abbrev-file-name "/home/zeltak/.emacs.d/abbrv/personal_abbrv.txt")

but this file has several section like (define-abbrev-table 'Buffer-menu-mode-abbrev-table '()) etc.

Is there a way to define another file that will only record the global-abbrev-table, is that possible at all?


texts: prin1: is it possible to have a progress reporter?

texts: My undo-tree history for a fair amount of editing is over 30 seconds when exporting to a string, and I'd like to see a progress reporter if that is possible.  Assuming we have (prin1 OBJECT (current-buffer)), is a progress reporter possible?


texts: org-mode, list and regular header and another list?

texts:
I like a1 / a2 / a3 to be in the same indent level.
Should I use something other than list for this purpose?
* header

  - a1

    *** bb (it's a description for a1)
      content

      - a2
       - a22
      - a3


texts: why do i get random "^[" when using eshell?

texts:
Using Eshell and the SSH command, I've logged on to a remote server. After installing a few server packages I noticed this strange thing:

Why is this happening? What can I do to prevent it?


texts: GMail 2-factor auth without application-specific password

texts:
Is there any way I can read mail with emacs that comes from a gmail account protected with compulsory 2-factor auth? Application-specific passwords are disabled for GMail by my employer. So I can't use the usual workaround of setting an application-specific password.

Google says that Apple Mail and iOS are able to do this, but doesn't explain how. And I know that Apple Mail works because one of my colleagues uses it.

Ideally I want to use IMAP, so that I can read emails from my phone too.

BTW, this is not Google's 2 factor auth but a third-party SSO provider.


texts:
When I write something like this: <2015-07-05 Sun 20:00 GMT+0>, and then try to edit it by pressing C-c ., Org removes the GMT+0 part.  So, I think it's in a wrong format.

Note: I don't want to set my time to a different timezone.  I want dates in a particular document to be in that timezone.


texts: How to limit exported column view to a filtered subset of your headings?

texts:
I have a big org-mode file using tags and TODO keywords and properties. I would like to display a summary of "Effort" estimates on
subsets of the headings with sums as we go up in the section hierarchy.

Columnview is perfect for the summing part, except it lacks any means to filter headings.

And clock table could display Effort estimates (if listed in :properties) and filter heading appropriately but won't sum Effort estimate up along the heading hierarchy, and actually do not display any heading without CLOCK set.

Any hints on how I could achieve this ?

EDIT: I managed to do this thanks to org-babel and some external python code, but that's awfully complex.


texts: Aligning org tables with rendered LaTeX formulae

texts:
Org tables do a great job in aligning columns with plain text.

But the alignment is lost when math formulas (in LaTeX) in cells are replaced with their preview.

Is it possible to preview LaTeX in tables with good alignment?


texts: key binding to reschedule agenda todo list by n days

texts:
I have created TODO/Tag match agenda view as follows,

====+=======================================================================
##### ##### ##### project dept + 3d
work:       TODO E&H TT PROBLEM in ALE                             :project:

It matches project tag and scheduled < 3days from today.

I have matched following key-binding to operate through single key in agenda itself.

⚫ Function to reschedule agenda items by a day:

(defun my/org-agenda-reschedule-week ()
(interactive)
  (org-agenda-date-later 1))

This function can schedule org "agenda" item by 1 day recursively.

⚫ Relevant key-bindings:

(eval-after-load "org-agenda"
  '(progn
    (define-key org-agenda-mode-map "m" 'my/org-agenda-reschedule-week)
    (define-key org-agenda-mode-map "x" 'my/org-agenda-done)
    (define-key org-agenda-mode-map "X" 'my/org-agenda-mark-done-and-add-followup)))

My problem is that the above-mentioned key-bindings do not work in todo/tag match list in agenda.

It gives this error,

----- start -----

Debugger entered--Lisp error: (error "Not allowed in tags-type agenda buffers")
signal(error **("Not allowed in tags-type agenda buffers")**)
error("Not allowed in %s-type agenda buffers" tags)
org-agenda-check-type(t agenda timeline)
org-agenda-date-later(1)
my/org-agenda-reschedule-week()
funcall-interactively(my/org-agenda-reschedule-week)
call-interactively(my/org-agenda-reschedule-week nil nil)
command-execute(my/org-agenda-reschedule-week)

----- end -----

It says that this commands only available in scheduled agenda type buffer, not available in tags type agenda buffer.

Is there any ways to align these tag match list with scheduled agenda items ?
what is equivalent for org-agenda-date-later function in tag matched list of agenda?


texts: mapping ,  to `comint-previous-input` and `comint-next-input`

texts:
I'd like to map <up> and <down> to  comint-previous-input and comint-next-input respectively.
I have done this successfully for shell:
(eval-after-load "shell"
  '(define-key shell-mode-map (kbd "<up>") 'comint-previous-input))
(eval-after-load "shell"
  '(define-key shell-mode-map (kbd "<down>") 'comint-next-input))

How do I do this for M-x run-haskell?
I tried:
(eval-after-load "haskell"
  '(define-key inferior-haskell-mode-map (kbd "<up>") 'comint-previous-input))
(eval-after-load "haskell"
  '(define-key inferior-haskell-mode-map (kbd "<down>") 'comint-next-input))

But it didn't work.


texts: Keyboard layout changed but I don't know why

texts: Sometimes, when I type quickly I do something that change the keyboard layout: the key that would produce < now produces |. Problem is that I don't know how I cause that and how to undo that! If I close and open again Emacs everything is fine, but I would like to avoid it. Any clue?


texts: Global key binding overriden by undo-tree

texts:
I am trying to remap globally C-/ but the undo-tree package hinders me from doing so. When calling this command (in my init file):

(global-set-key (kbd "C-/") 'left-char)

after having loaded undo-tree (of course), the binding still refers to the undo command.

Any ideas on how to override undo-tree's pervasiveness?


texts:
I sometimes explore customisable variables in Custom-mode to get a structured overview, before manually setting them with setq-default in my .emacs. Can I make Custom-mode show the Lisp names of the variables/faces in addition to the having access to the TUI widgets?

It looks like these:

custom-variable-default-form
custom-face-default-form

can be set to edit for widgets and lisp for lisp names. However:

You cannot show both. In particular, choices are not listed in lisp mode, and choices are often not listed in the description, and xref-find-definitions fails to go to the source.
They do not take priority over defcustom's :custom-form. In practice this doesn't seem likely to be an issue. My Emacs Lisp is not great, but maybe adding advice to e.g. custom-variable-value-create can override this.


texts: How can I evaluate a Python buffer, switch to it, see its results, then switch back?

texts:
Suppose, we have a buffer with Python code in it. I want to evaluate it, switch to Python buffer and see the results. Then easily switch back to code buffer.
I tried the following:
(defun my-python-mode ()
  (local-set-key (kbd "<kp-insert>")
    (lambda () (interactive)
      (elpy-shell-send-buffer-and-go)
      (elpy-shell-switch-to-shell-in-current-window)
      (let ((py-buffer (get-buffer "*Python*")))
        (message (buffer-name py-buffer))
        (if py-buffer
          (progn
  ;          (other-window 1)
            (switch-to-buffer py-buffer)
            (end-of-buffer))))))))

I added a callback to kp-insert but my function doesn't switch to python buffer when I click kp-insert. If there is no python buffer previously, it runs python interpreter, but doesn't switch to it.
(add-hook 'inferior-python-mode-hook
  (lambda ()
    (local-set-key (kbd "<kp-add>")
      lambda () (interactive)
      message "aaa")))

I tried this to switch back from interpreter, but it doesn't work.
How can I set up an ergonomic python environment in Emacs?
Update 1
I created a function that splits the window, runs the code and switches to Python buffer. Unfortunately, when there is no Python buffer, it just splits the window, but doesn't switch to buffer and doesn't send my code to Python. So I have to click the key twice. Is it possible to fix this?
(defun aaa ()
  (interactive)
  (if (= (length (window-list)) 1)
    (split-window-right))

  (elpy-shell-send-buffer-and-step)
  (let ((py-buffer (get-buffer "*Python*")))
    (other-window 1)
    (if py-buffer
      (progn
        (switch-to-buffer py-buffer)
        (end-of-buffer)
        ))))


texts: How to have list of program on `dired-do-shell-command` with Emacs server started by systemd

texts:
I'm using Emacs as a server started by the systemd user unit.
And on any dired buffer when i try to do dired-do-shell-command or dired-do-async-shell-command I cannot autocomplete any program and need to write my command "by hand".
If I start Emacs not as a server I have the desired behavior and can autocomplete on the minibuffer.
To autocomplete I use tab.

I use the unit defined on the package and Emacs version 26.

For example, if I to autocomplete after typing libr, nothing appear.
Neither with gre. But both libreoffice and grep are reachable.

When I press tab nothing is inserted, and minibuffer shows No matches.

result of getEnv "PATH" on emacs --server (emacsclient) :

~/.opam/default/bin:/usr/local/sbin:/usr/local/bin:/usr/bin

result of `getEnv "PATH" on emacs :

~/.opam/default/bin:~/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

Any idea how I could solve this issue ?


texts: Remove Org-mode tags from ASCII but not LaTeX export

texts: I'm aware of #+OPTIONS: tags:nil to have tags not be exported. I'd like them exported to LaTeX exports, but not ASCII exports. Is there a way to have options only apply to certain exports? Is there some other method to have ASCII export drop tags?


texts:
Moving around point (using the cursor keys) in Xah’s unicode.txt in fundamental-mode is noticeably slower than in an ordinary text file. Are the many non-ASCII characters the issue? Anything else?

About: GNU Emacs 25.2.1 (x86_64-w64-mingw32) of 2017-04-24 started with option -Q


texts: How can I quickly delete the trailing pathname component in ido-mode?

texts:
I use ido-mode for finding files and directories, which is generally very efficient in terms of keystrokes.

The one annoyance I've found is when deleting the trailing pathname component when using ido-find-file.  E.g., if the minibuffer contains /some/long/directory/path/and.some.long.file.name, I would like to quickly delete and.some.long.file.name with a single keystroke.  It seems hard to believe that this isn't built-in, but if so I haven't found the keybinding for it.

Is there a quick way to erase the trailing file name, or another efficient way of dealing with this?


texts:
The following code

(define-key (copy-tree global-map) (kbd "C-r") 'forward-char)

Immediately remaps C-r to forward-char. My understanding is that copy-tree will return a deepcopy of global-map. So why does editing the resulting keymap with define-key change my current global map?


texts: How can I navigate through errors after compilation in `latex-mode`?

texts:
What I mean by debugging is the ability to navigate through errors after compilation.

I read that this can be done in AUCTeX with the command C-c [backtick].  I was wondering if there was a similar command in the major latex mode from latex-mode.el.


texts:
I wish to display org mode inline image (in emacs) with width 400 but actually it always show it as original size.

My steps as below:

Install ImageMagick with below command:

sudo port install imagemagick

Install emacs with below command:

brew install emacs --HEAD --use-git-head --cocoa --with-gnutls --with-rsvg --with-imagemagick

Then I check it, emacs version is GNU Emacs 26.0.50.1, but (image-type-available-p 'imagemagick) result is nil
Edit ~/.emacs.d/init.el to add below line:

(setq org-image-actual-width nil)

Write below org code in test.org:

    #+ATTR_ORG: :width 400
    [[file:test.png]]

5. After run C-c C-x C-v,Image not displayed as 400 but actual size.


texts:
How to silence GNU Emacs on MacOS with magic mouse? Forever getting the bell and messages telling me certain mouse wheel features are undefined when hovering in certain places.  For example

<vertical-scroll-bar> <wheel-left> is undefined
<vertical-scroll-bar> <double-wheel-left> is undefined
<vertical-scroll-bar> <triple-wheel-left> is undefined [30 times]


texts: Org-Mode export table to latex with word wrap

texts:
I'm trying to export a table from org-mode to latex and have dynamic line-breaks/word-wrapping, so whenever a cell exceeds a certain length, it should wrap to the next line.
This is what the latex code should look like:
\begin{tabular}{p{0.35\linewidth}|p{0.6\linewidth}}
\end{tabular}

That seems to work when I manually edit the .tex file and convert to pdf again. Here is what my org code looks like:
#+ATTR_LATEX: :environment tabular :align p{0.35\linewidth}|p{0.6\linewidth}
...

Which produces this latex output:
\begin{tabular}{|l|l|}
...

How can I set the {|l|l|} to p{0.35\linewidth}|p{0.6\linewidth} in my org file?
Edit:
My solution was actually correct, the mistake was having the table in table.el format.


texts: lisp code not indenting after paredit slurping, etc

texts:
When I use smartparens-mode or paredit-mode to shift parens around (e.g. paredit-forward-slurp-sexp) the effected forms are not being indented appropriately. For example if I add a let and then slurp the next sexp the paren is placed appropriately but the inner form is not auto-indented.

This used to work for me but for some reason it is not now. What are some possible config problems that would prevent the auto-indentation from happening? BTW, I'm using a slightly modified version of prelude.


texts:
Is there a way to paste something into the minibuffer?
For example if I want to eval-expression and paste something in there neiter C-v or (obviously p) will work? There has to be a way.


texts: Shell Command with bash script and arguements

texts:
I have a bash script which Sweaves .Rnw files into pdf's.

sweave_to_pdf ~/Foo.Rnw

I am wanting to write a emacs function to invoke this script on the current buffer. So far I have this:

(defun sweave_to_pdf ()
  "sweave_to_pdf function"
(interactive)
(shell-command
"~/Scripts/Shell/sweave_to_pdf.sh" (buffer-file-name (window-buffer (minibuffer-selected-window))))
)

It seems the file name and path of the buffer is not being passed to the shell script as a line argument. Any ideas how I could achieve this?


texts:
I have successfully used org-capture, and have many templates.

Recently I have written a new template, where I want the target to be the location from where I am calling the capture command.

I have tried many things, and the only way I have been able to get it to work is using the Target location: Current clocking task:. This works just the way I like, except for the fact that I have to start clocking in order to capture.

Is there a way I can still gain the same functionality, without the need for clocking?


texts: helm-do-grep-ag vs helm-do-ag, differences?

texts: I don't know exactly the differences between helm-do-grep-ag and helm-do-ag, couldn't find any description. Any help appreciated! Thanks.


texts: What are the yellow-background items in Ivy?

texts:
I'm currently migrating from Helm to ivy+counsel, and I have a problem with the faces ivy applies in the minibuffer for some commands. See this example:

Some of the possible selections are highlighted with a yellow background. However, the face for the currently selected item has a yellow foreground, so it can't be read against that background.
I could of course just switch the foreground of the selected item (via the face ivy-current-match) to have a blue foreground or whatever, but I would also like to know what the difference between the items highlighted via yellow background and the non-highlighted ones is, and what face is used to do that highlighting.
Since all of this happens in a minibuffer, I can't just hit C-u C-x = to get the faces at point (or rather: I can, but I can't move the point to one of these items). Is there a way to see the faces active in the minibuffer?
This does not happen for all selections via ivy. find-file, switch-to-buffer and execute-extended-command seem unaffected (i.e., don't have background-highlighted items), but the help commands (C-h k, C-h v, C-h f etc.) are.


texts: Since upgrading to emacs 26.1 C-SPC behaviour changed and I have to press it twice to set-mark

texts:
Since upgrading to Emacs 26.1 C-SPC behaviour changed and I have to press it twice (most of the time) to set mark, which disrupts my flow and is hard on my thumb joint (don't ask).

I'd like to understand what is changed and possibly have the old behaviour reinstated. I have transient-mark-mode set to t.


texts:
I got the interleave package up and running and started using it. Now I try to M-x interleave a new document from the org file and it tries to open the document in new file Fundamental mode buffer instead of the pdf that exists on path with DocView.

Same happens when I do M-x interleave--open-notes-file-for-pdf on an already open pdf in DocView, when the org file of the same basename exists with the #+INTERLEAVE_PDF: ./basename already present.

However, my old interleaved documents (for which I wrote the header) still work both ways. And I can create an org file (that ends up creating the same header as if I would write it) from an open pdf by M-x interleave--open-notes-file-for-pdf with interleave-org-notes-dir-list set to only . or, puzzlingly an i (for insert entry for this page into notes) even when the pdf buffer only reports being in DocView mode. After that it behaves as expected.

Anyone have any ideas on how different behaviors like this could exist simultaneously? I thought that the interleaved information was contained in the org file only.


texts: How can one make Emacs visually look like sublime?

texts:
I found the following post:

http://www.gonsie.com/blorg/subl-to-emacs.html#the-best-from-sublime-text

I copied the code to my .emacs but it didn't work. Why?

code:

(eval-after-load "color-theme"
  '(progn
     (color-theme-initialize)
     (color-theme-dusk)
     (when (display-graphic-p)
       ;; settings for GUI emacs
       (add-to-list 'default-frame-alist '(background-color . "#282B35"))
       (add-to-list 'default-frame-alist '(foreground-color . "White"))
       (set-frame-font "Inconsolata 18" nil t))))


texts: using ace-jump-mode inside shell in Emacs

texts:
I am using shell in Emacs (M-x shell). Often, when I try to copy-paste a particular snippet of text from the output (say the output of a ls), I want to use ace-jump-mode to jump to a particular point on my screen but C-c+SPC seems to result to a new line and not prompt me for the head char. By using describe-key I get the following message:

C-c SPC runs the command comint-accumulate, which is an interactive compiled Lisp function. [...]

Why is the binding changed in the shell mode? In any other buffer describe-key shows the correct, anticipated binding for C-c SPC:

C-c SPC runs the command ace-jump-mode, which is an interactive Lisp function in `ace-jump-mode.el'.

How can I ensure that my ace jump bindings are not hijacked in shell ?


texts:
For example, I have a two blocks like

#+BEGIN_SRC emacs-lisp :tangle yes
;; first block
#+END_SRC

#+BEGIN_SRC emacs-lisp :tangle yes
;; second block
#+END_SRC

I need the first block to be placed after the second block in resulting file after org-babel-tangle.

Is there way to do it?


texts: Is it possible to figure out which package/script takes most of the startup time?

texts:
I used to run Emacs on Linux using Emacsclient, it is really easy and great experience:

emacs --daemon
emacsclient

When I work on a Windows machine, Emacs starts very slow. It seems there's no default support for emacsclient. So I decide to use the use-package package to reduce Emacs startup time. Since there're several packages, I'd like to know which cost the most startup time, and load it with use-package.

If I am not in the right direction, please correct me.


texts: Org mode: how to define a path variable to my org file directory?

texts:
I have code for defining org capture like:

(setq org-capture-templates '(((
         "t"               ; key
         "Todo"            ; description
         entry             ; type
         (file+headline "C:/Users/myname/Dropbox/Privat/org/abc.org" "todo"); target
         "* TODO [#B] %^{Todo} \n From: %a\n\n%?"  ; template
         :prepend t        ; properties
     )))

This code sends the generated TODO item into the org file abc.org, located at C:/Users/myname/Dropbox/Privat/org/, the target. If I want to change the location of the target to e.g. C:/Users/myname/org/, I could either do this by changing the path description inside the capture code, or better, define a path variable outside capture, telling where org file is located, and using this inside the target description like:

(file+headline "myPathVariable/abc.org" "todo"); target

where myPathVariable = "C:/Users/myname/org".

How do I define such a path variable?

Thanks for all help : )


texts:
Sometimes when I use paste in emacs the indentation gets messed up.

In vim I would use :set paste before pasting. I'm in evil mode but it says: State paste cannot be set as initial Evil state.

Is there something else I can do?

Example pasting this:

events {
  worker_connections  4096;  ## Default: 1024
}

http {
  include    conf/mime.types;
  include    /etc/nginx/proxy.conf;
  include    /etc/nginx/fastcgi.conf;
  index    index.html index.htm index.php;

  default_type application/octet-stream;
  log_format   main '$remote_addr - $remote_user [$time_local]  $status '
    '"$request" $body_bytes_sent "$http_referer" '

Ends up like this:

http {
  include    conf/mime.types;
    include    /etc/nginx/proxy.conf;
      include    /etc/nginx/fastcgi.conf;
        index    index.html index.htm index.php;

  default_type application/octet-stream;
    log_format   main '$remote_addr - $remote_user [$time_local]  $status '
    '"$request" $body_bytes_sent "$http_referer" '


texts: Is there a simple way to copy my current buffer into a new buffer?

texts:
Say I'm editing a file ~/mydirectory/foo.txt.

I'd like to be able to issue a command M-x switch-to-bar-file that copies current contents of  ~/mydirectory/foo.txt to a file ~/mydirectory/foo-bar.txt and drops me into a new buffer where I can edit ~/mydirectory/foo-bar.txt.

When I'm done editing ~/mydirectory/foo-bar.txt, I'd like to issue a command M-x unswitch-from-bar-file which copies the current contents of ~/mydirectory/foo-bar.txt back over to ~/mydirectory/foo.txt and drops me back into the buffer where I can edit ~/mydirectory/foo.txt.

It seems that there may be a way to do this with indirect buffers, but I can't quite figure out how to solve my problem.

Is this sort of thing possible?

I can post an example if that would help.


texts: Org-mode: changing temporarily font size for LaTeX export

texts:
I need to change the font size of part of my text (actually
mostly to fit a table, which might be an extra-step).
Following a org-mode discussion somewhere, I have tried the following, which does not work for me in spacemacs 0.3 with Emacs 27:
    #+title: Test changing font size

* Text
Nemo enim ipsam voluptatem, quia voluptas sit, aspernatur aut odit aut fugit,
sed quia consequuntur magni dolores eos

#+begin_latex
{\scriptsize
#+end_latex
| Table | Column  |
|-------+---------|
| Row   | Content |

#+begin_latex
}
#+end_latex

#+begin_latex
{\ssmall
#+end_latex
qui ratione voluptatem sequi nesciunt, neque porro quisquam est
#+begin_latex
}
#+end_latex

Regards,
Trad


texts:
I have a propertized string. I want to make a deep copy of it to add more properties, while
preserving the properties in the original string. How can I do that (easily)?

Example

Evaluate one-by-one :

(setq test-str-1
      #(";; This `is' a test"
        0 3 (fontified nil face font-lock-comment-delimiter-face)
        3 9 (fontified nil face font-lock-comment-face)
        9 11 (fontified nil face (font-lock-constant-face font-lock-comment-face))
        11 19 (fontified nil face font-lock-comment-face)))
(setq test-str-2 (concat test-str-1))
(add-face-text-property 0 (length test-str-2) 'foobar t test-str-2)

And the result:

test-str-2
;; =>
#(";; This `is' a test" 0 3 (fontified nil face (font-lock-comment-delimiter-face foobar))
  3 9 (fontified nil face (font-lock-comment-face foobar))
  9 11 (fontified nil face (font-lock-constant-face font-lock-comment-face foobar))
  11 19 (fontified nil face (font-lock-comment-face foobar)))
test-str-1
;; =>
#(";; This `is' a test" 0 3 (face font-lock-comment-delimiter-face fontified nil)
  3 9 (face font-lock-comment-face fontified nil)
  9 11 (face (font-lock-constant-face font-lock-comment-face foobar) ; <= foobar is here
        fontified nil)
  11 19 (face font-lock-comment-face fontified nil))


texts: Dired+. Mouse click - open folder in the same window

texts:
When I open a folder by pressing "Enter" it will open in the same window:

This behavior is OK and basically what I expect.

But when I try to open a folder by clicking with the left mouse button the folder will open in another window:

I would like to open the folder in the same window no matter if I use the keyboard or click with the mouse.

How I can do this with Emacs 25.1, and Dired+, in Windows 10?


texts: Extraneous output of org-mode inline source block results in org

texts:
Context:

M-x org-version => Org-mode version 8.3.1 (8.3.1-95-g1dbb25-elpaplus @ /Users/username-here/elisp/elpa/org-plus-contrib-20150831/)

Executing:

src_R[:results value]{sin(0)}

Yields:

{{{results(=0=)}}}

Before I updated to this latest version of org-plus-contrib, i.e., when I was using org from git source, it yielded:

=0=

Have others run into this (my google search didn't yield anthing)? Can you help me determine the issue?

Thanks in advance


texts: Setting relative line numbers when in programming modes

texts:
Looking to set relative line numbers when in programming modes.
Looking through the older posts I see a way to set line numbers based on the mode - How do I display line numbers in emacs (not in the mode line)? :

  @AnthonyB : (add-hook 'prog-mode-hook 'linum-mode)

Currently, use (setq-default display-line-numbers 'relative) in my init file for relative line numbers, however, would like to use this setting on a per mode basis partially all programming modes.


texts: org-mode and file column indicator (fci-mode)

texts:
When using the fill-column-indicator package with org mode, I get wrong argument errors when exiting the source block editing window, issues with utf-8 character artefacts in source blocks exported to html and some other minor quirks. How can you fix this?

Current emacs 25.1 and org-mode 9.0.5


texts: Org-mode #+include: -- ignore configuration lines from included file

texts:
How can I have org #+INCLUDE: ignore configurations from the included files? I'm thinking of cases where I don't want Latex Classes to be messed up. For example, if I have two org files book.org and chapter.org that look like the following:

book.org

#+LATEX_CLASS: book
* Chapter 1
#+INCLUDE: chapter.org

chapter.org

#+LATEX_CLASS: report
* Results

Then on export (to another Org file) I get the following:

#+LATEX_CLASS: book
* Chapter 1
#+LATEX_CLASS: report
** Results

This is not good because a latex-export may get messed up (the last latex_class takes precedence, so I would end up with a report and not a book). What is the recommended way to avoid these issues?


texts: Insert string output of shell-command in current buffer

texts:
The code below calls upon a Python script to generate pinyin from Chinese characters in region:

(defun pinyin ()
  "Generate Pinyin from Chinese Characters with Python script, keeping the original Chinese characters intact."
  (interactive)
  (let ((cmdStr
         (format
          "python3 -c \"import pinyin; print(pinyin.get(\'%s\', delimiter=\' \'))\""
          (buffer-substring (region-beginning) (region-end)))))
    (insert
     (format "\n%s"
             (shell-command cmdStr (buffer-file-name))))))

I would like the script to insert the pinyin on a new line under the selected Chinese characters.

The above script correctly displays the desired output in the mini-buffer but inserts 0 at the place where the pinyin should be.

What went wrong and how can I get this working properly?


texts: How to get the commit history for a specific developer in Magit?

texts:
Using the command ll in magit would get the complete commit history, but how can one show only the commits by an individual developer?

I checked the cheetsheet but can't find a valid solution.


texts: Generating output in a different language with org mode

texts:
Given the following is intended to generate C++ code:

#+BEGIN_SRC python :exports both :results output code
print "struct Whatever{};"
#+END_SRC

The result is inserted as follows:

#+RESULTS:
#+BEGIN_SRC python
struct Whatever{};
#+END_SRC

Which is clearly not formatted as C++. How could I get it so that org generates the following:

#+RESULTS:
#+BEGIN_SRC c++
struct Whatever{};
#+END_SRC

Thanks


texts:
~Emacs 2.4.1 under Linux.

I would like to use the {est+} feature of column views as documented here.

I customized
org-columns-default-Format to be like this: (see last field)

%50ITEM %TODO %3PRIORITY %TAGS %CLOCKSUM_T(tod) %CLOCKSUM(sum) %5EST{est+}

And a property
:EST: 1-2

But when I try to activate column view in agenda, I get an error:
wrong type: sequencep, 0

I tried different format for est: (I'm not sure about syntax of the {est+} property btw?)
:EST: 1-2
:EST: 1:00-2:00
:EST: 1.0-1.1
:EST: 1d/2d

From what I gather in this thread, the correct syntax is 2-4, but that hasn't worked.

In this thread it appears someone has the same issue as me (Dec 2014) but it's not clear if the issue was solved or not.

If I replace %5EST{est+} with   %5EST{:} and only use single digits or time (20:20), then column view works. But it's not quite what I want.

Thoughts?


texts: ox-reveal not shown in org-export-dispatch

texts:
I've installed ox-reveal package from MELPA with package-install ox-reveal and added in the configuration file the following:

(setq org-reveal-root "http://cdn.jsdelivr.net/reveal.js/3.0.0/")

However, when I try to export a test presentation with C-c C-e I don't see an entry for reveal.

I've tried requiring the package with:

(require 'ox-reveal)
(setq org-reveal-root "http://cdn.jsdelivr.net/reveal.js/3.0.0/")

But that gives me the following error when Emacs starts:

  error: Required feature ‘ox-reveal’ was not provided

Is there something I'm missing?

PS: I'm using Emacs on Cygwing and here's the package versions

org                20161118
ox-reveal          20161027.226


texts: Use RefTeX to manage a global bib database

texts:
I would like to have the following workflow. First, I create a global bib file, which contains all bibliography entries that I may use across all projects. Then, for each project, I can create an empty bib file for that project (or use reftex-create-bibtex-file). Whenever I call reftex-citation, that entry in the global bib file was copied to the project specific bib file.

Is this possible in Emacs?


texts: Emacs build error when use "autogen.sh all" to generate configure for master branch

texts:
I just cloned the source and try to build Emacs under my debian Jessie, but has some problems:

[23:31:04 coeus]$ ./autogen.sh all
Checking whether you have the necessary tools...
(Read INSTALL.REPO for more details on building Emacs)
Checking for autoconf (need at least version 2.65)...
ok
Checking for automake (need at least version 1.11)...
ok
Your system has the required tools.
Running 'autoreconf -fi -I m4' ...
Configuring local git repository...
cp: cannot stat ‘--git-common-dir/config’: No such file or directory

May I know what I have missed? I didn't do this for a while, but I did successfully build emacs from master branch in past. any help will be appreciated.

Coeus


texts: How can I prevent pasting after org-copy-visible leaving cursor at end of text?

texts:
In evil-mode, if I use 3yy to copy three lines, then move somewhere else in my file and do P (evil-paste-before), the three lines are pasted before the line with the cursor, and the cursor is left at the top of the pasted text.
If however I copy a section of text using org-copy-visible and paste that using P, the cursor ends up at the bottom of the pasted text.
I can get the desired result (cursor left at start of text) in the latter case if I subsequently do an undo / redo but that is too hacky even for me.
How can I paste following a call to org-copy-visible and leave the cursor at the start of the pasted text?


texts: Problem with line number limit in linum-mode

texts:
I am using the term of Emacs to compile some code, with linum-mode enabled to display the line numbers for the terminal, and the line numbers stop increasing as soon as they reach 2049.

If I write source code and I reach 2049 lines will this happen too?  Why is that happening? Shouldn't the numbers keep increasing?


texts: How to force `condition-case` to activate the debugger

texts:
Often times I need to debug code wrapped in the BODYFORM of condition-case; however, the debugger is suppressed even though I have debug-on-error set to t.  The doc-string states that we can add debug to the list of handlers, but I didn't find a good example by Googling of how this might be accomplished.  Modifying the code of something that I am trying to debug to add a handler seems rather inefficient.

Is there an approach to force condition-case to always generate a debugging message without modifying the section of code that I am trying to debug?  If not, then an explanation why along with a sample of how to use debug as a handler would be an acceptable answer.


texts:
For some tasks like using ruby's pry and tmux both eshell and shell do not behave well. I tried to use term, but my innability to override the keybindings in term makes its use annoying.

How can I set, say, M-o as other-window and M-k as kill-buffer when using term ?


texts: Set different fonts for different charsets

texts:
I'm new to Emacs, and would like to know how to append my init.el file to use specific fonts for different languages. Specifically, for English (and other Latin-based languages, I guess) I would like Emacs to use DeJaVu Mono, but for Thai I would like it to use TH Sarabun

I have read https://www.gnu.org/software/emacs/manual/html_node/emacs/Fontsets.html and will admit that I understand nothing on that page.

I'm actually trying to set up emacs to be an environment to write linguistic documentation, and am not a programmer, though I am willing to learn, though perhaps I need some hand holding, as I've never attempted something like this before.

Thanks


texts: How to autoscroll a window to always show the end of a growing buffer?

texts:
Context: I have a window that shows the output of a shell command.  As new lines are added, I'd like the window to always show the most recent lines.  Example:

(let ((temp-window (or (get-buffer-window "*test*")
                       (split-window-below -10))))
  (start-process-shell-command
   "test-process"
   "*test*"
   "sleep 1; ps -ax")
  (set-window-buffer temp-window "*test*"))

For reasons that I don't understand, the window scrolls the first time this code is executed but not the second time (when the buffer already exists).

I'm on Emacs 26.0.60 on Ubuntu 16.04.


texts:
When choosing a project using helm-projectile-switch-project one can type C-d to run dired on that project root directory.

Running describe-key on C-d returns the following function:

#[nil "\300\301!\207" [helm-exit-and-execute-action dired]
2 nil nil]

Any pointers on where I can read about on how to make sense of this notation? This looks like a "printed notation", yet I'm unable to find it in the docs.