texts:
I have such a table

  | C                   | M                   |
  |---------------------+---------------------|
  | Character           | Word                |
  |---------------------+---------------------|

I want to swap the positions of Characters and word and perform the following operation:

M-d to kill "Character" and "word" respectively.
Cursor on "word" position, yank C-y and rotate with M-y, then "word" is replaced with "Character"
Back to left column, do yanking with C-y, it's "Character", rotate through with M-y, it provide other content rather than "Word",

On this moment, "Word" is gone.

How could I reverse the rotating of yanking ring?


texts: Finding the place where auto-fill-mode is getting enabled and disabling it

texts:
So, whenever I open a new buffer, auto-fill-mode is enabled. I have checked my configuration and have verified that I'm not enabling it in the init.el file. How do I find out from where it is getting enabled ?

Also, how do I disable it in a certain mode like html-mode. I tried some suggestions in this thread but this doesn't seem to work for me:

(remove-hook 'html-mode-hook 'turn-on-auto-fill)


texts: Why are results prefaced with colon in ob-ipython?

texts:
I'm trying to evaluate the following code in emacs, using ob-ipython

#+BEGIN_SRC ipython :session :results output
lstt = ["2","3"]
for l in lstt:
  print l
#+END_SRC

But it returns

#+RESULTS:
: 2
: 3

Why am I seeing the colon at the beginning of the results section?


texts: Why multiple-cursor ask me on every line? How avoid this?

texts:
emacs 26.1, multiple-cursor https://github.com/magnars/multiple-cursors.el

Here my custom Elisp function that add some number(by default 1) to number.

(defun increment-number-at-point(number)
  (interactive (list (read-number "Input increment number: " 1)))
  (skip-chars-backward "0-9")
  (or (looking-at "[0-9]+")
      (error "No number at point"))
  (replace-match (number-to-string (+ number (string-to-number (match-string 0))))))

(global-set-key (kbd "C-c +") 'increment-number-at-point)

Nice it's work fine. But suppose I has this json and want to add to every id the number 400.
Example json:

[
  {
    "id": 0,
    "finished": 2,
    "orgn": 17
  },
  {
    "id": 1,
    "finished": 3,
    "orgn": 17
  },
  {
    "id": 2,
    "finished": 4,
    "orgn": 17
  },
  {
    "id": 3,
    "finished": 5,
    "orgn": 17
  }
]

The result must be:

[
  {
    "id": 400,
    "finished": 2,
    "orgn": 17
  },
  {
    "id": 401,
    "orgn": 17
  },
  {
    "id": 402,
    "orgn": 17
  },
  {
    "id": 403,
    "orgn": 17
  }
]

here my steps (use my custom function and multiple-cursor)

Use C-c + (increment-number-at-point)

Input 400 RET
It's AGAIN ask me about  number

So it ask my about number ON EVERY LINE. It's not good.

Is it possible to set ONLY ONCE number (400) and replace on every line automatic?


texts:
I am using emacs on windows 7. Emacs is located on a usb on a university computer with no admin access but correctly loads the .emacs file. In my .emacs file I have

(custom-set-variables
 '(package-archives
   (quote
    (("gnu" . "http://elpa.gnu.org/packages/")
     ("melpa" . "https://melpa.org/packages/")))))
(custom-set-faces)

When I try load package-list I get
Failed to download ‘melpa-stable’ archive.

Any ideas? Thanks in advance!


texts: How can I bind a key-sequence ending in `C-h`?

texts:
Evil-mode binds C-wh to evil-window-left. I'd like to bind C-wC-h to the same so it will work whether or not I lift my finger off the Control key in time. But C-h is the help key. Is there any reasonable workaround for this?

I'm willing to lose the Help functions on C-h since I can access them elsewhere, like F1.

Update: I may have found the solution.

(define-key evil-normal-state-map "\C-w\C-h" 'evil-window-left)

This seems to work without affecting C-h behavior in other cases.


texts:
The following code is an excerpt from the elisp tutorial, section 14.6.

(while (re-search-forward "^(defun" nil t)
    (setq lengths-list (cons (count-words-in-defun) lengths-list)))

Placing the cursor just before the code and executing (forward-sexp) will fail, because of the ( symbol imbedded in the regexp "^(defun".  My ugly remedy is below:

(setq my-regexp (concat "^" (char-to-string 40) "defun"))
(while (re-search-forward my-regexp nil t)
    (setq lengths-list (cons (count-words-in-defun) lengths-list)))

Is there a less ugly approach?  Alternatively, is there a wrapper for (forward-sexp) that provides optional arguments to ignore imbedded quotes and ignore imbedded comments (e.g. ;...)?

If not, I will reference this posting as a feature request for both forward-sexp and backward-sexp.


texts:
I employed find within the current directory to find files containing "emacs"

$ find . -type f -iname "*emacs*" | nl | tail -3
    34  ./sources/tech/20190916 The Emacs Series Exploring ts.el.md
    35  ./sources/tech/20200311 What you need to know about variables in Emacs.md
    36  ./sources/tech/20191009 The Emacs Series ht.el- The Hash Table Library for Emacs.md

Get a result of 36 files,

When come to Emacs "find-name-dired", but find only one file

2637215      8 -rw-rw-r--   1 me   me       7708 Dec 19 20:48 sources/tech/20191218\ Emacs\ for\ Vim\ users-\ Getting\ started\ with\ the\ Spacemacs\ text\ editor.md

What's the problem?


texts:
I want to center an image in my project's GitHub README.org file, but everything I've tried so far hasn't worked:

#+ATTR_HTML style="center"
[[/path/to/img.png]]

#+ATTR_HTML align="center"
[[/path/to/img.png]]

#+begin_center
[[/path/to/img.png]]
#+end_center

Is this possible, or should I just go the low-friction route and use Markdown?


texts: How to highlight “constexpr” in cc-mode?

texts:
Question

Pretty straightforward: How to highlight constexpr in cc-mode (editing C++ code)?

Example

If I use const as in the following example

const double = 3.14

const gets highlighted as a keyword(1) (i.e., in pink), while if I write

constexpr double = 3.14

constexpr gets highlighted as all-faces (i.e., no highlighting at all).

Ideally, a simple solution like writing

(add-to-keywords "constexpr") ;; pseudo-code

in my .emacs without tinkering with the code of cc-mode would be the best for me.

Addendum

This question might be related: Change the way CC-mode font-lock the C++11 auto syntax.

Note

 (1) I think that it is a keyword because placing the pointer on the word and doing M-x customize-face RET I get: Customize face (default ``font-lock-keyword-face'): and pressing RET I get redirected to the “Easy Customization” wizard.


texts: What is the easiest way to open the folder containing the current file by the default explorer of the OS?

texts: What is the easiest way to open the folder containing the current file by the default explorer of the OS (e.g. explorer.exe in the case of Windows OS)?


texts: If longlines-mode is removed in new emacs, how can I soft-wrap the line around the column instead of window edge?

texts: I'm now trying to switch from Vim to Spacemacs. It seems that Longlines Mode is the way to go in Emacs to soft-wrap the line around the column http://emacswiki.org/emacs/LineWrap. However it seems that this mode has been removed since Emacs 24.4 http://www.emacswiki.org/emacs/LongLines, in favor of Visual Line Mode, which soft-wraps the text around the window edge... Which is not exactly what I want. How am I able to get the functionality of longlines mode back? I see a longlines.el at http://www.emacswiki.org/emacs/longlines.el, should I just manually download the file and add it to Spacemacs configuration layer?


texts: Unable to use emacsclient with emacs server when running mac port of emacs

texts:
I am running the mac port version of emacs that I installed via homebrew (see here). I'm also trying to run  the Emacs server to avoid long startup times.

To do this, I first run the server:

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

This process appears to complete successfully. The next step is to start an emacs client like so:

/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -n -c

However, when I run this command, nothing happens at all. If I run the command, without the -c option, a client opens in the terminal, but I want to run Eamcs in Cocoa.

Has anyone run into this problem?


texts: dired+ does not respect listing dired-listing-switches

texts:
I'm having problems getting dired to list directory contents correctly after I install dired+. To demonstrate, below is an example of how dired lists directory contents before installing dired+:

This is what I expect. Furthermore, I've updated my .emacs file to use the following listing switches:

(setq dired-listing-switches "-alh")

Now, after I install dired+, my dired-listing-switches are not respected anymore. Below is an image that shows how dired lists directory contents after I install dired+

I have added the following to my .emacs file

(require 'dired+)
(setq dired-listing-switches "-alh")

I should mention that I'm using GNU Emacs 26.0.50.2 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2016-10-22.

Any ideas? Thanks in advance!


texts:
I installed powerthesaurus package from MELPA. This package finds out synnyms of selected words from powerthesaurus.org.
I installed all the dependencies (dom - to be specific which did not get installed by default).

However, when I run the command M-x powerthesaurus-lookup-word, I get the following in my *Messages* buffer.

Opening TLS connection to `www.powerthesaurus.org'...
Opening TLS connection with `gnutls-cli --insecure -p 443 www.powerthesaurus.org'...failed
Opening TLS connection with `gnutls-cli --insecure -p 443 www.powerthesaurus.org --protocols ssl3'...failed
Opening TLS connection with `openssl s_client -connect www.powerthesaurus.org:443 -no_ssl2 -ign_eof'...failed
Opening TLS connection to `www.powerthesaurus.org'...failed

What am I missing? Why is this connection not working?
I'm able to visit www.powerthesaurus.org through my browser

P.S: I'm using this Windows 7 machine in an office network - if that helps


texts: Regex to check for a markdown link at point

texts:
I am trying to develop a regex to check if points is within a GitHub markdown link to a wiki page, and then extract that page name. For example

some text [link_name](https://github.com/user/wiki/Tool-info) more text

If point is between the [ and the ) and the user clicks a keyboard shortcut, I would like to extract the name of the wiki page, namely Tool-info..

Here is what I have:

(defun test-wiki ()
  (interactive)
  (let ((name nil) (m-beginning nil))
    (save-excursion
      (if (char-equal (char-after) ?\[)
          (setq m-beginning t)
        (when (looking-back "\\[[^)]*?" (line-beginning-position))
          (setq m-beginning t)
          (goto-char (match-beginning 0))))
      (when m-beginning
        (when (looking-at "\\[[\\w]+?\\](\\([:/.\\w]+?\\))")
          (setq name (match-string 1)))))
    (if name
        (message name)
      (message "No match"))))

Currently, this gives message "No match" in all cases..


texts: Custom Major Mode - Regex to find word before equal sign and set font-lock-variable-name-face

texts:
I'm trying to create my own major mode. So far I've been able to set all the syntax highlighting that I need, but I'm struggling with this one.

Basically I need to color any word before an equal sign. Like this:

< action name="set_button">

Like the face nxml-attribute-local-name in nxml-mode.

To do this I'm using a regular expression to find that word and then set font-lock-variable-name-face.

I've tried the following regular expressions, but they didn't work. I don't know if it's because I'm not escaping them correctly or because emacs doesn't support them.

 ("\\(\w+\\)\\(?=\s*=\\)" . font-lock-variable-name-face)
 ("\b\\(\w+\\)\b=" . font-lock-variable-name-face)

There is nothing wrong with the elisp code. When I try a more simple regex it works.

Any ideas?

Thanks


texts: How to suppress output of link with elisp function in org-mode?

texts:
When using elisp function in the link in org-mode, like

[[elisp:(func)][text]]

after clicking the link, the function itself will be printed in *Message* buffer. How should I prevent it from being printed? I've tried

(let ((inhibit-output t))
  (...))

but it doesn't work.


texts: Can't run command using C-. keybinding with Evil

texts:
I'm trying to use racket-mode for programming Racket.  One of the racket-mode commands is bound to C-c C-. (control c, control period).
However, whenever I try to press C-c C-., it appears to get interpreted as C-c . (control c, period).
How can I go about debugging why this is happening?
My guess is that this is caused because I am using evil.  If I run describe-key and type C-., a *Help* buffer is opened for the command evil-repeat, which is bound to ..
Is evil somehow ignoring the Control key whenever it sees .?  How can I tell it to not do this?


texts: Cannot turn on global-auto-complete-mode

texts:
I installed auto-complete by M-x list-packages, navigating to the auto-complete package, and hit the Install button. The emacswiki page says that doing so will configure the load-path so auto-complete.el will be loaded correctly.

I have this in my init.el

(require 'auto-complete)
(global-auto-complete-mode t)

and emacs gives the following error:
File error: Cannot open load file, not a directory, auto-complete

I tried adding the directory containing auto-complete.el to the load-path but it still gives me the same error.


texts: How do I disable all pre-existing yasnippet snippets?  I only want to use ones that I define myself.


texts: Count repetitions of repetitive events in org mode agenda

texts:
I have my classes scheduled using diary style time intervals like this:

* 10:30-13:00 Classes
    <%%(and (diary-block 3 7 2016 6 29 2016) (= 3 (calendar-day-of-week date)) (not (diary-block 3 25 2016 4 1 2016)) (not (calendar-date-equal '(4 6 2016) date)))>

They are shown in agenda correctly like:

school:    10:30-13:00 Classes                                    :tag1:tag2::

I want to count its repetitions and make repetition count visible in agenda view this way (or similar):

school:    (12/23): 10:30-13:00 Classes                           :tag1:tag2::

By the way, this wanted format in agenda is already available when you make an event that extends over few days in a row. So, this:

* Some
  <2016-04-10 sun>--<2016-04-13 wed>

will show up in agenda just like I want:

school:   (3/4):  Some

How to make my classes event show its repetition count in agenda view?


texts: How to link to a header that is only an external link?

texts:
Say there is a file a.org with the following link as a header:

** [[./projects.html][Software & Services]]

How can it be linked to (from another file)?

[[file:a.org::*Software & Services]] did not work. Neither did [[file:a.org::[[./projects.html][Software & Services]]]].


texts: org-caldav/oauth2/plstore asking for passphrase many times

texts:
I have been struggling to set up org-caldav with (multiple) google calendar(s) for some time. Syncing works, but one remaining annoying problem is that I am asked for the passphrase many (5-many) times, even though I have set plstore-cache-passphrase-for-symmetric-encryption. Does anyone recognise the problem and/or have a fix?

I'm using ubuntu 14.04, emacs-version 25.1.1, org-version: 9.1.14.


texts: Can't get automated c++ docstrings to work

texts:
I stumbled this thread and at first, it seems glorious, but I simply cannot get it to work. So when I try it on any program e.g.:

#include <iostream>

bool helloWorld(int a,int b){
    dox<tab>
    std::cout << a << b << std::endl;
    return true
}

int main(){
std::cout << helloWorld(123, 321) std::endl;
return 0;
}

even though I have semantic-, doxy- and yas-mode enabled, it returns:

function: main (start)
[yas] Error running #[128 \302\300\303\301""\207 [eval ((progn (unless
    (and (fboundp (quote semantic-current-tag)) semantic-mode)
    (error Semantic required to use dox snippet)) (let ((tag
    (senator-next-tag))) (while (or (null tag) (not (semantic-tag-of-class-p
    tag (quote function)))) (setq tag (senator-next-tag))) (let* ((name
    (semantic-tag-name tag)) (attrs (semantic-tag-attributes tag))
    (args (plist-get attrs :arguments)) (return-name (plist-get attrs :type))
    (idx 1)) (if (listp return-name) (setq return-name (car return-name)))
    (yas/expand-snippet (format /**
* @brief ${1:%s}
*
%s
%s*/
name (mapconcat (lambda (x) (format * @param %s ${%d:Description of %s} (car x)
    (incf idx) (car x))) args
) (if (and return-name (not (string-equal void return-name)))
    (format  * @return ${%d:%s}
(incf idx) return-name) ))))))) apply append] 6

(fn &rest ARGS2)]: Symbol’s function definition is void: incf

I'm currently running ubuntu 16.04 and emacs25


texts: do not keep org-agenda-files open after generating agenda

texts:
Generating today's agenda in Org-Mode (C-c a a) opens the files in org-agenda-files.  I don't want Emacs to open these extra buffers.

Is there an easy way to tell Emacs not to open these buffers? (or what is the same, to automatically close them if they weren't open before calling the agenda?).

UPDATE:

This is a more compact version of the solution provided by @lawlist:

(require 'dash)

(defun my-org-keep-quiet (orig-fun &rest args)
  (let ((buffers-pre (-filter #'get-file-buffer (org-agenda-files))))
    (apply orig-fun args)
    (let* ((buffers-post (-filter #'get-file-buffer (org-agenda-files)))
           (buffers-new  (-difference buffers-post buffers-pre)))
      (mapcar (lambda (file) (kill-buffer (get-file-buffer file))) buffers-new))))

(advice-add 'org-agenda-list :around #'my-org-keep-quiet)
(advice-add 'org-search-view :around #'my-org-keep-quiet)
(advice-add 'org-tags-view   :around #'my-org-keep-quiet)

Regrettably, this still is not perfect, as now clicking on an event in the agenda does not open the corresponding org file.


texts: org-mode : add an attribute or a property to the result of a call

texts:
Let suppose our program output many formatted tables.

For instance :

#+Name: Scores
#+BEGIN_SRC python :results output raw

from random import randint
li ='''Max Charlie Cooper Buddy Jack Rocky Oliver Bear Duke Tucker'''.split()
print(  "|{0:8s}| {1:3s} | {2:3s} | {3:3s} |".format(
      "Name","str","agi","int"
))

for f in li:
  print("|{0:8s}| {1:3d} | {2:3d} | {3:3d} |".format(
     *( [f]+[randint(0,20) for x in range(3)])
  ))

#+END_SRC

#+Call: Scores()

The evaluation of the code block will produce an output similar to this

#+RESULTS:
| Name    | str | agi | int |
| Max     |  17 |  15 |  16 |
| Charlie |   2 |   5 |  19 |
| Cooper  |   3 |   5 |   5 |
| Buddy   |   9 |   6 |   9 |
| Jack    |  11 |  14 |  19 |
| Rocky   |  19 |   1 |   2 |
| Oliver  |   5 |  17 |   5 |
| Bear    |   0 |  17 |  17 |
| Duke    |  16 |   8 |  19 |
| Tucker  |  14 |  13 |   9 |

When exporting, the #+CALL is evaluated,
and its results gets exported.

Question: how to automate the insertion of something like

#+ATTR_LaTeX: :center nil :align |p{5cm}|l|l|l|

on top of the table in the results section ?

Any proposal is welcome, be it by outputting by value, hooking the export, creating a latex header... or indicating any appropriate org function.


texts: Bind multiple values directly from list without binding the list itself

texts:
Is it possible to assign multiple return values directly to variables without going through a temporary variable in Emacs Lisp?

For example, let's say I have a function that returns a list of two lists:

(defun test-func ()
  (setq a '(a b))
  (setq b '(c d))
  `(,a ,b))

If I want to assign the first return value to list-a and the second return value to list-b, I can do this by using a temporary variable temp, for example:

(let* ((temp (test-func)) (list-a (car temp)) (list-b (cadr temp)))
  (message-box (prin1-to-string list-a))
  (message-box (prin1-to-string list-b)))

Is it possible to do this more simply? (I am used to Perl and Python where you do not have to specify a temporary variable)


texts: How to make backspace respect tab-stops when there is only preceeding white-space?

texts: When pressing backspace, it deletes a single character, however, I would like it to go back the the previous tab-stop level in the case there is only preceding white-space.


texts: org-mode deck.js or reveal.js: inline figure and 2 column

texts:
How do I create a deck.js or reveal.js presentation in org-mode that has the following formatting:

a figure inlined into running text, that is, not on a separate line,
two columns of material, usually with one column of text and the other being a figure.

I've done considerable searching w/o finding any answers.  These are possible with beamer, but IMO it doesn't look as good.   Thanks.

Also is there any reason to prefer between deck and reveal?   I'm writing scientific presentations.

My system:

uname -a
Linux w540 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

emacs-version is a variable defined in `C source code'.
Its value is "24.5.1"

org-version is a variable defined in `org.el'.
Its value is "8.3.5"

ox-reveal          20160719.28


texts: quick insert pre stored commands to dired-do-async-shell-command

texts:
Does anyone know or has coded some mechanism (using helm/swiper/other) to quickly insert complex commands when issuing dired-do-async-shell-command?

For example I want to stand on a folder and issue:

filebot -script fn:amc --output "~/ZH_tmp/fbt/" --action copy -non-strict "DIRED FOLDERFILE" --log-file amc.log --def excludeList=amc.txt

I hate to manually enter it or paste it each time.

I was thinking it could be cool to press & (with a prefix or a function) and then be presented with a list of command I can quick filter via helm/swiper and enter into dired.


texts: Where do folks go to search for elisp packages

texts:
I'm looking for a package that converts

United States to us
Netherlands to nl

Where does one go to find Elisp packages?

For Ruby there's rubygems.org, for example.


texts: Soft-require a feature, then conditionally run more commands

texts:
What's the idiomatic Emacs way to soft-require a feature, then use that feature if it's available?

The require function allows “soft require” by specifying a non-nil third argument:

(require 'projectile nil 'missing-okay)

What's the best way to then use that feature to do more things, only if the feature is now present?

(if succeeds
 (require 'projectile nil 'missing-okay)
 (do-some-stuff-that-needs-projectile))

or

(require 'projectile nil 'missing-okay)
(when feature-is-available 'projectile
 (do-some-stuff-that-needs-projectile))

or something else?


texts:
Did anyone use undo tree in spacemacs? I configured it in spacemacs

 (global-undo-tree-mode 1)

but it doens't work. how to let it work?

It shows the error message of
"unrecognized entry in undo list undo-tree-canary"


texts: TeXLive 2017 generates "LaTeX: problems after  pages"

texts:
I just upgraded to TeXLive 2017 as I needed one of the package updates. Now, whenever I process a file, I get the message above (I'm on Mac OS Sierra). It appears that the file processes correctly and that the error message is erroneous. From some searching, it seems that this might be an AUCTeX bug (see for example here.

Now, I use Aquamacs, which ships with AUCTeX preloaded. So I have a few questions that I'm hoping someone can answer:

Is this in fact an AUCTeX bug? If not, what?
Does the file process correctly even with the error message?
Can I safely place a new AUCTeX version on top of the current Aquamacs version (which is in fact the latest Aquamacs version)? If not, does anyone know when or if Aquamacs will be upgraded to use the newer AUCTex?


texts: configure gnus to read and send emails with thunderbird

texts:
Can we configure gnus to use an external mail retrieval (like thunderbird) to read and send emails?

What I mean is let the external application do the job of connecting to the mail server and use gnus to read and type emails.


texts: write-file-functions: Clarification as to permanent local behavior with add-hook

texts:
According to the write-file-functions doc-string, "[t]his variable's value is permanent if it is given a local binding."

Step 1:  Start from emacs -q using Emacs 25.2.1.
Step 2:  Switch to the *scratch* buffer.
Step 3:  Type the following in the *scratch* buffer, so that it gets modified and so that we can later evaluate what we typed.

(add-hook 'write-file-functions (lambda () (message "hello-world")) 'append 'local)
Step 4:  Evaluate the statement that we typed in Step 3 above -- e.g., C-x C-e
Step 5:  M-x save-buffer and save it anywhere that is appropriate.  I chose to call the file foo and I saved it as ~/Desktop/foo
Step 6:  M-x describe-variable RET write-file-functions RET; or, C-h v and then the name of the variable we are looking up.

write-file-functions is a variable defined in ‘files.el’.

Its value is nil

I expected the write-file-functions hook to maintain the original value because it is permanent when given a local binding.  Why is my assumption incorrect?


texts: org-mode expand to subtree at saveplace point on opening file

texts:
When I open an org-mode file containing a tree of headings, the tree is always opened in fully expanded state.
I'm using spacemacs with default configuration (develop branch), but I think this question could be interpreted as a generic one about org-mode and emacs (even if the configuration I want is in some sense the default in stock emacs I suppose: I'd like to know how to configure it this way explicitly).
How can I arrange that the tree is opened with only the subtree expanded around point (point coming from saveplace)?


texts: How to use skewer-mode for just html and css

texts:
I want to use Emacs to create a static website using only HTML and CSS.  I've read through the docs for skewer-mode and simple-httpd.  It seems simple enough.  There is even this SE post, how-to-use-skewer-mode, which details the above steps.  Yet when I follow the post, I just get an "Unable to connect error."  I'm not sure why.

In order to ask an actual question, although I don't know if it's related to my issue, what is meant in the skewer documentation by the following?

  Include "http://localhost:8080/skewer" as a script (see example.html
  and check your httpd-port)

I don't see how that fits into the bigger picture of how skewer-mode works.  Why doesn't the SE post include that?


texts: Set (non-custom) variable to its initial value

texts:
Is there a (quick) way of resetting a variable to its default value (as defined in some .el file) after it has been modified? e.g. via commands in the .emacs file, without having to restart emacs.

Example:
Set ispell-tex-skip-alists to the value as defined in `ispell.el' after modification.


texts: Unadvise a function (remove all advice from it)

texts:
I cannot find a predefined command in nadvice to easily unadvise a function in Emacs 24.5.1.
Something like:

(defun advice-unadvice (sym)
  "Remove all advices from symbol SYM."
  (interactive "aFunction symbol:")
  (advice-mapc `(lambda (fun props) (advice-remove ,(quote sym) fun)) sym))

Is there such a thing predefined?


texts: How to bookmark current line right before jumping to beginning of buffer and get back?

texts:
I am working on Python files and jump to beginning section to fix some imports and come back to point I am working on.
I want to use Bookmark, when I make a change on beginning of the file and come-back to the latest line I am working on. I was using ctrl+u+space, but I need to press multiple times to get back to latest point.
For following condition if possible:

When I jump to  beginning of the buffer, also automatically I want to add a bookmark to the latest line I am working on.
Afterwards I made some changes on the import section, I want to get back to the latest bookmark (which is the right before I jumped), with a keybinding without entering its name into Jump to bookmark:.

Setup:
(global-set-key "\C-x\ ,"  'beginning-of-buffer);

(defadvice bookmark-jump (after bookmark-jump activate)
  (let ((latest (bookmark-get-bookmark bookmark)))
    (setq bookmark-alist (delq latest bookmark-alist))
    (add-to-list 'bookmark-alist latest)))

Example:
1   | import hello
2   | import world
...
20  | import python
...
1000| line_I_am_working_on = 100

I am on line 1000. Than I pressed Ctrl+x+, to jump to beginning of the buffer. Than I go to line-20 by pressing line-down (Ctrl+p) and make a change. As final step I want to jump back to line 1000.


texts: Insert quote characters in define-skeleton

texts:
In the following skeleton definition, I like to have quote characters ", ` and '
in the generated skeleton code.

For example,

I like to have the effect of

#+NAME:a-function-test
#+BEGIN_SRC clojure
(facts "about `a-function'"
 )
#+END_SRC

But I'm only able to do this now:

#+NAME:a-function-test
#+BEGIN_SRC clojure
(facts about a-function
 )
#+END_SRC

Here is my current implementation.

#+BEGIN_SRC emacs-lisp :results output :exports none
  (define-skeleton tdd-clojure-skeleton
    "Define a skeleton "
    "function name: "

    "#+NAME:" str "-test" " \n"
      "#+BEGIN_SRC clojure" " \n"
      "(facts " "about " str "\n"
      " )" " \n"
      "#+END_SRC" " \n"

  )
#+END_SRC

Thanks for your help!


texts: Syntax highlighting: highlight text followed by a pattern, but not the pattern itself

texts:
I'm writing a major mode to handle syntax highlighting for a language that allows namespaces just like in C++ e.g. somewhere::out_there.

I'd like to highlight the text somewhere, but leave the namespace operator :: in the default face (as is done in cc-mode). So I'd like to match text that is followed by a pattern, without matching that pattern too.

I spent some time working with lookahead stuff, trying things like [a-zA-Z]+\(?::\) but it seems I've bumped into the optional group syntax \(?: ... \) that's just optionally including a single : in the match.

Searching around for methods to fix this, it seems that emacs doesn't actually support lookahead at all!

Since the solution may not be regex-based, let me give a bit more context: I'm setting font-lock-defaults and define-derived-mode, and my code follows this form:

;; define regexes for different text categories
(setq aql-numeric-regexp "[-+]?\\.?\\_<[0-9]*\\.?[0-9]+\\.?\\(?:[eE][-+]?[0-9]+\\)?\\_>\\.?")
(setq aql-bindvar-regexp "\\(^\\|[ \t]\\)@@?[a-zA-z_]+")

;; Associate categories with faces
(setq aql-font-lock-keywords
  `(
    (,aql-numeric-regexp . font-lock-warning-face)
    (,aql-bindvar-regexp . font-lock-variable-name-face)
    ))

and then inside define-derived-mode I include:

(setq font-lock-defaults '((aql-font-lock-keywords)))
(set (make-local-variable 'font-lock-defaults) '(aql-font-lock-keywords nil t))

Any strategies for dealing with this sort of thing? Any workarounds that will enable me to approximate lookaheads? Or other methods to tell emacs what to highlight?


texts: helm-gtags doesn't reflect the latest code change

texts:
I'm using helm-gtags-find-tag-from-here command a lot. It works fine as long as there is no change to the source file contains the definition of symbol under the cursor. However, if I modify the source file that contains definition of symbol, the command doesn't work as it always jumps to the old line number that contains definition, which has changed due to the modification.

It seems the tags are automatically-updated or there is some cache of the tags that keep referencing the old definition position. So, I issue helm-gtags-clear-all-cache but it doesn't work.

Currently, if I modify the file, I have to remove GPATH, GRTAGS, GTAG and regenerate them so that I can have the tags reflect the latest change. This is huge pain. So, I'm wondering what can go wrong?

Here is my setup for helm-gtags:

;; this variables must be set before load helm-gtags
;; you can change to any prefix key of your choice
(setq helm-gtags-prefix-key "\C-cg")

(use-package helm-gtags
  :init
  (progn
    (setq helm-gtags-ignore-case t
          helm-gtags-auto-update t
          helm-gtags-use-input-at-cursor t
          helm-gtags-pulse-at-cursor t
          helm-gtags-prefix-key "\C-cg"
          helm-gtags-suggested-key-mapping t)

    ;; Enable helm-gtags-mode in Dired so you can jump to any tag
    ;; when navigate project tree with Dired
    (add-hook 'dired-mode-hook 'helm-gtags-mode)

    ;; Enable helm-gtags-mode in Eshell for the same reason as above
    (add-hook 'eshell-mode-hook 'helm-gtags-mode)

    ;; Enable helm-gtags-mode in languages that GNU Global supports
    (add-hook 'c-mode-hook 'helm-gtags-mode)
    (add-hook 'c++-mode-hook 'helm-gtags-mode)
    (add-hook 'java-mode-hook 'helm-gtags-mode)
    (add-hook 'asm-mode-hook 'helm-gtags-mode)

    ;; key bindings
    (with-eval-after-load 'helm-gtags
      (define-key helm-gtags-mode-map (kbd "C-c g a") 'helm-gtags-tags-in-this-function)
      (define-key helm-gtags-mode-map (kbd "C-j") 'helm-gtags-select)
      (define-key helm-gtags-mode-map (kbd "M-.") 'helm-gtags-dwim)
      (define-key helm-gtags-mode-map (kbd "M-,") 'helm-gtags-pop-stack)
      (define-key helm-gtags-mode-map (kbd "C-c <") 'helm-gtags-previous-history)
      (define-key helm-gtags-mode-map (kbd "C-c >") 'helm-gtags-next-history)
      (define-key helm-gtags-mode-map (kbd "<f5>") 'helm-gtags-find-tag-from-here)
      )
    ))

(provide 'setup-helm-gtags)


texts: How show hidden and system folder/files?

texts:
Emacs 26.1. , Dired+

Here content folder TraderMonitor in Total Commander:

and here how look same folder (TraderMonitor) in Emacs, dired mode:

How show hidden/system folders:

.git
.idea

and file:

.gitignore

?

P.S.
If I start by emacs -Q  I see all this hidden files:


texts:
I want some files to be read-only when I open them. Maybe using some kind of header would work?

Parsing the extension would work too but I want to apply to, for example, some ".txt" files so is not very good to apply this rule to all "txt" files.


texts:
Say I am in dired and the pointer is on a file called test which contains:

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.

I type ! to run a shell command on this file.
I type tac | head -n 2

I get :

1.
2.

But I expected:

20.
19.

As if I has run tac test | head -n 2 in the shell.

What am I misunderstanding and what is the correct way to get the behaviour I wish?


texts: How to change default minibuffer message?

texts:
After the init file has done loading I get this message in the minibuffer:

For information about GNU Emacs and the GNU system, type C-h C-a.

What is it being triggered by and how do I change it?


texts: edebug-defun at compile-time or at eval-buffer time?

texts:
While I am developing some elisp package I find myself edebug-defun'ing the same critical functions foo-some-mess and bar-more everytime I modify them, or everytime I load the code after compiling.

Is there a way to tell emacs once and for all that these two functions must be stepped through with edebug?


texts: What's the best way to organize personal configurations in Spacemacs?

texts:
For plain Emacs, I used to use the following methods to organize my configurations:

Put logically related configurations into different files;
Organize with Org Babel.

Now I'm trying to use Spacemace, it seems that all user configurations goes into dotspacemacs/user-init and dotspacemacs/user-config.  If all my configs are put inside these two procedures, it will be a big chunk of code.  Is there a way to separate the configs neatly?

For example, I have quite some Org mode configurations.  There's already a layer for Org mode in Spacemacs.  Then my personal configs should go somewhere else.  What's the best way to deal with that?


texts: Send content of region or current line to a tmp file, then execute shell script with filename as argument

texts:
I am transitioning to Emacs with evil-mode after years of Vim. For work reasons I have to use a GUI statistics program (Stata) frequently. This program does not integrate well with external editors. ess-mode doesn't support the GUI version of Stata but only a very limited terminal version. I prefer a simple solution that I can maintain myself.

To make it work with Vim, I wrote a shell script using xdotool that takes as argument a filename, opens the GUI window, pastes "do filename" in the command window, sends return and then goes back to the original editor window. It's not a sophisticated solution but works well in practice.

In my .vimrc I had some code that would write the currently selected region or the current line to a temporary file in /tmp/randomfoldername/consecutivenumber.do, then call the shell script with that file as the argument. Upon leaving vim, the folder would be deleted.

I am looking to replicate this functionality in Emacs, but don't know how or where to start. I essentially want to mimick what the ess-mode functions ess-eval-region-or-line-and-step and ess-eval-buffer are doing, simply by calling the shell script with the name of a temporary file or the name of the current buffer.

If it helps, this is the vimscript code:

" Run current buffer
fun! RunIt()
  w
  !sh "~/dotfiles/rundo.sh" "%:p"
endfun

" Run selection
fun! RunDoLines()
  let selectedLines = getbufline('%', line("'<"), line("'>"))
 if col("'>") < strlen(getline(line("'>")))
  let selectedLines[-1] = strpart(selectedLines[-1], 0, col("'>"))
  endif
 if col("'<") != 1
  let selectedLines[0] = strpart(selectedLines[0], col("'<")-1)
  endif
 let temp = tempname() . ".do"
 call writefile(selectedLines, temp)
    exec "!sh ~/dotfiles/rundo.sh " . temp
    au VimLeave * silent exe '!del /Q "'.$TEMP.'\*.tmp.do"'
endfun

" Mappings
au FileType stata noremap <F8> :<C-U>call RunIt()<CR><CR>
au FileType stata noremap <F9> :<C-U>call RunDoLines()<CR><CR>
au FileType stata noremap <C-Return> <S-v>:<C-U>call RunDoLines()<CR><CR>


texts: Temporary Files Still Appearing in Current Dir

texts:
I have this in my .init.el file:

(setq backup-directory-alist
      `((".*" . "~/.saves")))
(setq auto-save-file-name-transforms
      `((".*" "~/.saves" t)))

Yet I am still getting random backup files in both the working directory and my home directory.

How can I fix this? Is there another setting I'm missing?


texts: How to use latex package emaxima in emacs

texts:
I am trying to use maxima with emaxima package in latex. I am using xubuntu 20.04, emacs 26.3, maxima 5.43.2. Here is my simple latex file.
\documentclass[11pt,a4paper]{article}
\usepackage[lines]{emaxima}
\begin{document}
  \begin{maxima}
    diff(sin(x^2),x);
  \end{maxima}
\end{document}

It compiles giving me a nicely formated maxima cell but does not run maxima on the cell.
I could not find the emaxima command to update cell, which according to an old maxima book is:
C-c C-u c (emaxima-update-cell)
I also tried inside the cell to change the mode to maxima-mode and evaluated the code block, but the maxima interpreter starts in another window, and the solution is displayed there.
I would like it to be included right after the maxima cell. This used to work many years ago, and I have used it. But now does not seem to work. I have the following lines in my init.el, but I am not sure if they are relevant.
(add-to-list 'load-path "/usr/share/emacs/site-lisp/maxima/")
(autoload 'maxima-mode "maxima" "Maxima mode" t)
(autoload 'imaxima "imaxima" "Frontend for maxima with Image support" t)
(autoload 'maxima "maxima" "Maxima interaction" t)
(autoload 'imath-mode "imath" "Imath mode for math formula input" t)
(setq imaxima-use-maxima-mode-flag t)
(add-to-list 'auto-mode-alist '("\\.ma[cx]" . maxima-mode))


texts: Installed emacs by emacs-bootstrap, got cannot load error and buffer list not work

texts:
Using Mac Pro macOS 10.13.1

iTerm2

Has two problems:

After installed emacs by emacs-bootstrap, got this error when start it:

When try to open buffer list by C-x C-b, it shown this window at bottom but not buffer list on the other side:

I found this config in the ~/.emacs.d/elisp/base-extensions.el file:

(use-package org-projectile
  :config
  (org-projectile-per-project)
  (setq org-projectile-per-project-filepath "todo.org"
    org-agenda-files (append org-agenda-files (org-projectile-todo-files))))

What's the problem?

Edit

When use GNU Emacs For Mac OS X, also got same warning:

Edit 2

Add run emacs screen shot:


texts: ESS: Disable spaces around `=` in function arguments

texts:
With ESS + auto-complete, I get AC suggestions for function arguments that allow me to save time typing them out. What irks me is that it completes the function arguments with spaces around them. For example: print(x = ) instead of print(x=).

Is there a way to change this behavior in ESS using some variable customization?


texts: How to directly complete org-mode tags with helm?

texts:
When using org-set-tags in org-mode headings, the somewhat clunky *Org tags* selection buffer is shown by default. I always press tab in order to switch to helm-mode-org-set-tags, which lets me choose from the list of defined tags with the usual fuzzy matching.

Is there a way to arrive at helm-mode-org-set-tags without detour?


texts: Timestamp on babel-execute results block?

texts: When I execute a source block, I'd like to get a timestamp on the +RESULTS block so that I can remember when it was last executed. Is there a built-in option for this or do I need to go in and add a hook or a advise a function somewhere?


texts:
I would like to make sure that scrollbars never show up on my windows, but I recently noticed that when I created a new frame with C-x 5 2 the new frame gets a scrollbar, even though the original frame does not. The lines that might be relevant from my init.el are below:

(scroll-bar-mode -1)
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))

I can still use M-x toggle-scroll-bar to turn it off in the new frame, but I feel like that shouldn't be necessary.

To clarify, I'm using emacsclient -c & to start Emacs on Ubuntu, and when I do this I get a scroll bar.  C-h v scroll-bar-mode gives me:

scroll-bar-mode is a variable defined in `scroll-bar.el'.
Its value is nil
Original value was right

Documentation:
Specify whether to have vertical scroll bars, and on which side.
Possible values are nil (no scroll bars), `left' (scroll bars on left)
and `right' (scroll bars on right).
To set this variable in a Lisp program, use `set-scroll-bar-mode'
to make it take real effect.
Setting the variable with a customization buffer also takes effect.

You can customize this variable.

So the value of scroll-bar-mode is properly set to nil, but somehow Emacs is ignoring this to give me a scroll bar anyway.


texts:
Years ago, when Emacs was at 21.*, I had a function that displayed a tooltip when I hovered the mouse on certain words in the buffer.  Now, in 26.3, I want to use that function again, but it does not work any more, apparently because Emacs is not passing mouse movement events to it.
Minimal example that worked fine in Emacs 21 but does nothing in Emacs 26:
(defun my-tooltip (event)
  (interactive "e")
  (tooltip-show "got mouse movement event")
  t)

(progn
  (tooltip-mode)
  (set (make-local-variable 'track-mouse) t)
  (setq tooltip-functions nil)
  (add-hook 'tooltip-functions 'my-tooltip))

One more thing: when I did M-x describe-key and moved the mouse, older Emacs versions used to tell me which command, if any, was bound to mouse-movement.  In the same situation, Emacs 26 does nothing — it obviously does not see that I am moving the mouse, even when I set track-mouse to t globally.
Running Emacs with -Q does not change anything.
How should I catch mouse movement events in Emacs 26?


texts: Emacs 26.2 can't load init file from Emacs 25

texts: The title already says the question, i had Emacs 25 and compiled Emacs 26.2. Although my ./emacs directory and everything in it exists Emacs 26.2. starts complaining about packages which do not exist, although they exist. Why is this happening? Can any one help?


texts:
Is there a function (or some kind of prefix command) that will allow me to do an action to the next word I type, not the word under point or the region? Currently:

upcase-word puts the word under the point in uppercase
org-emphasize bolds or italicizes the word under point

But when typing text, I often want to do this to the next word I type, the one I haven't typed yet (using SPC as the delimiter).

So I want function I can call before I enter a word that will place * on either side of the next word I type, without my having to type the closing *.

Let's say my keybinding for bold-next-word is M-S-b.

Sample input:
This is an M-S-bimportantSPCpoint.

Desired output:

This is an *important* point.

org-emphasize is my main use case, but it would be nice to be able to do this with upcase, downcase, etc.


texts: How can you automatically translate fractions into their short unicode versions? e.g. ⅔

texts: Ideally one can just type fractions as normally e.g. 2/3, and either the view simply displays it as ⅔, without changing the text itself OR the text itself is changed. I need this for org mode in case that's relevant.


texts: org-agenda: Remove time grid lines that are in an appointment

texts:
In my agenda I like to see the free blocks of time. As it was suggested in this thread I tried the approach with org-agenda-time-grid. The only problem with that was that the time-grid shows up even when the time is busy. By doing some research I found a solution on this page (Org ad hoc code, quick hacks and workarounds):

(defun org-time-to-minutes (time)
  "Convert an HHMM time to minutes"
  (+ (* (/ time 100) 60) (% time 100)))

(defun org-time-from-minutes (minutes)
  "Convert a number of minutes to an HHMM time"
  (+ (* (/ minutes 60) 100) (% minutes 60)))

(defadvice org-agenda-add-time-grid-maybe (around mde-org-agenda-grid-tweakify
                                                  (list ndays todayp))
  (if (member 'remove-match (car org-agenda-time-grid))
      (flet ((extract-window
              (line)
              (let ((start (get-text-property 1 'time-of-day line))
                    (dur (get-text-property 1 'duration line)))
                (cond
                 ((and start dur)
                  (cons start
                        (org-time-from-minutes
                         (+ dur (org-time-to-minutes start)))))
                 (start start)
                 (t nil)))))
        (let* ((windows (delq nil (mapcar 'extract-window list)))
               (org-agenda-time-grid
                (list (car org-agenda-time-grid)
                      (cadr org-agenda-time-grid)
                      (remove-if
                       (lambda (time)
                         (find-if (lambda (w)
                                    (if (numberp w)
                                        (equal w time)
                                      (and (>= time (car w))
                                           (< time (cdr w)))))
                                  windows))
                       (caddr org-agenda-time-grid)))))
          ad-do-it))
    ad-do-it))
(ad-activate 'org-agenda-add-time-grid-maybe)

This has worked great until the most recent update to org-mode was released (9.1). There is a new org duration library (org-duration.el) and with its introduction several functions became obsolete which broke the above mentioned defadvice.

To my (amateurish) unterstanding the problem is that the org duration library works with strings which also contain colons (e.g. 19:30 instead of 1930). This is why I have tried to change the functions org-time-to-minutes and org-time-from-minutes to output strings with colons as well. This did not work, however, which is why I am hoping for the community to find a fix.

(Edit: To be honest my ideal solution would not remove the grid lines which are in the range of an appointment but rather change them in a way that there is a visual time block, e.g. by changing the color of the grid lines. But since this is probably much more difficult to achieve, I would already be happy with a fix of the defadvice.)


texts:
After updating my system my emacs windows have a resize grip in the bottom right corner. Is there a way to get rid of it?

The grip does not appear on any other windows.

I'm running Ubuntu 14.04.


texts: How to control the favicon as a function of file extension.

texts:
I'm using

GNU Emacs 25.0.50.1 (x86_64-apple-darwin14.0.0, NS appkit-1343.14 Version 10.10 (Build 14A389)) of 2014-10-20

And I interesting in knowing how emacs does an icon in the top window frame for certain file extensions, for example:

and

I suspect this is an emacs source code kind of solution since I couldn't find an icon in the swift-mode package.

Can someone shed some light on this? (I want to add an icon for OCaml)


texts: Move the cursor backwards to the end of the 1st word on it's between 2 words

texts: If the cursor is placed on a whitespace and there're multiple whitespaces between 2 words, how can I move the cursor backwards to the end of the 1st word?


texts: Why would `symbol-name' return a fontified string?

texts:
I've got a weird bug in a GraphQL encoder I'm writing that I've tracked down to one form:

(symbol-name 'world)

;; yields
#("world" 0 5
  (fontified t))

I can reproduce the issue in a *scratch* buffer in that same emacs session and with M-:, but it's not reproducible in a new emacs session (e.g., emacs -nw -Q).

This doesn't happen with all symbols; (symbol-name 'hello) yields just "hello".

The following snippet can reproduce the issue, but I still have no idea what would be using make-symbol in this way.

(let ((sym (make-symbol (let ((s "hello world"))
                          (set-text-properties 0 (length s) '(test property) s)
                          s))))
  (symbol-name sym))


texts:
I installed clang-format package from the MELPA repository.

I added it to the load-path in my init file.

Whenever I try to use it it says:

Searching for program: No such file or directory, clang-format

I would assume this is because I don't have some kind of style file. Is this correct?

If so, how would I create such a file?


texts:
I am trying to find a way to export an Org document with lots of formulas in plain text, but the results aren't great so far.
What I tried:

pandoc - basically keeps all math in LaTeX unchanged, doesn't even strip the environment makrers.
detex - doesn't replace Greek symbols (simply removes them), there are artefacts in the produced formulas (s.a. ampersands left from alignment etc.)
tex2mail - looks funny and very hard to read, leaves artefacts, environment markers etc.
catdvi - is the best so far, however, I only need it to run on the LaTeX fragments in the Org file, the rest of the file looks very bad (indenting, titles etc).
hevea - this program is used by texi2dvi to generate text output. Doesn't really work, the output looks very strange / some Greek letters are translated into Unicode, others aren't, the alignment is all wrong...

I could probably write a special backend to first export all LaTeX fragments to DVI and then to run catdvi on those, but before I get to it, maybe there's a simpler way to do it?


texts: Emacs Fortran 90 mode indentation too aggressive

texts:
In my newer version of emacs, when I edit a Fortran 90 source code and press enter key (new line), the cursor moves down but also skips by some spaces (depending on context) to right. I find the horizontal skip annoying, because I'm used to the behavour that it stays at beginning of line and any formatting, if I wish, is done only after pressing the tab key. Is there a way to turn off this aggressive formating and return to older style formatting?
The affected version is: GNU Emacs 25.3.1 (x86_64-suse-linux-gnu, GTK+ Version 3.22.30)
of 2019-05-04


texts:
I just installed auto-complete-auctex from melpa repository. At package documentation says to enable by putting in my .init file the following command

  (require 'auto-complete-auctex)

However, when i launch emacs i get the following error

  Symbol's value as variable is void: ac-modes

How can i solve this problem?


texts:
#+Begin_SRC go
package main
import ("fmt")

func main(){
   fmt.Println("emacs")
}
#+End_Src

~/.emacs.d/init.el:

(when (memq window-system '(mac ns))
  (exec-path-from-shell-initialize)
  (exec-path-from-shell-copy-env "GOPATH"))

;; Define function to call when go-mode loads
(defun my-go-mode-hook ()
  (add-hook 'before-save-hook 'gofmt-before-save) ; gofmt before every save
  (setq gofmt-command "goimports")                ; gofmt uses invokes goimports
  (if (not (string-match "go" compile-command))   ; set compile command default
      (set (make-local-variable 'compile-command)
           "go build -v && go test -v && go vet"))

  ;; guru settings
  (go-guru-hl-identifier-mode)                    ; highlight identifiers

  ;; Key bindings specific to go-mode
  (local-set-key (kbd "M-.") 'godef-jump)         ; Go to definition
  (local-set-key (kbd "M-*") 'pop-tag-mark)       ; Return from whence you came
  (local-set-key (kbd "M-p") 'compile)            ; Invoke compiler
  (local-set-key (kbd "M-P") 'recompile)          ; Redo most recent compile cmd
  (local-set-key (kbd "M-]") 'next-error)         ; Go to next error (or msg)
  (local-set-key (kbd "M-[") 'previous-error)     ; Go to previous error or msg

  (auto-complete-mode 1))

(add-hook 'go-mode-hook 'my-go-mode-hook)

(with-eval-after-load 'go-mode
   (require 'go-autocomplete))

(require 'go-guru)
; i want use ob-go , above code just compile the code
;(require 'ob-go)
;(org-babel-do-load-languages
;'org-babel-load-languages
;'((go . t)))

But this is not execute how i execute this block. I'm new in Literal Programming Please help me


texts: Automatically tangle org files in a specific directory

texts:
I'm converting my dotfiles to org-babel files because I really enjoyed rewriting my Emacs configuration in it, and I have a function for the init.org that automatically tangles it whenever I save. However, I haven't been successful in making the .org files in say ~/.dotfiles to do the same automatically. I have this function currently:

(defun my/tangle-dotfiles ()
  "If the current file is in '~/.dotfiles', the code blocks are tangled"
  (when (equal (buffer-file-name)
               (expand-file-name "~/.dotfiles/tmux.org"))
    (org-babel-tangle)
    (message "Dotfile tangled")))

(add-hook 'after-save-hook #'my/tangle-dotfiles)

However, this only works for the specific file I name, not for any org file. Using *.org doesn't work either, nor have I figured out how to extract the directory name from both the buffer and directory and do it that way.

I also asked on the #emacs on Freenode but nobody answered me there. Any help or pointer on where to begin would be highly appreciated.


texts: Magit doesn't prompt for SSH key after OS upgrade?

texts:
Q: magit no longer prompts me for my ssh key when pushing/pulling; how do I fix it?

After an OS upgrade (Lubuntu 19.04 to 19.10), I can no longer push
to origin from magit.  Pushing to origin results in a process that
hangs when invoked from magit; I have to kill that process
manually.  The problem seems to be that Emacs no longer prompts me for my public ssh key, and just sits there humming quietly to myself while git waits for it.

Pushing from a terminal using the same command that
magit uses works as expected, since I can enter my ssh key unimpeded.

How do I figure out what could be causing this to happen?


texts: How to ensure lines are always displayed in groups of 3?

texts:
I am writing a major-mode which displays a list to the user. It is similar to tabulated-list-mode, except each entry takes up 3 lines, as opposed to just one:

  0   0 Ctrl-} key in emacs
        5m ago [keymap]

  6   1 Set the background of org-exported <code> blocks according to theme
        40m ago [org-mode] [org-export] [html]

  7  10 How to switch between windows quickly?
        79m ago [window] [navigation]

  3   1 Org-mode: Exclude specific headlines from TOC when exporting
        96m ago [org-mode] [org-export]

I've defined all movement keys so that the user navigates by entry
instead of by line, but there's one thing I can't quite fix. Whenever
the window is split below or above, there's a decent chance that the first line in the (original) window will not be the first line of an entry. This happens because the buffer is scrolled to make sure point is still visible after the split.

Here's an example of what I might get when splitting (note this can
happen even if I ensure the size is a multiple of 3).

        5m ago [keymap]

  6   1 Set the background of org-exported <code> blocks according to theme
        40m ago [org-mode] [org-export] [html]

  7  10 How to switch between windows quickly?

I would like this buffer to reposition itself, every time the window
  size changes, so as to ensure the first visible line is always a
  (multiple of 3) minus 1.
(Whether it scrolls up or down is irrelevant, as long as point is not moved.)

So the example above should display something like.

  0   0 Ctrl-} key in emacs
        5m ago [keymap]

  6   1 Set the background of org-exported <code> blocks according to theme
        40m ago [org-mode] [org-export] [html]

Is this possible?

EDIT: Note, I'd like to scroll the window as little as possible---always 1 or 2 lines.


texts: How do I edebug a function defined in a use-package block?

texts:
Here is a minimum working example to demonstrate the problem, you will need to have the use-package package installed:

(use-package ido
  :config
  (progn
    (defun dummy/function ()
      (interactive)
      (message "I am in the dummy function."))))

When I try to add edebug instrumentation to the dummy/function using M-x edebug-defun, it starts the edebug rightaway as if I already did M-x dummy/function. I have to quit that by hitting q. But then when I actually do M-x dummy/function, I don't see the edebug activating.

Is there something about the use-package wrapper that messes with the edebug instrumentation? How can it be fixed?


texts: How can I wrap the subscript into a math environment in Org-mode?

texts:
I have some subscripts in my org file like B_25, B_30. These subscripts can be exported to LaTeX like B_{25}, B_{30}. However, I want part of the subscripts like B to be exported as italic B. As one solution for this, I can wrap these thing into a math environment like \(B_{25}\). But since my file contains large numbers of these subscripts, I just want to write the B_25 in org file and export as \(B_{25}\) to LaTeX file in a programmable way.

I found a subscript filter function in org-mode, so I tried to use it to wrap the subscripts by

(defun wrap-subscript-with-math-environment (contents backend info)
  (when (eq backend 'latex)
   (format "\\(%s\\)" contents)))

(add-to-list 'org-export-filter-subscript-functions 'wrap-subscript-with-math-environment)

However, the results exported are like B\($_{\text{25}}$ \). It seems like the subscript filter contents only contain _25 part. Does anyone have some solutions about this?


texts: What is the *code-conversion-work* buffer

texts: What is exactly the purpose of the *code-conversion-work* buffer and why is the variable default-directory in the *code-conversion-work* buffer set to the folder in which Emacs was built?


texts: Make my font lock config only highlight my keywords when they are upper case

texts:
I've got a font lock config that I use to add certain helpful keywords to various modes of my choosing:

(defun my-font-lock-keywords (mode)
  (font-lock-add-keywords mode
              '(("\\<\\(FIXME\\|TODO\\|QUESTION\\|NOTE\\)"
                 1 font-lock-warning-face t))))

(mapc #'my-font-lock-keywords
      '(prog-mode text-mode message-mode latex-mode html-mode emacs-lisp-mode
          texinfo-mode sql-mode cc-mode c-mode clojure-mode lisp-mode
          c++-mode))

Works great except it matches/highlights lowercase versions of FIXME, TODO, QUESTION, and NOTE too. I only want it to match/highlight upper case versions of those "keywords". How do I need to tweak the regexp to do this?


texts: current-active-maps shortens map entries

texts:
I try to print all key bindings in the current buffer using

(current-active-maps)

In the message buffer, the entries are not fully printed & are replaced by

....

after a level.
Like this,

((keymap (46 . tern-ac-dot-complete) (3 keymap (4 . tern-get-docs) (3 . tern-get-type) (18 . tern-rename-variable)) (27 keymap (44 . tern-pop-find-definition)
 (67108910 . tern-find-definition-by-name) (46 . tern-find-definition))) (keymap (menu-bar keymap (Hide/Show menu-item "Hide/Show" ...)) (S-mouse-2 . hs-
mouse-toggle-hiding) (3 keymap (64 keymap ... ... ... ... ...)))

and also, the print format is ugly. How to pretty print the list?
I can do list traversing and print it, but looking at the depth of output string, i am keen on avoiding it.


texts:
I've got this code:

(defun insert-random-uuid ()
  (interactive)
  (shell-command "uuidgen" t))

which produces a uuid that looks like this ffc715d2-1e10-4faf-b1f6-f85cae88a7d7. However, I believe it's throwing in a newline and that it isn't returning a string:

(stringp (insert-random-uuid))

which returns nil

So I find this at the EmacsWiki:

(defun chomp (str)
      "Chomp leading and tailing whitespace from STR."
      (while (string-match "\\`\n+\\|^\\s-+\\|\\s-+$\\|\n+\\'"
                           str)
        (setq str (replace-match "" t t str)))
      str)

which seems to handle both whitespace and \n. But of course (chomp (insert-random-uuid) gives an error, no doubt because insert-random-uuid is not returning a true string. So what is it returning, and how can I remove the newline? I tried various things to "cast" the output to string, but no luck. How can I get rid of this newline?


texts:
I am using Emacs 26.1 on Windows. I am reading manpages using (man). When I invoke (man) ivy jumps in and offeres me the selection of available manpages. This selection is for some reason empty (no manpages are offered). If I enter the name of a manpage that I know it exists the manpage is shown.

If I invoke (woman) on the other hand ivy shows me a nice list of available manpages.

As I really only use (man) to read manpages I wonder if there is way to have ivy offer me completion when chosing a manpage?

I went through the customization group for "man" to see if there is any hint. I also did invoke a search engine in an un-motivated way.

EDIT: Doing: "emacs -Q", invoke man, hit tab does not offer any available manpages while on ther other hand doing "emacs -Q", invoke woman, hit tab does offer lots of manpages.


texts:
I'm  trying to build an Alfred workflow to bookmark pages from my browser using org-capture. Ideally I would not need to present the emacs UX at all but rather I could capture all the info I need in the Alfred UX and send it to Emacs in the background. Basically I'm trying to mirror the UX of an existing workflow I have which bookmarks the current webpage in my front-most browser to Pinboard.in (the invocation in Alfred looks something like "p tag1,tag2,tag3; a longer description").
So far I've configured a simple org-capture template to let me bookmark new links and I have a simple app script that extracts the info I need from the Browser and invokes Emacs using org-protocol but since I can capture all the info I need in Alfred I'd like to find a way to invoke org-capture in "batch" mode, feeding it all the info I need to create a new item with a given template without presenting a UX at all. Essentially I want to come up with a shell-script that will append a new item using a given template. Can anyone think how this could be achieved?
There is a somewhat similar workflow that someone else has coded but it seems to use Python to emulate org-mode without invoking Emacs at all. I would rather avoid trying to reimplement org-mode myself however.


texts: evil-mode unwanted abbrev expand (setq evil-want-abbrev-expand-on-insert-exit nil)

texts:
Upon escaping evil-insert-state, if the cursor is next to a letter/phrase in my abbrev list, it expands despite having

(setq evil-want-abbrev-expand-on-insert-exit nil)

called before evil-mode. This happens even if abbrev-mode is disabled.

How do I prevent abbrev expansion when exiting evil-insert-state?

Thanks.


texts: How to set mail-user-agent to mu4e-user-agent

texts:
Pressing , m in an org buffer does org-mime-org-buffer-htmlize and opens the
htmlized message in message-mode but I want it in mu4e-compose-mode.

How can I have this message opened in mu4e in order to have the sent mail stored
in my /SENT folder and benefit from mail address autocompletion?

Setting mail-user-agent in .spacemacs makes no difference:

(setq
mail-user-agent 'mu4e-user-agent
)


texts: using shackle to split current window instead of root

texts:
I want to write a shackle rule to split the current window (top/bottom) instead of splitting the root window to display the new buffer.

Here is what I'm getting:

+-------+--------+
|       |current |
|       |        |
+-------+--------+
|      new       |
+----------------+

here is the associated code

;; shackle
(setq shackle-rules '(("*Flycheck errors*" :regexp t :align 'below :size 10)
                      ("*compilation*"     :regexp t :align 'below :size 0.4)))

this is what I want:

+-------+--------+
|       |current |
|       |        |
|       +--------+
|       |  new   |
+-------+--------+


texts: In Magit log buffer, is there key bindings for traversing in a branch?

texts:
In a log buffer with multiple branches (using the lL command, with any =o option), a commit and its immediate parent or child may be shown far apart on the view and is difficult to trace back and forth among the commits in a branch. (All the current traverse keys will step onto every log line in the view).

Is there any way to confine my traverse to a selected branch or creating short-cut keys (such as M-p, M-n) to jump to immediate parent/child?

I know the -D and -f options but I often found that I need very detail history to correctly doing the merge or rebase operation.

Thanks.


texts: How can I make ibuffer auto-refresh the list of buffers?

texts:
M-x ibuffer
Select a buffer
Kill that buffer

After the buffer is killed, the ibuffer buffer re-appears, but it still shows the buffer name killed in step 3.

Is it possible to have ibuffer auto-refresh the list of buffers?


texts: Python IOError whenever I eval a buffer or region

texts:
New to Python in Emacs. Whenever I try to do an eval-buffer on this server, I get

>>> Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 2] No such file or directory: '/tmp/py8168HeX'

or

>>> Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 2] No such file or directory: '/tmp/py81686TR'

and the buffer does not evaluate. The same happens when I try to evaluate a region. I therefore can't use python interactively in Emacs.

What am I missing?

Here is my .emacs:

;;;;;;;;;
;; python
;;;;;;;;;

;; Emacs for Python, taken from
;; https://github.com/gabrielelanaro/emacs-for-python/

(load-file "~/.emacs.d/emacs-for-python/epy-init.el")

(setq skeleton-pair nil)  ;; parentheses

(add-to-list 'load-path "~/.emacs.d/emacs-for-python/") ;; tell where to load the various files
(require 'epy-setup)      ;; It will setup other loads, it is required!
(require 'epy-python)     ;; If you want the python facilities [optional]
(require 'epy-completion) ;; If you want the autocompletion settings [optional]
(require 'epy-editing)    ;; For configurations related to editing [optional]
;;(require 'epy-bindings)   ;; For my suggested keybindings [optional]
(require 'epy-nose)       ;; For nose integration

;; send current line
(add-hook 'python-mode-hook
      'my-python-send-statement)
(defun my-python-send-statement ()
  (interactive)
  (local-set-key [C-return] 'my-python-send-statement)
  (end-of-line)
  (set-mark (line-beginning-position))
  (call-interactively 'python-shell-send-region))


texts: Refile to a datetree to a date that does not appear in it

texts:
I want to refile a headline to a datetree at 2016 -> 2016-10 October -> 2016-10-08 Saturday.

The datetree presently looks like:

* 2017
** 2017-11 November
*** 2017-11-30 Thursday
**** Something 1
**** Something 2

My refile target does not exist! But I am refiling in a datetree. So, I should be able to give an refile location of 'datetree' and it should be intelligent enough to create the datetree as needed. Or is it not?


texts:
I realize this is quite an edge case, but I am wondering if anyone can help me.

I have source correlation set up in emacs as follows

    (setq TeX-source-correlate-start-server t
          TeX-source-correlate-mode t
          TeX-source-correlate-method 'synctex)

This works great when I am using standard tex commands/environments. However, if I use a savebox, the syncing is done with the usebox command rather than the box's source.

Is there a way to get the syncing with respect to the box's source? Other packages likes environ and mdframed use this functionality which means their content is never synced.

    \documentclass{article}
    \usepackage{lipsum}
    \begin{document}
    \newsavebox{\mybox}
    \savebox{\mybox}   % If I comment this line, syncing works
    {
      \begin{minipage}{\linewidth}
      \lipsum[1]
      \[
        A = B
      \]
      \lipsum[2]
      \[
        C = D
      \]
      \lipsum[3]
      \end{minipage}
    }

    \usebox{\mybox}

    \end{document}

Ctrl+Clicking on a text or equation in the pdf always jumps to the \usebox{\mybox}. Can someone shed some light on this? I imagine I would need to save the sync'ing information when saving the box and then "output" them whenever the box is used.


texts: Get Emacs Markdown markdown mode to use Rstudio pandoc

texts:
I installed markdown mode for Emacs.  Now I need it to see a version Pandoc I have on my machine.

Markdown Mode for Emacs

I put this in my init file and loaded it.

(custom-set-variables
 '(markdown-command "C:\Program Files\RStudio\bin\pandoc\pandoc.exe"))

Of course the \ are escape characters, so that does not work.  There is also the issue of the space in the name.

I could ask IT to install Pandoc on my system, but it is already there in the Rstudio directory.

Update

I tried your suggestion:

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

(custom-set-variables
'(markdown-command "C:/Program Files/RStudio/bin/pandoc/pandoc.exe")) ;; you can also set full path of markdown comman

seems to work.  I have a hard time believing that, but I got n *eww* loaded correctly.


texts: Building Emacs 25 on CentOS *without admin rights*

texts:
I'm having a hard time getting Emacs to build under CentOS 7.1 where I don't have admin rights to install dependencies.
After downloading Emacs sources I tried ./configure, and I found out that I was missing X libraries.

I grabbed the gtk3-dev libraries from an rpm repository and extracted them with:

rpm2cpio ../gtk3-devel-3.8.8-10.el7.x86_64.rpm | cpio -idv

And then I tried both:

GTK_LIBS=-L$HOME/tmp/gtk3/usr/lib64/ ./configure \
--prefix=$HOME/Downloads/emacs-25.1/build-out --with-x-toolkit=gtk3

and

./configure --x-includes=$HOME/tmp/gtk3/usr/include/ \
--x-libraries=$HOME/tmp/gtk3/usr/lib64 --with-x-toolkit=gtk3

but the configure script through other messages telling me that other gtk3 dependencies where missing, or that it couldn't find everything.

I was wondering if anyone knows where to find a statically build Emacs 25 for centOS x86_64, or how to build Emacs without admin rights in such a way that all dependencies are handled and installed locally?

Any help would be greatly appreciated.


texts: How to convert single line comments to multiline comments?

texts:
I have a bunch of single line comment blocks in C-code that I want to change to multiline. Example:
// foo
// bar

should become:
/* foo
 * bar
 */

How can I do this easily in Emacs?


texts: org mode: help!! i’ve collapsed my section and can’t get it back out

texts:
I am using spacemacs. This may seem like a joke, but it really is not (but it is kind of funny).
I was typing in org-mode just now, I may have hit some god-mode key, and the section I am typing in now collapsed into its header and I cannot uncollapse/expand it back open.

Updated typing happens invisibly, but I can’t see anything.

My text is still there, because I can see the diff output.

Re-loading my saved (spacemacs) layout does nothing.

•  I know this is simple, but a google did not reveal anything.
•  Hitting tab or Enter on the section header does nothing.
Pls help  V.V


texts: On Nylas N1 email client it is possible to see if receiving person has opened your email. They call this feature open tracking. Is it possible to configure emacs email client mu4e to have this feature?


texts: Preventing shell mode from treating ! as a history reference

texts:
Various command-line tools, such as gdb, ftp, sftp, etc, use ! to prefix a command to be run in a shell. So (for instance) !mkdir foo will make a directory called foo. When using these tools inside emacs shell-mode, the shell-mode treats the ! as a history reference, does a history lookup, and expands the result before putting the command in the history ring. So if I have previously typed mkdir bar, shell-mode puts mkdir bar foo into the history ring.
Can I easily suppress all special treatment of ! in the shell history? I want the history to contain !mkdir foo. I don't ever use ! at the shell, so I'd be happy with a way of turning this off entirely, although I suppose it could be made switchable based on the prompt.


texts:
Attempting to delete a symlink in Dired gave me an unexpected result: the target got deleted.
I have lots of Lisp code, and that may be a bug in some Lisp code that is not currently part of Emacs.
Could someone please tell me what is supposed to happen when you attempt to delete a symlink in Dired?  In particular, if you mark it with D and then do x and answer yes.
Is that supposed to delete the link but not the target, presumably?
GNU Emacs 26.3 (build 1, x86_64-w64-mingw32) win 7


texts:
Is it possible to have only one mode line (sometimes referred as "statusbar") for all windows?

I'd like to make this single mode line show information about the currently selected buffer.


texts:
I'm using lsp-java package as java IDE and syntax completion.
Below is my configuration
    (require 'lsp-java)
    (add-hook 'java-mode-hook #'lsp)

    (condition-case nil
        (require 'use-package)
      (file-error
       (require 'package)
       (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
       (package-initialize)
       (package-refresh-contents)
       (package-install 'use-package)
       (setq use-package-always-ensure t)
       (require 'use-package)))

    (use-package projectile)
    (use-package flycheck)
    (use-package yasnippet :config (yas-global-mode))
    (use-package lsp-mode :hook ((lsp-mode . lsp-enable-which-key-integration))
      :config (setq lsp-completion-enable-additional-text-edit nil))
    (use-package hydra)
    (use-package company)
    (use-package lsp-ui)
    (use-package which-key :config (which-key-mode))
    (use-package lsp-java :config (add-hook 'java-mode-hook 'lsp))
    (use-package dap-mode :after lsp-mode :config (dap-auto-configure-mode))
    (use-package dap-java :ensure nil)
    (use-package helm-lsp)
    (use-package helm
      :config (helm-mode))
    (use-package lsp-treemacs)

When I open any java file, I get the error file mode specification error (wrong-type-argument lsp--client nil)

This error seems to happen when I deleted the packages and reinstalled the packages. particularly lsp-java.
Any idea how can I resolve this error?


texts:
first, defined this interactive function:

(defun system-is-windows ()
  (interactive)
  (string-equal system-type "windows-nt"))

then call this function in one setting.el file

; don't show the scroll bar
(if system-is-windows (scroll-bar-mode 0))

and it throws back the following error:

Debugger entered--Lisp error: (void-variable system-is-windows)
  (if system-is-windows (scroll-bar-mode 0))
  eval-buffer(#<buffer  *load*-51294> nil "c:/Users/user/.emacs.d/settings/general-settings.el" nil t)  ; Reading at buffer position 1439
  load-with-code-conversion("c:/Users/user/.emacs.d/settings/general-settings.el" "c:/Users/user/.emacs.d/settings/general-settings.el" nil t)
  require(general-settings)
  eval-buffer(#<buffer  *load*> nil "c:/Users/user/.emacs.d/init.el" nil t)  ; Reading at buffer position 849
  load-with-code-conversion("c:/Users/user/.emacs.d/init.el" "c:/Users/user/.emacs.d/init.el" t t)
  load("c:/Users/user/.emacs.d/init" t t)
  #f(compiled-function () #<bytecode 0x1000be22d>)()
  command-line()
  normal-top-level()


texts: Create Smart Multi-level Headings with Proper Indentation

texts:
When working with phone calls and tickets, I use Emacs in Org mode to pre-create the entry with the heading containing the current date and time.  For obvious reasons, if not constantly using a new file (which would make history searches more difficult), I end up with a very long flat list of call headings and their respective contents.

I now want to change that, so that I get a top-level header with the year, a second-level header with the month and then a third-level header with the actual call entry.

In my trials, I manage to get the results when using the first entry inside the call file, but as soon as I get the second (third, fourth), the indentation is getting deeper with each entry.  I also experimented with "post-editing" the automation (e.g. (org-insert-subheading t) (beginning-of-line) (delete-char 1) (end-of-line)), but I find that very messy to the point that items like (org-insert-heading) would have no meaning anymore.

The result shall look somewhat like this:

* <2019>
** <12>
*** call <date&time_of_call>
*** call <date&time_of_call>
* <2020>
** <01>
*** call <date&time_of_call>
*** call <date&time_of_call>
** <02>
*** call <date&time_of_call>
*** call <date&time_of_call>
...

My code so far looks like this (I call eltest with a key shortcut):

(defvar sFilePath "~/Documents/Emacs/"
  "Path to directory.")

(defvar sTestEntryYear "<%Y>"
  "Year format string for entry headings.")
(defvar sTestEntryMonth "<%m>"
  "Month format string for entry headings.")
(defvar sTestEntry "<%a, %Y-%m-%d %H:%M:%S>"
  "Date & time format string for entry headings.")

(defun insert_test_template ()
  "Insert the test template"
  (interactive)
      ((lambda ()
     (org-insert-subheading t)
     (insert (concat "Calls " sNow " Call|WalkUp: ProblemDescription\n\n"))
     (insert "template goes on here\n")
     (insert "RESULT\n")
     (insert "-> "))))

(defun eltest ()
  "Add a new call entry."
  (interactive)
  (switch-to-buffer (find-file (concat sFilePath "Test.org")))
  (widen)
  (let ((sThisYear (format-time-string sTestEntryYear)) (sThisMonth (format-time-string sTestEntryMonth)) (sNow (format-time-string sTestEntry)))
    (end-of-buffer)
    (unless (org-goto-local-search-headings sThisYear nil t)
      ((lambda ()
     (org-insert-heading nil nil t)
     (insert (concat sThisYear "\n")))))
    (end-of-buffer)
    (unless (org-goto-local-search-headings sThisMonth nil t)
      ((lambda ()
     (org-insert-subheading t)
     (insert (concat sThisMonth "\n")))))
    (end-of-buffer)
    (unless (org-goto-local-search-headings sNow nil t)
      ((lambda ()
     (insert_test_template))))
    (while (progn
         (previous-line 1)
         (not (looking-at "^- Name  : $"))))
    (org-show-entry)
    (end-of-line)))


texts:
I'm trying to make a trivial function that simply transposes chars backwards.

This is what I got so far:

(defun jd:backward-transpose-chars ()
  (interactive)
  (transpose-chars -1))

(define-key global-map (kbd "<C-y>") '(transpose-chars))

(define-key global-map (kbd "<C-S-y>") '(jd:backward-transpose-chars))

But it gives me the error:

  Debugger entered--Lisp error: (wrong-type-argument commandp
  (jd:backward-transpose-chars))


texts: Tramp x11 on Mac os (local) , centos (remote)

texts:
I understand that I should be able to use X11 to show graphs from a remote R when I use a local emacs to connect to the remote machine with tramp.

I have tried a few different things but can not get it to work. I know that the server will work with X11 as if I ssh in using a normal terminal it works.

Currently my .emacs file has:

;; emacs x11 tramp
(add-to-list 'tramp-remote-process-environment
              (format "DISPLAY=%s" (getenv "DISPLAY")))

(with-eval-after-load 'tramp
  (add-to-list 'tramp-methods
               '("sshx11"
                 (tramp-login-program        "ssh")
                 (tramp-login-args           (("-l" "%u") ("-p" "%p") ("%c")
                                              ("-e" "none") ("-Y") ("%h"))) ; tried -Y and -X :(
                 (tramp-async-args           (("-q")))
                 (tramp-remote-shell         "/bin/sh")
                 (tramp-remote-shell-login   ("-l"))
                 (tramp-remote-shell-args    ("-c"))
                 (tramp-gw-args              (("-o" "GlobalKnownHostsFile=/dev/null")
                                              ("-o" "UserKnownHostsFile=/dev/null")
                                              ("-o" "StrictHostKeyChecking=no")
                                              ("-o" "ForwardX11=yes")))
                 (tramp-default-port         22)))
  (tramp-set-completion-function "sshx11" tramp-completion-function-alist-ssh))

On my local machine I also have two files, config and sshd_config in my .ssh folder. The latter simply contains X11Forwarding yes whereas the former has Host my_alias
     Hostname myhost
     User myusername
     ForwardX11 yes
     ForwardX11Trusted yes (with appropriate subs)

I connect to my server with C-x C-f sshx11:user@host:/
I then do M-x shell and select the "remote shell path" (to bin bash) and the starting directory.

Now when in the shell if I try echo $DISPLAY I get
/private/tmp/com.apple.launchd.zmPeFoMlxA/org.macosforge.xquartz:0

But if I try to load an xprogram such as xterm to test I get:
xterm Xt error: Can't open display: /private/tmp/com.apple.launchd.zmPeFoMlxA/org.macosforge.xquartz:0


texts: How to change the "Figure" text created when exporting a LaTeX file with org-mode. I want it to say "Figura" as I speak Spanish

texts: When I export all the images get the "figure" and the number of the image with the caption. When I export I want it to say "figura" instead of the English word.


texts: Detect a region in markdown and run a compilation

texts:
It would be really useful if emacs could detect the cursor is currently inside a code-block in my markdown-file and compiles the fragment automatically.

I am editing a large markdown file with a lot of code sections in it. Most code sections begin with #!cpp filename=somefile.cpp test=output, which means: *The code is a real and complete code fragment that is compileable, runnable (ie, contains main) and contains its own test data (in //= commented lines).

Here is an example:

You can *initialize* a `vector`:

%%heading: It is empty.

    #!cpp filename=41vector-init-default.cpp test=output.cpp
    #include <vector>
    #include <iostream>
    using std::vector; using std::cout;
    int main() {
       vector<int> dataA;
       vector<int> dataB{};
       vector<int> dataC = {};
       cout << dataA.size() << ' ' dataB.size() << ' ' << dataC.size() << '\n';
       //= 0 0 0
    }

You can *copy* it:

%%heading: Copy the thing

    #!cpp filename=41vector-init-copy.cpp test=output
    #include <vector>
    #include <iostream>
    using std::vector; using std::cout;
    int main() {
        vector<int> input{1,2,3};
        vector<int> output(input);
        cout << output.size() << '\n';
        //= 3
    }

There you go.

It would be really useful if emacs could detect the cursor us currently inside a #!cpp-Block and execute my python-script ly-compile.py on it that compiles, executes and checks it. Maybe each time I move the cursor inside such a section or change text inside of it. The result of the python script should be shown in a separate buffer/window, on-the-fly.

The python-script takes filename to compile and a bunch of command-line arguments taken form the #!cpp-line. I could adjust it so it reals all it needs from stdin.

How can I plug the different things together that emacs already can do or tweak them so it works on-the-fly? flymake seems to be a candidate, but how?


texts: Issues With org-ql and Searching Based On Property Inheritence

texts:
I would like to be able to search for all TODO's with a property of FEATURE_NUM, and that property is inherited in my TODO's.

Here's what I have in my init.el to make that property inheritable:

(setq org-use-property-inheritance
      (list "FEATURE_NUM"))

I then have a TODO tree that looks like thes:

* Task List
  :PROPERTIES:
  :FEATURE_NUM: 12345
  :END:
** TODO Go over the API design docs                      :c_coding:

When I search using org-sparse-tree for an element with that property name and value, that TODO is returned.

I then looked in the org-ql docs regarding property searches and saw that I need to use a custom predicate if I want to search for properties using inheritance. I therefore created a query like this:

(org-ql-block '(and
                (todo)
                (property "FEATURE_NUM")
                (> 0 (string-to-number (org-entry-get (point) "FEATURE_NUM" 'inherit)))
                ))

I'm trying to evaluate each TODO and see if it has that property name and the value is > 0.
However, this query always returns nil.

Can anyone see what I'm missing? According to the docs this seems to be the right way to do things.


texts: How to show startup screen instead of scratch, when no file is opened?

texts:
Like a lot of people I think I activated inhibit-startup-screen because it’s ugly and tedious to always have your emacs horizontally split when you open a file with half taken by an useless startup screen… But I notice I find it better/more beautifull/helpfull/useful than just an unique void scratch buffer when I open Emacs without opening a file…

So is there a way so that this startup screen shows up only when there’s nothing else to show up? as when the scratch buffer is displayed at startup? instead of it? and not to show up if I open a file or run a command like gnus or erc?


texts: show which package repo was used to obtain a package

texts:
I'm trying to submit a bug report to emacs-evil, and they ask me from which repo evil was installed.
I'm just using the version that came bundled with doom-emacs.
How can I know which source was used to install a mode? is that information saved with the mode in emacs? must I look at the source of the doom config to find where it downloads files?


texts: savehist-mode: Lisp error: (void-variable pell-buffer)

texts:
I am using GNU Emacs 26.3 in macOS. For (savehist-mode 1) I keep getting following error:
Debugger entered--Lisp error: (void-variable pell-buffer)
  signal(void-variable (pell-buffer))
  savehist-mode(1)
  eval-buffer(#<buffer  *load*> nil "/Users/alper/.emacs" nil t)  ; Reading at buffer position 98709
  load-with-code-conversion("/Users/alper/.emacs" "/Users/alper/.emacs" t t)
  load("~/.emacs" t t)
  #f(compiled-function () #<bytecode 0x400d1a6d>)()
  command-line()
  normal-top-level()

What may be the main cause of this error and how can I solve it?


texts:
I have enabled org-indent-mode in all org files as such:

(add-hook 'org-mode-hook 'org-indent-mode)

Now I want to diminish the "Ind" minor mode, which seems to be beyond my abilities. I know the diminish package is loading and working properly, as other diminishes work as expected.

I managed to find (add-hook 'org-mode-hook '(diminish 'org-indent-mode)), which actually diminishes the mode, but also shows File mode specification error: (invalid-function (diminish (quote org-indent-mode))) in messages, which seems like I'm doing something wrong.

A list of other things I've tried that don't work:

(eval-after-load "org" '(diminish 'org-indent-mode))

(diminish 'org-indent-mode)

(add-hook 'org-mode-hook
      (lambda ()
      (diminish 'org-indent-mode))

(defun dim-org-ind-mode ()
    "Hah, this doesn't work either."
    (interactive)
    (diminish 'org-indent-mode))
(add-hook 'org-mode-hook 'dim-org-ind-mode)

Using M-x diminish works fine with no errors in messages.


texts: How do I use org mode to export a link to a relative URL?

texts:
I'm exporting an org file to HTML that will live at http://example.com/foo/bar.html and also at http://another.url/a/b/c.html. I'd like to write some org syntax that exports links to other files on the same server.

Case 1. I want to link to another file in the same directory. How do I get output lore?

[[data.txt][lore]] --> error "Unable to resolve link"
[[./data.txt][lore]] --> lore - good enough

Case 2. I want to link to a file in the root directory. How do I get output skynet?

[[/robots.txt][skynet]] --> skynet, not what I want
[[../../robots.txt][skynet]] --> skynet - works only if I know how many levels up

Is there a direct way to output data.txt or /robots.txt as the link without getting file:// prepended, and without having to use ./ and ../ as workarounds?

I see a different workaround on this question but the function mentioned there, org-add-link-type, is marked Obsolete in org 9.0, and it's not obvious to me how to use org-link-set-parameters for this.


texts: How do I measure performance of elisp code?

texts:
How do I measure the performance of my elisp code? What tools / external packages are available for me to measure time taken?

In addition to total time, can I see a profile that shows time taken per-function? Can I profile memory usage too?


texts: Using compilation-mode to parse error stacks, relocating them

texts:
I run several applications, in several languages, that store their error stacks
locally.  I made a small emacs mode that allows me to browse those errors and
navigate the related code.  The code I wrote, at its core, is basically loading
those stacks from the database in a buffer and setting that buffer in
compilation code.  Then I can browse code by using previous-error,
next-error, etc. to navigate the code.  compilation-mode is great because it
knows many error regexps so I don't need to deal with them (I add to add just 3
new regexps to local variable compilation-error-regexp-alist)

Very convenient and that has been working fine for years.  The paths of the
stacks are absolute, which suits fine to compilation mode.

But more and more I run those applications in lightweight containers.  Then, the
path of those stacks does not works because I have mounted the container
filesystem in different paths in my host (I run emacs exclusivelly in the host,
and I store the stacks there).  Then, emacs cannot find the path the files are
and I cannot browse them.

I mount the root filesystem os my containers in known locations.  So, for a
stack /a/b/c/d.c:80 in container "foo", I can calculate the path very easily:
/containers/foo/a/b/c/d.c:80

I tried to use compilation-search-path, with no avail (compilation-find-file
does not concatenate an absolute path to the elements of the search path, only
the basename)

I would appreciate some hint of how to achieve what I want (basically smarting
compilation-find-file to prepend a path to those paths in its "error lines")
that does not violates compile.el encapsulation.


texts:
I am working on Debian 10 with Emacs installed from official Debian repositories (ver 1:26.1+1-3.2)
and
using the following code I cannot connect to synchronize packages available on MELPA:
Here's my init file:
(require 'package)

(setq package-archives
'(
   ("org" . "http://orgmode.org/elpa/")
   ("gnu" . "http://elpa.gnu.org/packages/")
   ("melpa" . "http://melpa.org/packages/")
))

(package-initialize)

(unless package-archive-contents
  (package-refresh-contents))

(setq my-package-list '(use-package))

(dolist (package my-package-list)
  (unless (package-installed-p package)
    (package-install package)))

Whatever I do, I keep obtaining:
 "Package 'use-package-' is unavailable"

I checked ~/.emacs.d/elpa/archives and I have no melpa directory in it, only gnu and org.
On the other hand I can fetch melpa's repositories via:
 curl https://melpa.org/packages/archive-contents

I can also use melpa with the use of straight.el, for example via this code:
(defvar bootstrap-version)
(let ((bootstrap-file
       (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
      (bootstrap-version 5))
  (unless (file-exists-p bootstrap-file)
    (with-current-buffer
        (url-retrieve-synchronously
         "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
         'silent 'inhibit-cookies)
      (goto-char (point-max))
      (eval-print-last-sexp)))
  (load bootstrap-file nil 'nomessage))

(straight-use-package 'use-package)

But as far as I can see straight.el fetches MELPA repository on its own.
What is wrong with the original code? What can I do to track the problem?


texts: Switch window split orientation, fastest way


texts:
I have a problem with using calc. When I have two windows open in emacs, split vertically, calc frequently opens in the wrong window. Here's a demonstration of the problem that I ran with emacs -Q.

First, have a split window. In this case, the scratch buffer and a random other buffer, with the point in the scratch buffer:

I do M-x calc, and this happens:

It should have split the scratch buffer, not the right one. This in itself is not a huge issue, but the problem is that when i try to yank stuff from calc back into to the buffer, it winds up in the wrong one:

I wanted the 43 that I yanked into the buffer from calc (with y in calc, which runs calc-copy-to-buffer) to wind up in the scratch buffer (since that's where i started from), but it doesn't.

Anyone know a way to fix this issue?


texts: How can I define a new group on an existent transient?

texts:
I want to customize the forge-dispatch transient. Specifically I want to add new group, Remote, to the right side of Create. And add the new suffix there.

As far as I know, transient-{append,replace}-suffix all add a suffix in relation to an existing suffix. But I'm at a loss as to how create a new group in the existing transient. I'm guessing the solution would look something like the following:
  (transient-??? 'forge-dispatch "Remote"
    '("o" "Browse repository" forge-browse-remote))


texts:
The gnus Summary Buffer can be refreshed/updated to show new articles with / N.

How can the buffer be refreshed/updated to remove messages deleted with B DEL? These remain after issuing B DEL and / N.


texts: Enabling paredit automatically in clojure and clojurescript buffers

texts:
I want to auto-enable paredit it in clojure and clojurescript buffers, and have the following:
  (autoload 'enable-paredit-mode "paredit" "Turn on pseudo-structural editing of Lisp code." t)
(eval-after-load ‘clojure-mode
  '((add-hook 'clojure-mode-hook #'enable-paredit-mode)
    (add-hook 'clojurescript-mode-hook #'enable-paredit)))

(eval-after-load ‘clojurescript-mode
  '((add-hook 'clojure-mode-hook #'enable-paredit-mode)
    (add-hook 'clojurescript-mode-hook #'enable-paredit)))

But it doesn't work.


texts: How to scroll another buffer while in minibuffer?

texts:
I'll describe what I'm doing currently to get an issue. First, I store the current buffer.

M-: eval-expression

(setq bb (current-buffer))

Then, M-:

(with-current-buffer bb
  (insert "foo"))

While still in minibuffer, C-e, C-x C-e. I get the expected result: foo
is inserted in the buffer bb.

However, if I change the expression to

(with-current-buffer bb
  (goto-char (point-min)))

After C-x C-e I get the result 1, but the point doesn't move.
It would seem that scrolling is disabled while in minibuffer. How can I enable it?


texts: orgmode capture template: adding sub headers

texts:
i have the following template

(add-to-list 'org-capture-templates
               '("un" "resturant"
                 entry
                (file+headline "/home/zeltak/org/files/agenda/travel.org" "NYC")
"* TOVISIT %^{Description}
%u
  :PROPERTIES:
  :Rating: %^{rating?|-|1|2|3|4|5}
  :price: %^{price in local currancy?|-|0-10|10-20|20-30|30-50|50+}
  :Source: %^{Source?}
  :Type: %^{Type?|meal|breakfeast|dessert|street}
  :Cuisine:
%^{Cuisine?|-|Indian|Thai|Vietnamese|Asian|Chinese|Israeli|Italian|American|EastEuro|Mexican|French|Persian|Austrian|Japan}
  :Fav: %^{Fav|yes|no}
  :END:

%^{prompt|** My Review}
%?
    "
       ))

note the last entry where i try and add a sub header. when i finzalize the capture it dosent create a header but rather just add the 2 starts.

is there a way to make the capture template add a proper sub header?


texts: Using multiple flycheck syntax checkers in web-mode

texts:
I'm trying to configure Flycheck to use both csslint and tidy checkers in web-mode without any success. This post suggests using this code for tidy:

(eval-after-load 'flycheck
  '(flycheck-add-mode 'html-tidy 'web-mode))

But adding an extra line like

'(flycheck-add-mode 'css-csslint 'web-mode)

is not possible which I think is due to eval-after-load. Any suggestions?

Or is it at all possible for web-mode to change Flycheck language say by using web-mode-cur-language and web-mode-language-at-pos?


texts:
emacs -nw -q or emacs -nw -Q takes more than 10 seconds to start in terminal, but the result of M-x emacs-init-time is 0.0 seconds, and the emacs takes shorter time (still more than 5s) than emacs -nw -q or emacs -nw -Q and the result M-x emacs-init-time is 3.5 seconds, this is really weird.

Does anyone know what is going on?

FYI:

CentOS 6.5 32-bit

GNU Emacs 24.4.2 (compiled from the source code at the official gnu website)


texts: How to change font without breaking Unicode glyph mapping?

texts:
I am using Emacs 24.5 (stock Debian jessie) with a UHD display.  I am over 50 and I need a large font.  I have found a font that works well, but when I set the font using

(set-face-attribute 'default nil :font "Droid Sans Mono" :height 130)

it breaks the rendering of Unicode character U+2099 (Latin subscript small letter N).  The glyph renders not as a subscript n but as a superscript theta.

I have verified with emacs -q that the stock distribution renders the subscript small N correctly with the default font, and that the single command above is enough to break the small N.  My other unicode subscripts, Greek letters, and math symbols seem to render correctly.

How can I change the main font without breaking the mapping of the subscript small N?