texts: Increase the font size for Hebrew text in Emacs but leave English font size as is

texts:
I frequently type both in Hebrew and English. The font I use is Dejavu Sans Mono. This renders Hebrew fonts accurately. However, because Hebrew uses small vowels, I would like to increase the font size of the Hebrew text but keep the English as it is. I have tried various solutions but none have worked for worked for me:

I installed the package unicode-fonts, but this does not seem to have the ability to tweak font sizes.

I followed the instructions in this link How to assign a certain font for each input method/language in Emacs 24? but found no useful solution there.

I use the code below to change input methods:

  (define-key 'iso-transl-ctl-x-8-map "f" [?])

  ;; Input method and key binding configuration.
  (setq alternative-input-methods
        '(("hebrew-biblical-sil" . [?\C-\\])
          ("greek-babel" . [?\C-|])))
  (setq default-input-method
        (caar alternative-input-methods))
  (defun toggle-alternative-input-method (method &optional arg interactive)
    (if arg
        (toggle-input-method arg interactive)
      (let ((previous-input-method current-input-method))
        (when current-input-method
          (deactivate-input-method))
        (unless (and previous-input-method
                     (string= previous-input-method method))
          (activate-input-method method)))))
  (defun reload-alternative-input-methods ()
    (dolist (config alternative-input-methods)
      (let ((method (car config)))
        (global-set-key (cdr config)
                        `(lambda (&optional arg interactive)
                           ,(concat "Behaves similar to `toggle-input-method', but uses \""
                                    method "\" instead of `default-input-method'")
                           (interactive "P\np")
                           (toggle-alternative-input-method ,method arg interactive))))));; Input method and key binding configuration.
(reload-alternative-input-methods)


texts:
i'm using spacemacs with emacs 25.2.1 on windows8.1 64bit.
Description:
i want to use diff-hl-flydiff-mode.

Tried:
First i activated the spacemacs layer version-control. That works.

But how can i switch into the mode?
I can see Ediff and several commands, but nothing about diff-hl-flydiff-mode.
Do i need to install another package?


texts:
Is there a way to cut text in such a way that it is only removed from the buffer when I paste it somewhere else?

I find myself often losing the text I had cut because, after I cut, I find out I need to do something else before I can paste the text where I want it.


texts: How do I make a bug report or feature request against GNU Emacs?

texts:
I found this list at the emacswiki:

FFI (foreign function interface). Would be great to have this in GNU.
Enhanced Numerics. We sorely need this too.
Apparently much better multimedia support (Of particular interest to me.)
Doubly-linked lists, skip lists, and some other possibly interesting data structures.

Does Emacs have a feature request location, or even somewhere to post issues?


texts: Where can I see the character mapping of an input method?

texts: Because of some difficulties in getting Emacs interact correctly with the fcitx input framework on my Ubuntu, I have to use built-in input methods in Emacs. However, I haven't been able to find a way to see the character mapping for each input method that is there. For example, I couldn't find a way to enter ñ in Spanish (input method spanish-prefix), or ' in German (input method german), in my US keyboard. How can I view the character mapping with respect to the current keyboard?


texts: Stopping a runaway process using C-c C-c

texts:
When i evaluate some source code blocks using C-c C-c sometimes i might have an error and the system hangs on me . The only way to exit at this point is by quitting emacs. Are there any solutions to this. A simple example using R would be

#+Begin_src R
print ("testing this command"
#+end_src

if I run a C-c C-c in the current R session it is waiting for me to complete the braces and therefore emacs hangs as it show 'executing R code block ... ' in the mini buffer.

I understand this is mainly user error, but i would like to not have to interactively test every bit of code and also be able to break out of this as opposed to restarting.
Any help/ insight will be much appreciated
Cheers
Ashok


texts: How to run emacs under valgrind correctly?

texts:
I have tried running the official Fedora build of emacs under valgrind. It very quickly errors out due to thinking it has run out of memory. This is a known issue mentioned in the Valgrind documentation.

The Valgrind documentation says to rebuild emacs with system malloc, so I tried rebuilding emacs from the Fedora srpm, modifying the configure file to set system_malloc=yes always. But this has the same issue - it turns out that my modification didn't take effect because configure gets overwritten by make bootstrap.

So then I modified both configure.ac and configure in the same way. This segfaults during the build.

I then ran the bootstrap version of emacs (the one that was segfaulting during the build) under Valgrind, which produced what are described as spurious errors. It turns out that dumping doesn't work with Valgrind, so it's recommended to run temacs instead of emacs.

However, I tried running temacs from the incomplete build, but it failed to start:

Loading loadup.el (source)...
Using load-path (/home/robin/rpmbuild/BUILD/emacs-25.1/build-gtk/../lisp)
Loading emacs-lisp/byte-run (source)...
Loading emacs-lisp/byte-run (source)...done
Loading emacs-lisp/backquote (source)...
Loading emacs-lisp/backquote (source)...done
Loading subr (source)...
Loading subr (source)...done
Loading version (source)...
Symbol’s function definition is void: pcase

In etc/DEBUG in the emacs source, the following advice is given:

  ** Running Emacs built with malloc debugging packages

  If Emacs exhibits bugs that seem to be related to use of memory
  allocated off the heap, it might be useful to link Emacs with a
  special debugging library, such as Electric Fence (a.k.a. efence) or
  GNU Checker, which helps find such problems.

  Emacs compiled with such packages might not run without some hacking,
  because Emacs replaces the system's memory allocation functions with
  its own versions, and because the dumping process might be
  incompatible with the way these packages use to track allocated
  memory.  Here are some of the changes you might find necessary:

  Edit configure, to set system_malloc and CANNOT_DUMP to "yes".
  Configure with a different --prefix= option.  If you use GCC,
  version 2.7.2 is preferred, as some malloc debugging packages
  work a lot better with it than with 2.95 or later versions.
  Type "make" then "make -k install".
  If required, invoke the package-specific command to prepare
  src/temacs for execution.
  cd ..; src/temacs

  (Note that this runs 'temacs' instead of the usual 'emacs' executable.
  This avoids problems with dumping Emacs mentioned above.)

However, these instructions are not detailed enough to be self-contained - I don't understand how to follow these instructions - beyond setting system_malloc to yes, which I have done.


texts: Using org-beamer: display image on every page except the title page

texts:
Using org-beamer-export-to-pdf with the following document, I am able to display an image on every slide

#+LATEX_HEADER:\usepackage{eso-pic}% http://ctan.org/pkg/eso-pic
#+BEAMER_HEADER:\newcommand\AtPagemyUpperLeft[1]{\AtPageLowerLeft{\put(\LenToUnit{0.85\paperwidth},\LenToUnit{0.9\paperheight}){#1}}}\AddToShipoutPictureFG{\AtPagemyUpperLeft{{\includegraphics[width=1.cm,keepaspectratio]{logo.png}}}}
* A Slide goes here
** With some content
* Another slide
** Yet more content

This works well because it places the image on top of the page headers, where other attempts like

#+BEAMER_HEADER:\logo{\includegraphics[height=.8cm]{logo.png}\vspace{6cm}\hspace{0.5cm}}

The image would be covered by the header.

What I'd like to do now is to skip the title page when displaying the image.

The solutions suggested in TeX forums often suggest placing the \AddToShipoutPictureFG after building the title page. However,I'm not sure how to control the placement of that command using org-beamer.


texts: Run fill-paragraph for content on org-mode export

texts:
How can you run fill-paragraph on an exported document?

fill-paragraph/auto-fill-mode distribute and insert newlines which help when reading a document in an editor that doesn't necessarily wrap long lines automatically.

I don't want to use auto-fill-mode because it transforms the org mode content being edited.  I just want exported content to have inserted newlines.


texts: Selecting text without moving the cursor

texts:
I would like to grow a selection without moving point (the cursor) from its location. I know I can always use C-u C-spc to move to the previous location, but I would like to avoid that.

More specifically, I would like to do both of these operations:

Select all text in the buffer
Gradually add subsequent lines / paragraphs to the selection

while keeping the cursor where it is.

Does Emacs have any interactive functions for this? Are they bound to any keyboard shortcuts?


texts: Color problem on the bottom right corner?

texts:
I am using terminal emacs. Please see the screenshot:

There is a dark area which is not matching with the background in the bottom right corner of the screen. What is the face for that?

How do you deal with issues like this? Is there an emacs wireframe which can tell which what these UI components are?


texts: Can I hide the part of long lines that exceeds the visual line?

texts: Is it possible to hide the part of long lines that exceeds the visual line rather than wrapping it into further visual lines?


texts:
Looking at the package installed under elpa directory I see that it have been byte compiled and the structure is different from the source.

Consider the following example https://github.com/hlissner/emacs-doom-themes:

$ ls -1a
.git
.gitignore
.travis.yml
Cask
LICENSE
Makefile
README.md
doom-themes-base.el
doom-themes-ext-neotree.el
doom-themes-ext-org.el
doom-themes-ext-treemacs.el
doom-themes-ext-visual-bell.el
doom-themes.el
test
themes

When downloading the package from elpa I see a different file tree, with all the files at the root dir:

$ ls -1a
doom-Iosvkem-theme.el
doom-challenger-deep-theme.el
doom-city-lights-theme.el
doom-dracula-theme.el
doom-fairy-floss-theme.el
doom-gruvbox-theme.el
doom-molokai-theme.el
doom-moonlight-theme.el
doom-nord-light-theme.el
doom-nord-theme.el
doom-nova-theme.el
doom-one-light-theme.el
doom-one-theme.el
doom-opera-light-theme.el
doom-opera-theme.el
doom-outrun-electric-theme.el
doom-palenight-theme.el
doom-peacock-theme.el
doom-snazzy-theme.el
doom-solarized-dark-theme.el
doom-solarized-light-theme.el
doom-sourcerer-theme.el
doom-spacegrey-theme.el
doom-themes-base.el
doom-themes-ext-neotree.el
doom-themes-ext-org.el
doom-themes-ext-treemacs.el
doom-themes-ext-visual-bell.el
doom-themes-pkg.el
doom-themes.el
doom-tomorrow-day-theme.el
doom-tomorrow-night-theme.el
doom-vibrant-theme.el
doom-wilmersdorf-theme.el

I've tried to run make and cask on the source project but I couldn't achieve the same result.


texts: How can the ace-window hotkey be set to work in sr-speedbar?

texts:
I have configured the M-p key to trigger ace-window, but when I navigate to the sr-speedbar window it stops working and I have to use C-x o to move out. Is there some mode hook I have to use to ensure that M-p works in sr-speedbar or does sr-speedbar use that key for something else?

(use-package ace-window
  :ensure t
  :defer t
  :init
  (progn
    (global-set-key (kbd "M-p") 'ace-window)
    (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l))
     ;;more info at https://github.com/abo-abo/ace-window
    )
  )


texts: How to open a diff at the position of the current buffer?

texts:
Emacs has a useful feature to jump to the line (via diff-goto-source-and-close).

Is there a way to do the reverse with vc-root-diff or something similar?

That is to open a diff, jumping to the current line of code (if it's been modified or added?).


texts: Magit status wired output (control sequences)

texts:
When I use magit on a RHEL 7 box today, it gives me this output when checking magit-status:

Not sure what went wrong. Magit-version output is:

Magit 2.11.0, Git 2.14.1, Emacs 25.3.1, gnu/linux

The same Emacs setting works on Mac without any issue, haven't checked with a different Linux box yet.

Has anyone encountered the same problem before?

Thanks.

Edit:

Found the problem, thanks to icarus.
Sometime ago, I added

[color]
  ui = always

in my ~/.gitconfig. That's cause for all these control characters to show up. Removing it fixed it.


texts: Changing the file association of todoo or alternatively completely disable it

texts:
I am using emacs on a debian system and have installed emacs-goodies-el. One of the many things in there is todoo which registers itself in auto-mode-alist for all files ending in TODO.

This particular association is in the way and I would like to either get rid of todoo or just change the entry in the auto-mode-alist.

I tried to find a switch in customize-group emacs-goodies-el but there seems to be nothing.

I've got a few incantations in a file in ~/.emacs.d and could add to those, but fiddling with with auto-mode-alist seems a bit daunting. The entry I need to get rid of is

("TODO\\'" . todoo-mode)

So if anyone knows off-hand how to easily disable todoo in emacs-goodies-el, let me know. Alternatively a hint how to remove this element from the alist or just define a different file pattern would help.


texts:
I use mutt for email (outside of emacs) and set my EDITOR to an emacsclient invocation. Thus, mutt spawns emacsclient in the same terminal when I want to compose an E-mail, then catches the output file when I quit.

This buffer operates in Fundamental Server mode. Most things are satisfactory; however, when I use fill-paragraph on a paragraph with a semicolon in it (used as in ordinary English), it interprets the semicolon for some reason and fills badly. Thus:

This is a sentence containing enough text to overflow the fill-column; when I try to fill, it fails.

With fill-column at 80, this should fill to:

This is a sentence containing enough text to overflow the fill-column; when I
try to fill, it fails.

Instead, it becomes:

This is a sentence containing enough text to overflow the fill-column; when I
                                                                     ; try to
                                                                     ; fill, it
                                                                     ; fails.

This is obviously not very useful. The same behavior occurs in text-mode. I assume emacs is parsing the semicolon as a comment delimiter, or something of that nature; however, it's unclear to me why this should occur in either fundamental-mode or text-mode, which shouldn't accomodate specific programming languages.

How do I get rid of this behavior?


texts:
I'm trying to write a Flycheck checker definition based on Hy, using the API here. As part of that, I have to define a pattern for error matching. Now, Hy gives quite a large error spew, for example:

Traceback (most recent call last):
  File "/usr/bin/hy", line 9, in <module>
    load_entry_point('hy==0.10.1', 'console_scripts', 'hy')()
  File "/usr/lib/python3.4/site-packages/hy/cmdline.py", line 305, in hy_main
    sys.exit(cmdline_handler("hy", sys.argv))
  File "/usr/lib/python3.4/site-packages/hy/cmdline.py", line 293, in cmdline_handler
    return run_file(options.args[0])
  File "/usr/lib/python3.4/site-packages/hy/cmdline.py", line 194, in run_file
    import_file_to_module("__main__", filename)
  File "/usr/lib/python3.4/site-packages/hy/importer.py", line 74, in import_file_to_module
    eval(ast_compile(_ast, fpath, "exec"), mod.__dict__)
  File "helloworld.hy", line 1, in <module>
    (prin "Hello world")
NameError: name 'prin' is not defined

The only part of interest to the checker is the very last bit:

  File "helloworld.hy", line 1, in <module>
    (prin "Hello world")
NameError: name 'prin' is not defined

So I need to write a :error-patters form that will match the following exactly:

A tab character
The string File "
The name of my file (Flycheck does this using (file-name))
The string ", line (with a terminating space)
The line number (Flycheck does this using line)
The string , in <module>\n\t\t (where \n\t\t is a newline followed by two tabs)
Whatever follows until the next newline (including that newline)
Whatever remains is the error message (which Flycheck matches with (message))

So far, I have this:

:error-patterns ((error line-start "\tFile \"" (file-name) "\", line " line ", in <module>\n\t\t")) ;something more needs to go here

This gets me as far as step 6, but I'm not sure what to do for step 7, as I don't know rx at all. Any and all help would be very much appreciated, both by me and the fledgling Hy community.


texts:
I recently updated to emacs 26.1. Since then, grep results are not highlighted and  does not contain links to files. 'n' or 'p' gives "Moved past last grep hit" or "Moved back before first grep hit".

Steps followed:
1. Ran emacs 26.1 with -Q option
2. Set the following variables:
(setq explicit-shell-file-name "C:/cygwin/bin/bash.exe")
(setq shell-file-name explicit-shell-file-name)
(add-to-list 'exec-path "C:/cygwin/bin")
(setq null-device "/dev/null")
3. grep -nHri --include=*.m -e "hello" c:/path/to/dir

Couldn't visit the files in the search results.

The same steps work in 25.2 version. In both versions, grep returns search results in windows path format (c:/path/to/dir/...)


texts: Avoid following link when using org-return-follows-link and point is at end of line

texts:
The option org-return-follows-link is wonderfully convenient except when the point is at the end of the line where the intention is usually to insert a carriage return.

What's the best way to change this behavior to insert a carriage return in this edge case?


texts:
Emacs provides a fair few commands (delete-trailing-whitespace, for instance) that can be used to clean up buffers, but sometimes we cannot use them and risk compromising the version history of
unmodified lines.
I just spent time on a particularly cumbersome merge made much harder because of whitespace changes and thought of ways to overcome this.

I'd like to implement a before-save-hook that runs delete-trailing-whitespace on every modified line in a buffer.
How can I get hold of a list of all the modified lines in a buffer?

An alternative solution using Basil's approach:

(require 'diff)
(defun delete-trailing-whitespace-at-modified-lines ()
  (when buffer-file-name
    (when (derived-mode-p 'prog-mode)
      (save-excursion
        (with-current-buffer
            (diff-no-select buffer-file-name (current-buffer) nil 'noasync)
          (diff-delete-trailing-whitespace)
          (kill-buffer))))))

(when (eq system-type 'gnu/linux)
  (add-hook 'before-save-hook 'delete-trailing-whitespace-at-modified-lines))


texts: Flycheck gives errors, when I use shellcheck as linter for bash scripts

texts:
I use GNU Emacs 26.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.18.9) of 2017-06-09, and Shellcheck 0.3.7 als linter for bash scripts (https://www.shellcheck.net).

When I open a bash script, I get errors from Flycheck, which makes it
unusable for me. Verbatim from message buffer:

  Try installing a more recent version of sh-shellcheck, and please open
  a bug report if the issue persists in the latest release.  Thanks!
  Suspicious state from syntax checker sh-shellcheck: Flycheck checker
  sh-shellcheck returned non-zero exit code 3, but its output contained
  no errors: unrecognized option `--external-sources'

  Usage: shellcheck [OPTIONS...] FILES...   -e CODE1,CODE2..
  --exclude=CODE1,CODE2..  exclude types of warnings   -f FORMAT         --format=FORMAT          output format   -s SHELLNAME      --shell=SHELLNAME        Specify dialect (bash,sh,ksh)   -V                --version                Print version information

It seems nobody is experiencing the same issue. I tested it with bare Emacs, and standard Shellcheck. How could I debug this further?


texts: Run a function after control returns to the command loop

texts:
Is there a hook that would run as soon as control returns to the user (i.e. to the command loop)?

Context: I'd like to register a function to run as soon as all functions in the current sequence of recursive calls have exited. The call stack looks like
... -> a -> b -> ... -> my function, and I would like my function to run when all functions on the stack have exited.

More context: Somewhere up in the call chain to my function there is a function f that is ill-behaved, insofar as I can't call it from one of its children (it needs to do some cleanup before I can call it again). Since I can't call f from my function, I'd like to register the call to f to run as soon as f has completed.


texts: Is there any way to configure isearch-forward-regexp invert backslashes usage?

texts: It may be handy to make it shortly, for example use (GET|POST): *\{ instead of \(GET\|POST\): *{


texts:
I have a table like this:

| Verse No | Verse      |
|          | <10>       |
|        1 | line1 li=> |
|        2 | line2 li=> |

I would like to view it as

| Verse No | Verse      |
|          | <10>       |
|        1 | line1 line |
|          | 1 line1    |
|        2 | line2 line |
|          | 2 line2    |

I am aware of C-c ` but that's not enough, I want to see all text simultaneously. Read only is OK if need be.


texts: If I press CTRL-x CTRL-c and exited the scratch buffer in Emacs, will everything I typed be gone?

texts:
My Internet was not working, and while waiting it to go back up, I used Emacs to type some ideas first.

A few minutes later, the Internet was up, and I checked my Chrome browser, and it worked. So I will use Google Docs instead, I thought.

So I came back to Emacs and too quickly pressed CTRL-x CTRL-c, and Emacs exited without asking. Will everything I typed be gone forever?

I saw some way to make scratch persistent if we configure it, but it seems weird if Emacs actually will exit without asking and let the content be gone forever without warning.


texts: org-mode: Capture and use export header numbering?

texts:
When an outline tree of headers

* top 1
** something
** something
** something
*** something
**** something
***** something
****** something

is exported, say, to html, org-mode produces a numerical outline as deep as the options are set

1. top
1.1. something
1.2. something
1.3. something
1.3.1. something
1.3.1.1. something
1.3.1.1.1. something
1.3.1.1.1.1. something

Now, is there any way to actually capture that outline numeration for use in the original buffer? I'm thinking I would like to make a sort of tags or custom_id  system based on these numbers.

* top :1:
** something :1.1:
** something :1.2:
** something :1.3:
*** something :1.3.1:
**** something :1.3.1.1:
***** something :1.3.1.1.1:
****** something :1.3.1.1.1.1:

It would also be nice if org-mode simply used these numbers in the original buffer instead of stars.


texts: is there a canonical way of representing key combinations in elisp? what is it?

texts:
I've seen many different ways of specifying key combinations for setting or unsetting key bindings in emacs.  Some are quoted, others are bracketed, some are escaped, others are not.  Do they all work in all contexts?  Is there a best practice?

Some examples from my init file which may or may not work:

(define-key org-mode-map (kbd "<M-S-right>") nil)
(define-key evil-normal-state-map (kbd "C-k") (foo))
(define-key global-map (kbd "RET") 'newline-and-indent)
(global-set-key [(C-f4)] 'bury-buffer)
(global-set-key [(f6)] 'emms-playlist-mode-go)
(define-key c-mode-map  [(tab)] 'company-complete)
(define-key ggtags-mode-map (kbd "C-c g s") 'ggtags-find-other-symbol)
(setq helm-gtags-prefix-key "\C-cg")
(define-key evil-normal-state-map [escape] 'keyboard-quit)
(bind-key "<escape>" 'isearch-cancel isearch-mode-map)
(global-unset-key "\M-:")

Is there a canonical way to define key combinations?  If so, where can I read about it, especially for a list of special and modifier keys (tab, escape, return, meta, ctrl, shift, super, Fn, delete)?

edit: This question and the answers below go a lot deeper than the similar question asked here.


texts: why is add-hook in use-package not erroring for function that does not exist

texts:
I have added a (add-hook 'js2-mode-hook 'my-js2-mode-setup) the following hook to a use-package init section:

(use-package js2-mode
  :ensure t
  :interpreter (("node" . js2-mode))
  :mode "\\.\\(js\\|json\\)$"
  :bind (:map js2-mode-map
              ("C-c C-p" . js2-print-json-path))
  :init
  (add-hook 'js2-mode-hook 'my-js2-mode-setup)
  (add-hook 'js-mode-hook 'js2-minor-mode)
  (setq js2-highlight-level 3
        js2-mode-show-parse-errors nil
        js2-mode-show-strict-warnings nil))

I was not convinced the hook was running so I removed the my-js2-mode-set-up function and no error has occurred.

Why is this?  Should I have the init section enclosed in a progn as there is more than one statement?


texts: Send string to a fully functional REPL in Emacs on Windows?

texts:
Summary. Is there a way to get fully functional REPLs on Windows running in Emacs. I want to avoid the maintenance burden associated with comint.

Long version. In many cases I dislike how the built-in REPL-interaction of programming modes works. For instance, I may prefer to use iPython directly, rather than relying on an interaction layer handling things like completion when I press TAB.
However, I also need the ability to send code directly to the REPL.
If I were using Emacs exclusively on Linux, I'd simply use M-x ansi-term ipython3 and write my own commands for sending buffer contents. However, on Windows M-x ansi-term isn't functional; It has a hardcoded call to /bin/sh, but even replacing this with a native sh.exe (e.g. from MSYS) only results in an unresponsive buffer.
comint-mode isn't viable, because it requires either committing to a lot of work to get interactive features right, or hoping that someone has written it already, actively supports latest features of the language at hand, and hasn't omitted features I need. Mileage here varies a lot depending on the language, and I often see subtle Windows-specific breakage.
As a consequence I am looking for alternatives. Things like

getting ansi-term into working state on Windows,
sending strings to an external terminal application like mintty,
a language-agnostic repl-layer, that leaves more of the work to the repl binary than comint would.

Is there such a thing?


texts: flycheck - elpy - flake8 - ein and .ipynb files

texts:
I have set up Emacs (on Mac Catalina) with Elpy to handle Python.
I also managed to get Jupyter notebooks (.ipynb files) working with Elpy via Ein.
Both .py and .ipynb compile and use Flycheck correctly.

I have problems with .ipynb notebooks:

I find that Flycheck does not work properly because of the In [ ]:

I found flake8_nb (and not 'flake8`) works fine with them from the command line:

flake8_nb name.ipynb

My question now is:
How can I set up Emacs/elpy to use flake8 with py files and flake8_nb with .ipynb?

From what I have understood, Elpy calls flake8 through python-flake8 but I cannot find an option to make it use flake8_nb with .ipynb files.

Can you please help me?

This is my .emacs Python part:

    (use-package elpy
      :ensure t
      :init
      (elpy-enable))

    (when(require 'ein)
    (setq ein:use-auto-complete-superpack t))

    (when (require 'flycheck nil t)
      (setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
      (add-hook 'elpy-mode-hook 'flycheck-mode))

    (add-hook 'after-init-hook #'global-flycheck-mode)

    (require 'py-autopep8)
    (add-hook 'elpy-mode-hook 'py-autopep8-enable-on-save)


texts: In Magit, what are good workflows for the two remotes?

texts:
As a longtime git user, I'm familiar with the following workflow for collaborative projects:

My private repository is where I make local changes.
My public repository is where I push changes that I have made that are ready for others to pull
The project repository is where I pull centrally approved changes from.  (It's the one that is managed by gatekeepers.)

In this workflow, I set the "remote" to the project repository, and that's where I pull form.  I set the "push remote" to my public repository, and that's where I push to.

As a recently arrived and very happy Magit user, I'm trying to figure out what corresponding workflows work well with Magit.  The ability to push to two different remotes (P p and P u) has me baffled.  I'm not sure if these two correspond to the remotes that I'm used to, and I'm definitely not accustomed to push to more than one remote.

I have read the section on the two remotes in the Magit manual, but I am not enlightened.  Can anyone explain to me what are good workflows for Magit's two remotes?  Or point me to an explanation written elsewhere that you like?


texts: Unable to use Microsoft Japanese IME in Emacs under Windows

texts:
For some reason I can't seem to use the Microsoft Japanese IME in Emacs, even though I can apparently use the Microsoft Chinese IME to input Chinese without problems. Even if I've switched to the Japanese IME, only English is entered, and I cannot change the input mode to Hiragana or Katakana. The only way to input Japanese seems to be to use the built-in Japanese input method in Emacs, which is much more inconvenient. Is there anybody who successfully managed to use external Japanese input methods in Windows Emacs?

I know that under Linux you must set LC_CTYPE to a CJK language in order to input such languages in Emacs. But since I can input Chinese just fine here, I don't think that's the problem.

The Emacs version I'm using comes from https://sourceforge.net/projects/emacsbinw64/


texts: Unicode character folding with Swiper/Ivy

texts: Suppose I have bár written in a file, I would like to look for bar in swiper and find the occurrences of bár alongside the expected occurrences of bar, how I can do this? This would also apply to characters like e=é=è, o=ö, u=ü, a=å, o=ó=ö, c=ç, etc.


texts: When using Emacs with ESS, when I evaluate functions that take longer to complete (reading in larger files or executing SQL queries), the whole Emacs becomes busy (freezes, hangs, crashes - whatever you call it), and I can't continue editing, using the menu etc until the R session is finished. This seems weird to me, because the R process that is busy is (or should be) completely separate from the main Emacs process. Is there any way to simply send the long block of code to R process and watch it execute, while continuing working with Emacs?


texts:
I would like to bind j to reftex-toc-next and k to reftex-toc-previous whilst in a reftex-toc buffer. According to the documentation, the keymap active in *toc* buffers is reftex-toc-map. I'm using use-package to load reftex, so I've tried

(use-package reftex
  :ensure t
  :after (latex)
  :bind (:map reftex-toc-map
              ("j" . reftex-toc-next)
              ("k" . reftex-toc-previous))
  :config
  (add-hook 'LaTeX-mode-hook 'turn-on-reftex)
  (setq reftex-plug-into-AUCTeX t))

Which produces the following error

Error (use-package): reftex/:catch: Symbol's value as variable is void: reftex-toc-map

Any suggestions as to why this doesn't work and how I can resolve it?


texts: How can a list of fields be colored with different colors?

texts:
Here's a line from an SQL dump with randomized contents:

REPLACE INTO `drxneuleqtx` (`qd`, `mva`, `cuqtgwm`, `vatoj`, `mrfdgnaheui`, `pacc`, `aaqfjhkv`, `epue`, `kvaerg`, `xevtan`, `vmvwwgci`, `hhgvedhjv`, `omndbwf`, `butbjsjrey`, `nwyxtnox`, `aslfh`, `wvtkpyn`, `ywidifrf`, `uxvjfpamlhoa`, `qfmlpisc`, `hlpgj`, `hioplo`, `gebqth`, `bovhklyrphx`, `dijqxqxodwr`, `rdqynsve`, `loxcqfybkdm`, `sakpxfsyqkwi`, `pfypefxwfp`, `exuqiufco`, `kdprjngn`, `bnjfdcws`, `vumrbkeh`, `avgamdde`, `ceewufkv`, `xtvikcuw`, `jeswerey`, `ygqhghq`, `svygrhkw`)
VALUES (506,'xyjnm','rsrongvucegfcbnpqplcdbfef','kcgottkurypcathxiqte','tctwpmfwkhqojyatkrfbmwvsd',3094,NULL,56806,149,NULL,18.258930,10.362209,0,9,NULL,NULL,NULL,0,0,0,NULL,488,-422,0,0,NULL,NULL,NULL,0,NULL,'lbwyshaxdtpmvbkggwreaaqd','xiyunrgjvgxgwvmyhuuunjfr','wbkyuwaykgostnowratnjmov','mjxgjnbvadhckdmonouhkwgm','wefcoaehlbinlhejgjstfwtk','fnodw','chotb',NULL,'oqidxyqfhtksxbvmstiqlsgayntgveyymrdpbybdstdehhmyircimpexwoqaimrveuwtbvbxcqebgcpfandjpnoevsdkboqyrdxhjylfrrqakcfkwdhiovlensossbttufhvmyxugixmkcgwpvjddcgpdwmytmuhju');

As you can see the first line lists the field names and the VALUES line lists the values for the relevant fields, but I only used two lines here for easier explanation, in the dump file the two lines above are on a single line.

For easier reading of the dump I'd like it to be automatically colored when the dump file is opened, so that each field name has a different background color and each value has a different background color, but the value and the corresponding field has the same background color.

Note that the number of fields/values can change, depending on the database dump, so it's not fixed. Also, the string values are delimited with single quotes, but the strings can contain single quotes, in which case they are escaped with a backslash: 'stu\'ff'

What is the simplest way to implement this?


texts: Smartparens slurping across fluent call chains in php-mode

texts:
I have not been able to find a solution to this frustrating problem. Here is the situation and my questions are at the end:

Given code that looks similar to this:

$this->hello()->wootFluent()->patterns();

I want to wrap the whole chain in parens, this could be just parens or maybe another function call. So I start with my cursor, |, at the front:

|$this->hello()->wootFluent()->patterns();

I insert-parentheses with M-(

()|$this->hello()->wootFluent()->patterns();

Then I sp-slurp-hybrid-sexp with C-S-right after moving the cursor within the parens:

($this)->hello()->wootFluent()->patterns();

One more time:

($thishello())->->wootFluent()->patterns();

And now my chain is illegal; fubar.

Is there a way to configure smartparens to include the -> in its slurping? Am I using the right smartparens command for slurping? I would like to make successive slurp commands so that I will end up with a structure like this:

($this->hello()->wootFluent()->patterns());


texts: Overlapping problem with company suggestions in doom-emacs

texts:
I'm having an overlapping problem of suggestions with my company configuration for org-roam in doom-emacs
This is the piece of code for my backends in config.el
(set-company-backend!
  '(org-mode
    poly-org-mode)
   '(:separate
      company-capf
      company-dabbrev
      company-math-symbols-latex
      company-yasnippet
      company-ispell
      company-files))

And I got this every time that I type something

How do I could separate the suggestions in different parts of the popup?
Thanks for the help


texts: Why can't I view my monthly or yearly org agenda?

texts:
Issuing M-x org-agenda-month-vew and M-x org-agenda-year-view yields

Wrong type argument: number-or-marker-p, nil

Why am I getting this error?

Issuing M-x toggle-debug-on-error before the command yields

  calendar-gregorian-from-absolute(nil)
  org-agenda-compute-starting-span(nil month nil)
  org-agenda-change-time-span(month nil)
  org-agenda-month-view(nil)
  call-interactively(org-agenda-month-view record nil)
  command-execute(org-agenda-month-view record)
  execute-extended-command(nil "org-agenda-month-view")
  call-interactively(execute-extended-command nil nil)


texts: How do I list the branches of a repository in Magit (i.e., the equivalent of git branch --list)? I expected to find this in the branch popup, but it seems to be neither there nor was I able to find it anywhere in the "Inspecting" section of the User's manual. What am I missing?


texts: How do I define a new color in a user's .emacs file?

texts: I have a customization requirement (for branding purposes) to define custom colors for several backgrounds. This needs to use new color names rather than hard-wired #hex so that it can go in a shared .emacs. I don't seem to be able to find the command that will (for example) set foobar to be #314159


texts: In org mode, how can I make a post-capture hook run only for certain capture templates?

texts:
I have several capture templates. With one of them, I want an Elisp function to transform the contents before saving it. I know of org-capture-prepare-finalize-hook, but this will run for every template. Is there a way to ensure a hook runs only for a given capture template?

In case people are interested, the transformation I want to do is this:

The capture template will have a long list of checkbox items (all unchecked). I want to check one or two of these every time I use that template. Then I want to store only the items that were checked - so my function would delete all unchecked items (declutter).


texts:
CentOS Linux release 7.9.2009 (Core)
To install Emacs on CentOS I use this:
sudo yum install epel-release
sudo yum install emacs

Nice. But the problem is that... it install old version of Emacs = 24.3
But I need Emacs 26 to install on CentOS
Is it possible?


texts: Yasnippet conditional template depending on field value

texts:
I'm having an issue where I would like to be able to create a template which will conditionally insert a string into the template based on the value of one of the fields.
This means I want some sort of embedded elisp (or elisp function call) to evaluate if one of my fields has the value 0. If it does not then I want to include a function definition in the snippet. If the field is 0 then there is no reason to include this function definition.
This is what I have so far but it seems to matter what the string is included and the concatenation fails.
$>registerFn(id, &$1FieldEnd, $1FieldOtherEnd,
$>                ${5:$1Handler}, 0);
`(if (string= (yas-field-value 5) "0")
        (
        " ")
        (
concat (concat "\nstatic void " (concat (yas-field-value 5) "(void *argPtr)"))
"\n
{
/* handlerImplementation */
}
")
)`


texts: org-reveal - 3 block layout not as expected

texts:
I would like to create 3 block with org-reveal as below:
|--------|---------- |
|        |           |
|        |           |
|        |-----------|
|        |           |
|        |           |
|--------------------|

I try to use flex box do it as below:
* blocks
#+REVEAL_HTML:

- left line 1
- left line 2
#+REVEAL_HTML:

#+REVEAL_HTML:

#+REVEAL_HTML:

- right top line 1
- right top line 2
#+REVEAL_HTML:

#+REVEAL_HTML:

- right top line 1
- right top line 2
#+REVEAL_HTML:

#+REVEAL_HTML:

Output looks like not as expected.


texts: How to make two fixes to mouse click positioning work together?

texts:
There are subtle issues with mouse-click cursor positioning which I try to get fixed.
The first patch makes sure that the cursor falls on the correct side of a character when clicked left of right from its center.
The second patch makes sure that when we click left or right of text, the cursor ends up at the beginning or end of the text.
Separately, they work fine. When combined, they lead to an erratic jump-back of the cursor after it had been already placed.
Here is a reproducer:

run the combined code below
open some text buffer and click into the text in different places
observe where exactly the cursor bar ends up with relation to the positon of the mouse click

At some positions, the cursor bar is briefly visible in the correct position, and then jumps back one step. This is the position it would have ended up with out the fix in posn-set-point
The question is how to make the cursor end up in the right position always.
Here is the combined code:

(setq-default cursor-type 'bar)

(defun posn-set-point (position)
  "Move point to POSITION.
Select the corresponding window as well."
  (if (not (windowp (posn-window position)))
      (error "Position not in text area of window"))
  (select-window (posn-window position))
 (let ((pos (posn-point position)))
    (if (numberp pos)
        (goto-char (if (and (eq 'bar (or (car-safe cursor-type) cursor-type))
                            (< pos (point-max))
                            (consp position)
                            (numberp (car-safe (posn-object-x-y position)))
                            (numberp (car-safe (posn-object-width-height position)))
                            (> (* 2 (car (posn-object-x-y position)))
                               (car (posn-object-width-height position))))
                       (1+ pos)
                     pos)))))

(defun mouse-goto-bol (click)
  "Move to beginning of line for mouse-1 click in left fringe."
  (interactive "e")
  (mouse-goto-line click 'left))
(defun mouse-goto-eol (click)
  "Move to beginning of line for mouse-1 click in left fringe."
  (interactive "e")
  (mouse-goto-line click 'right))
(defun mouse-goto-line (click left/right)
  "Helper for `mouse-goto-(bol|eol)'."
  (let* ((posn      (event-start click))
         (click-pt  (posn-point posn))
         (window    (posn-window posn))
         (buf       (window-buffer window))
         (clicks    (if (eq mouse-selection-click-count-buffer buf)
                        (event-click-count click)
                      0)))
    (when (= clicks 1)                  ; No-op if not single-click.
      (with-current-buffer buf
        (goto-char click-pt)
        (if (eq 'left left/right)
            (line-beginning-position)
          (line-end-position))))))

(global-set-key [left-fringe mouse-1]  'mouse-goto-bol)
;;(global-set-key [right-fringe mouse-1] 'mouse-goto-eol)
(global-set-key (kbd "<mouse-1>") 'mouse-goto-eol)

The solutions are from:

Mouse pointer between characters and the text cursor misplacement

How to use mouse click to the right or to the left of the text to move cursor to this line?


texts:
I have the following in my init.el file:

(setq org-agenda-span 36)
(setq org-agenda-start-on-weekday 1)
(setq european-calendar-style t)

However, diary blocks are still interpreted as month first, then day, then year:

*** Urlaub!
   <%%(diary-block 02 11 2018 10 11 2018)>

is interpreted as "February, 11th, 2018 - October, 11th, 2018".

My Emacs version is: GNU Emacs 25.2.2 (x86_64-pc-linux-gnu, GTK+ Version 3.22.21) of 2017-09-22, modified by Debian

My Org-Mode version is: Org-mode version 8.2.10 (release_8.2.10 @ /usr/share/emacs/25.2/lisp/org/)

I remember, that I had it working correctly before. Maybe the issue arose when I updated to Emacs 25.


texts: Why doesn't this `declare-function` form suppress 'Warning: the function is not known to be defined.'?

texts:
Here's my declare-function form in file A:

(declare-function 'my-function "file-B" (my-func-arg &optional args))

and here's the definition of my-function in file B:

;;;###autoload
(defun my-function (my-func-arg &optional args)
   ...)

During compilation, I receive the following warning:

file-A.el:1223:1:Warning: the function ‘my-function’ is not
    known to be defined.

It was my understanding that when the byte compiler sees the declare-function form, it assumes from there on that my-function is defined.  Running M-x check-declare-file on file-A succeeds, so what's gone wrong?


texts:
When I use multiple monitors, the bottom line of the minibuffer doesn't render; ie there's a line at the bottom of the list that I can select but doesn't render on screen.
I'm pretty stumped on how to figure out what could be breaking, but I suspect it might be ivy-related. My window manager is i3, but I'm doubtful that matters.
What should I check to debug this?


texts:
I'm running emacs24-nox on Ubuntu trusty on Windows Linux Subsystem, and I'm trying to figure out why the startup time is slow. I've inspected the startup with strace and found two calls to poll that are apparently timing out after 2 seconds each. Any ideas what's going on here? Details below.

Step 1: In which I demonstrate my environment

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.2 LTS
Release:        16.04
Codename:       xenial

$ uname -a
Linux MACHINE 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014 x86_64 x86_64 x86_64 GNU/Linux

$ emacs --version
GNU Emacs 24.5.1
Copyright (C) 2015 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

Step 2 In which I demonstrate that I have nothing up my sleeves and perform the trick

$ rm -rf ~/.emacs ~/.emacs.d
$ strace -r emacs -Q --eval '(kill-emacs)' 2>emacs.trace

Step 3 In which I find the top 10 slowest steps and puzzle at the slow polls

$ sort -n emacs.trace | tail
     0.002705 write(5, "\33[52d\33[?25lFor information about"..., 101) = 101
     0.003640 open("/etc/emacs24/subdirs.el", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
     0.004009 rt_sigprocmask(SIG_BLOCK, [WINCH IO], NULL, 8) = 0
     0.004640 faccessat(AT_FDCWD, "/usr/local/sbin/ssh", X_OK) = -1 ENOENT (No such file or directory)
     0.005136 brk(NULL)                 = 0x2d75000
     0.005468 clock_gettime(CLOCK_REALTIME, {1506025490, 364029200}) = 0
     0.008012 write(5, "\33[?1l\33>\33[?12l\33[?25h\33[?1049l\33[39;"..., 36) = 36
     0.019146 fstat(6, {st_mode=S_IFREG|0644, st_size=1196, ...}) = 0
     1.990251 poll([{fd=6, events=POLLIN}], 1, 0) = 0 (Timeout)
     1.995195 poll([{fd=6, events=POLLIN}], 1, 0) = 0 (Timeout)


texts: How to change syntax highlight inside #if 0?

texts:
In cc-mode, I want a way set all syntax highlight colours to slightly more desaturated versions when inside a #if 0 ... #endif block.
If that would be troublesome/hard to maintain (having to set all the colours manually), just setting all the text inside the block to a single colour would be fine too.
I've tried this, but is intended for use with a single keyword.
I'm using spacemacs 0.300.0@26.3


texts: Why does the Emacs ansi-term and Emacs shell PS1 prompt not match my system PS1?

texts:
I'm running Mac OS 10.10.3; Emacs is complied and installed via Homebrew; I run it as a GUI application and it reports

This is GNU Emacs 24.4.1 (x86_64-apple-darwin14.1.0, NS apple-appkit-1344.72)
 of 2015-03-23 on boomer

Inside of Emacs shell or Emacs ansi-term, my prompt looks like this:

bash-4.3$ echo $PS1
\s-\v\$

But inside of Terminal.app, my prompt looks like this:

boomer:~ dgrady$ echo $PS1
\h:\W \u\$

The value of PS1 that Terminal.app sees comes from the system-wide /etc/bashrc file, which reads

# System-wide .bashrc file for interactive bash(1) shells.
if [ -z "$PS1" ]; then
   return
fi

PS1='\h:\W \u\$ '
# Make bash check its window size after a process completes
shopt -s checkwinsize
# Tell the terminal about the working directory at each prompt.
if [ "$TERM_PROGRAM" == "Apple_Terminal" ] && [ -z "$INSIDE_EMACS" ]; then
    update_terminal_cwd() {
        # Identify the directory using a "file:" scheme URL,
        # including the host name to disambiguate local vs.
        # remote connections. Percent-escape spaces.
        local SEARCH=' '
        local REPLACE='%20'
        local PWD_URL="file://$HOSTNAME${PWD//$SEARCH/$REPLACE}"
        printf '\e]7;%s\a' "$PWD_URL"
    }
    PROMPT_COMMAND="update_terminal_cwd; $PROMPT_COMMAND"
fi

Why do Bash shells I start from within Emacs not see the same value of PS1?


texts: Why does using emacsclient from a remote host connect to the right socket, but I see nothing in my local Emacs?

texts:
I'm running a TCP server locally, and I'm trying to open a file from a remote host on my local Emacs through emacsclient. The reason for this is that I have emacspeak running locally which gives me speech, and I want to use this for commands that use the $EDITOR variable, like editing crontab, or kubectl edit and so on.

This question already exists on StackOverflow and has an answer, but at the time the question was asked, this feature was not yet introduced. This feature is introduced in Emacs 26.0.50, according to the relevant issue.

So, here is what I've set:

server-auth-key is set to a key I generated with server-generate-key
server-host is set to my local computer's hostname
server-port is set to 1990
server-use-tcp is set to t

I copied and pasted the local ~/.emacs.d/server/server into the remote host's ~/.emacs.d/server/server, and then ran the following command:

$ emacsclient -f server test

This gave me the following output:

emacsclient: connected to remote socket at 10.156.54.246

And then nothing. Nothing pops up on my local Emacs.

Running the same command locally works.

I investigated further and doing a telnet to the host mentioned in the output of emacsclient on port 1990 doesn't work either.

It looks like I'm not setting the value of server-host correctly. I've set it to my hostname, but that doesn't seem to be working.

How should I set my server-host? What should I set it to?


texts:
From what I understand, I should be able to get mouse scrolling to work in emacs nox mode with the following:

(require 'mouse)
(xterm-mouse-mode t)
(mouse-wheel-mode t)

(global-set-key (kbd "<wheel-up>") '(lambda () (interactive) (scroll-up 1)))
(global-set-key (kbd "<wheel-down>") '(lambda () (interactive) (scroll-down 1)))

But for some reason I'm not getting the  or  signals. Instead I get this from C-h k:

Wheel up:

mintty - ESC [ M ` X 1-
xterm  - ESC [ M ` ] &-

Wheel down:

mintty - ESC [ M a r --
xterm  - ESC [ M a J /-

If I scroll down more than once I get this:

down-mouse-66-

I'm providing examples between mintty and xterm to show that it does not appear to be limited by the terminal. It might be a Cygwin problem but I'm not sure. I AM getting escape sequences but I'm not sure how to map them. They are.. very strange.

Normally I'd used Ctrl-v in bash for something like this but obviously it just scrolls the window.

My cursor IS moving when I use the scroll wheel with these settings so it is being detected in some form but it's doing strange things I can't quite describe, like moving up several lines then jumping down again, but this may change with the context. Might there be a problem with mouse.el?

I'm not sure what to do with this.


texts: Are there license restrictions for Emacs Lisp packages?

texts:
GNU Emacs is licensed under the GNU General Public License (GPL). The GPL is a copyleft license that requires any derivative work to also be GPL-licensed. Does that impose restrictions on what license can be chosen for third-party Emacs packages such as those found in MELPA and several other repositories around the internet?

I believe the answer to this question depends on the interpretation of the legal term derivative work: if a third-party package is a derivative work of GNU Emacs then the package must be GPL, else it can use another license. (Similar concerns have historically arisen with dynamically linked libraries.) I didn't find any clearly stated opinion on this matter on EmacsWiki, the Emacs Lisp reference manual or the GNU website.

In practice, we have third-party packages bearing e.g. the MIT license notice, but I wonder whether that license notice has legal clout and the real license ought to be GPL anyway.


texts: How get python major version without any additional package?

texts: I need a function that return major version of "current" python interpreter. Possible choices are 2 or 3. How can I get it? Please, help me with this func.


texts: How to jump to a page in `DocView` mode when a pdf contains a roman numeral numbered introduction?

texts:
Lets say that I am viewing a pdf in emacs which contains a section numbered with roman numerals. How would I jump to page xxii in that section without doing mental math about what that page's number is according to emacs?

Similarly, page 71 in that document might be considered page number 105 by emacs due to the fact that page 1 of the document is actually the 35th page of the pdf, since the first 35 pages were a roman numeral numbered introduction.

I am fine with using a mode other than DocView as well.


texts: Use literal greek characters in LaTeX fragments in org-mode

texts:
I already have a few bindings like M-g b maps to β for all the greek letters and like being able to write things like $$ ξ $$ instead of $$ \xi $$ because it's easier to read when I'm not rendering LaTeX fragments (which is most of the time).

I get blank rectangles for $$ ξ $$.

I tried switching the pdf process over to XeLaTeX so that I can include literal Greek characters in LaTeX fragments, but it still only renders blank rectangles.

(setf org-latex-pdf-process "xelatex -interaction nonstopmode %b")

Is it possible to include literal greek characters in *TeX fragments?

If not, is it possible to register a hook so that I can take Greek characters occurring inside a $$ ... $$ and replace them with the corresponding \... sequence before being handed off to the TeX process?


texts: Syntax highlighting in source blocks in org-mode

texts: I have an example of AWK code that I want to export to HTML, both the code and the result of the code. Since AWK codes are usually run in shell with awk 'some awk code' file I use the shell block. The awk block dosn't run the code, it throws a syntax error, presumably it's meant for pure AWK codes?! Not sure. In any case, the shell block colours everything inside quotes as a string in orangish colour. Is there a way to simply switch off the syntax highlighting? Or make the shell block use AWK highlighting? Or make AWK block run commands like awk 'code' file?


texts: Emacs Lisp, programatically narrow down key bindings

texts:
Solved! helm-descbinds solved the problem.

https://github.com/emacs-helm/helm-descbinds

Thank you for your help.

I was trying to work out if I could build a simple script to narrow down key bindings, somewhat similar to IDO. I know of Icicle, but for some reason I didn't like it.

During my search I ran into many problems and beging to think that the only way out is to run:

(describe-bindings)

and then try to parse Help buffer.

Is there a way to get pre-parsed flat list of biding? I got lost trying to understand the keymap structure.

I guess recursively parsing the keymap structure is too much work. Is there a simple solution?

This is example of my early progress.

https://github.com/bigos/Pyrulis/blob/master/Emacs/key-bindings-lister/lisp/key-bindings-lister.el

After a while of trying, looks like getting the info from Help buffer didnt work. I got some strange structures with the string and when I tried to use print, it didn't print what I wanted.  Perhaps I will have to parse the keymap?

After playing with keymap for a while, I think this is the way to go. More in my github link.

My last attempt.

;;; run in ielm like this: (my-list-bindings 11)
;;; n=11 for global
(defun my-list-bindings (n)
  "almost clean way of listing key bindings"
  (map-keymap
   (lambda (x y)
     (print "!!!!!!!!!!!!!!!!!!!!!")
     (princ x)
     (if (eq x 'menu-bar)
         (print "*** skipping menu bar ***")
       (print y)))
   (elt (current-active-maps) n )))


texts: Why does ivy 1.13.0 from GNU ELPA have counsel included?

texts:
MELPA has a package called counsel. Most guides on the ivy package recommend installing counsel as well. GNU ELPA doesn't have counsel. Why doesn't it?

I've installed ivy 0.13.0 from GNU ELPA. I don't have counsel listed among installed packages and I don't have a directory called counsel in ~/.emacs.d/elpa. However, I have commands counsel-mode, counsel-find-file, and other commands which start with counsel-, and they work. Why do I have them?

Why does MELPA have a separate package called counsel?

Edit: Comparing the ivy package from GNU ELPA and MELPA:

Filenames in common:

colir.el
dir
ivy-autoloads.el
ivy-overlay.el
ivy-pkg.el
ivy.el
ivy.info

Only in GNU ELPA ivy-0.13.0:

ChangeLog
counsel.el
ivy-hydra.el
swiper.el

Only in MELPA ivy-20200601.1105:

elpa.el
ivy-avy.el
ivy-faces.el
ivy-help.org


texts: Can I make emacs recognize double-quoted strings in sql-mode?

texts: I am looking for a way to make sql-mode highlight double-quoted strings in the same way as single-quoted strings.  Setting the product to MySQL (which is the correct product for me) did not achieve this result.


texts: How to Export All Daily Task State Changes to File?

texts:
I am trying to generate nice end-of-day reports in the file diary.org for logging and archiving purposes. I would like to generate a simple list of all TODO task state changes for the current day to be saved to diary.org, but I'm not sure how to get this data there automatically.

I am using org-log-done (see: https://www.gnu.org/software/emacs/manual/html_node/org/Closing-items.html), since I thought it'd help to have timestamps to search for the right data, and I also experimented with org-agenda-log-mode (see: https://orgmode.org/manual/Agenda-commands.html), but was unable to figure out how to export this data (and I would prefer simply exporting the time stamps and headings using org-log-done info anyway, as I already generate a daily clocktable and org-agenda-log-mode will then provide redundant information in a format I like less).

Lastly, I thought this link would help more, but I couldn't extract or assemble any specifically useful info for my case from it: https://orgmode.org/manual/Tracking-TODO-state-changes.html

Thank you in advance for any help.

EDIT:
In the mean time, I've developed a temporary work around by simply clocking in and out quickly whenever I change a task state, so that this information can be pulled by org-clock-report. A more elegant solution would probably involve using org-ql (see: https://github.com/alphapapa/org-ql), but I've heard that persistently using logbooks or archiving "DONE" tasks might also achieve what I seek. For now, I like this solution.


texts: Why does defvar scoping work differently without an initvalue?

texts:
Suppose I have a file named elisp-defvar-test.el containing:

;;; elisp-defvar-test.el ---  -*- lexical-binding: t -*-

(defvar my-dynamic-var)

(defun f1 (x)
  "Should return X."
  (let ((my-dynamic-var x))
    (f2)))

(defun f2 ()
  "Returns the current value of `my-dynamic-var'."
  my-dynamic-var)

(provide 'elisp-dynamic-test)

;;; elisp-defvar-test.el ends here

I load this file and then go into the scratch buffer and run:

(setq lexical-binding t)
(f1 5)
(let ((my-dynamic-var 5))
  (f2))

(f1 5) returns 5 as expected, indicating that the body of f1 is treating my-dynamic-var as a dynamically scoped variable, as expected. However, the last form gives a void-variable error for my-dynamic-var, indicating that it is using lexical scoping for this variable. This seems at odds with the documentation for defvar, which says:

  The defvar form also declares the variable as "special", so that it is always dynamically bound even if lexical-binding is t.

If I change the defvar form in the test file to supply an initial value, then the variable is always treated as dynamic, like the documentation says. Can anyone explain why the scoping of a variable is determined by whether or not defvar was supplied with an initial value when declaring that variable?

Here is the error backtrace, in case it matters:

Debugger entered--Lisp error: (void-variable my-dynamic-var)
  f2()
  (let ((my-dynamic-var 5)) (f2))
  (progn (let ((my-dynamic-var 5)) (f2)))
  eval((progn (let ((my-dynamic-var 5)) (f2))) t)
  elisp--eval-last-sexp(t)
  eval-last-sexp(t)
  eval-print-last-sexp(nil)
  funcall-interactively(eval-print-last-sexp nil)
  call-interactively(eval-print-last-sexp nil nil)
  command-execute(eval-print-last-sexp)


texts: Is there a way to change color of active window's fringe?

texts: To better distinguish between focused window and rest that are not I would love to change this window's fringe color. Discovering customize with fringe keyword I found only how to change its bg color without ability to set different colors for active and not active ones. Is it possible at all? Thx.


texts: How best to define nullable integer customizable variables?

texts:
I would like to define a variable using defcustom so that it can be customized by users of an emacs package.  The variable is an integer (let's call it spam-override), and its function is to override the value of another integer variable (spam).  0 is an allowed value of both spam and spam-override.  If spam-override is set to 0, that means "override with the value 0" rather than "do not override".  It seems natural to allow spam-override nil to indicate that the override is disabled.

I suspect that using nil in this way isn't how defcustom is best used for variables of this kind.

What's the best way to achieve this functionality?  For example, is it usually best to use a composite defcustom type by using the choice constructor, or to define an extra boolean variable, maybe named override-spam to indicate whether integer variable spam-override should be used?


texts: Executing remote commands with TRAMP with a single SSH connection

texts:
I'm able to use TRAMP fine for reading/writing files on a remote server. I only have to login to the server the first time I open a file, and from then on I can open files without being prompted to login again.

However, when I run commands through TRAMP, I have to login every time. For example, if I run M-x grep ENTER grep -nH -r foo ENTER, I need to login every time I run that grep command. I've tried increasing the TRAMP log level and even debugging through the TRAMP code, but I haven't been able to figure out why it can't reuse the same SSH connection to run commands.

This is on OS X. Running M-x version shows GNU Emacs 24.5.1 (x86_64-apple-darwin14.5.0, NS apple-appkit-1348.17) of 2015-08-24. Note that I cannot simply make the login process easier by using keys or caching my password, because the server I'm connecting to uses 2fac auth.


texts: Client certificate for access to imap server in gnus

texts:
We're in the process of changing mail servers. The new one will require a client certificate from our internal CA for all connections. How can I make gnus use a client certificate in the connection? I can't find any option for that in the nnimap documentation.

I tried setting it up like this:

(setq gnus-secondary-select-methods '(
                  (nnimap "imap"
                      (nnimap-address "imap.example.com")
                      (nnimap-server-port 993)
                      (nnimap-stream ssl)
                      (nnimap-inbox "INBOX")
                      (nnimap-split-methods default)
                      )
                  ))

and with the authinfo entry

machine imap.example.com  port imaps key "~/.privat/certs/jenny.key" cert "~/.privat/certs/jenny.pem"

When I try to connect, I get the following errors in emacs:

Opening nnimap server on imap...
Opening connection to imap.example.com via tls...
auth-source-search: found 1 backends matching (:max 1 :host ("imap.example.com" "imap") :port (993 "imaps" "imap" "993" "143") :user nil :require (:user :secret) :create t)
auth-source-search: found 0 results (max 1) matching (:max 1 :host ("imap.example.com" "imap") :port (993 "imaps" "imap" "993" "143") :user nil :require (:user :secret) :create t)
auth-source-search: found 1 backends matching (:max 1 :host ("imap.example.com" "imap") :port (993 "imaps" "imap" "993" "143"))
auth-source-search: found 0 results (max 1) matching (:max 1 :host ("imap.example.com" "imap") :port (993 "imaps" "imap" "993" "143"))
auth-source-search-backend: got 1 (max 1) in netrc:~/.authnfo-test matching (:max 1 :host ("imap.example.com" "imap") :port (993 "imaps" "imap" "993" "143") :user nil :require (:user :secret) :create t)
auth-source-search: CREATED 1 results (max 1) matching (:max 1 :host ("imap.example.com" "imap") :port (993 "imaps" "imap" "993" "143") :user nil :require (:user :secret) :create t)
Opening nnimap server on imap...failed: NO (ALERT) Client didn't present valid SSL certificate

The mailserver also says no certificate was presented:

Dec 12 11:10:22 imap dovecot: imap-login: Disconnected (client didn't send a cert):


texts:
I tried to bind a key using a prefix-key of C-z, but Emacs told me: Key sequence C-z c starts with non-prefix key C-z. I guess this means that C-z is already bound to something.

So I tried to do M-x describe-key RET C-z, but when I do that it doesn't describe that key, it just waits for the next key press (by adding a hyphen after C-z).

How can I tell describe-key that I just want to know what C-z is?


texts: Is there a way to set a list of display tab stops?

texts:
I have a tab-delimited data file I maintain in emacs.  Much of the data has more than seven characters per field, so at the top, I have the following line:

-*- tab-width: 30 -*-

This keeps things nicely aligned; unfortunately it wastes a lot of space because most of the fields are not that long.

I'd like to specify tab stop positions for the individual fields.  I tried setting tab-stop-list, but that affects what emacs does when I press the tab key (which I never do when editing this file); I want only to change the column number to which emacs moves when displaying tabs.


texts: "#+STARTUP: hideblocks" won't work. Can't find offending package/setting

texts:
After I upgraded to Org Mode 9.4.5, I learned about the startup option hideblocks, but it won't work as advertised for me.
OK, when I start emacs with the flag -Q, it did, so I went hunting for culprits in my .emacs. All suspicious-looking settings and packages have been removed, but hideblocks still doesn't work.
Oddly enough, when I visit a test file  with #+STARTUP: hideblocks, the variable org-hide-block-startup do indeed change from nil, which is default, to t. Despite this, the block remains unfolded!
I can make all blocks fold on start-up, if I set org-hide-block-startup with a local variables section at the end of the file, but I consider that to be an ugly, last resort solution.
Is there a smart way of tracking down when and where the hideblock setting is reversed, intercepted, toggled, or whatever happens?

Addendum April 4:
Since writing the above, I stumbled upon one additional interesting symptom. When I was led astray with the theory that my Org Mode installation was somehow faulty, I took a look at the installation instructions in the info documentation. Among other things, it says the following about an org mode installation with elpa:

Important: You need to do this in a session where no ‘.org’ file
has been visited, i.e., where no Org built-in function have been
loaded.  Otherwise autoload Org functions will mess up the
installation.

So I did M-x list-packages, threw out org mode, restarted Emacs, installed org mode anew, and visited my test file.
Lo and behold, my block was folded at start-up.
However, the effect was short-lasting, and trying to open the same file later did not work as expected.


texts: frame title as buffer file resets to default after some time

texts:
In my ~/.emacs I have the following:

(setq frame-title-format
  '("" invocation-name ": "
       (:eval (if (buffer-file-name)
                  (abbreviate-file-name (buffer-file-name))
                "%b"))))

which sets the frametitle as file currently opened in the buffer.
So if ~/.emacs is opened then the title looks as follows:

emacs:~/.emacs

However after some time the title defaults to usual

emacs@hostname

How to go about fixing this?


texts: How can I pin the *compilation* buffer to never leave a single frame/window

texts: I would prefer to have the *compilation* buffer always stay in its own frame. However, currently if I run M-x compile from another frame/window, the buffer pops up in a new window there as well. How can I cause emacs to instead only raise the existing frame which is displaying the *compilation* buffer?


texts: How do I toggle between current frame size and maximized frame

texts:
When I open emacs, the frame size is set to: width 85 and height 40.

Is there a keybinding to toggle between maximizing the frame, and going back to the previous frame size of 85 x 40


texts: How to apply mapcar to a function with multiple arguments

texts:
I have packages variables that have list of github users and package names.

(defvar packages '('("auto-complete" . "auto-complete")
                   ("defunkt" . "markdown-mode")))

I want to git clone if the file is not exist yet.

(defun git-clone (author name)
  (let* ((repo-url (concat "git@github.com:" author "/" name ".git")))
    (print repo-url)
    (unless (file-exists-p (concat "~/.emacs.d/git/" name))
      (shell-command (concat "git clone " repo-url " ~/.emacs.d/git/" name)))))

And I want to apply git-clone to all packages variable to packages list. But I could not figure out how to apply with arguments.

; This obviously doesn't work
(mapcar `git-clone `packages)


texts: Shallowly override functions within a target function

texts:
I'm exploring options for monkey-patching and I'm wondering if the following is within reason.

I would like to override a particular function within some target function so that calls within the target function are overridden, but functions called directly by the target function are unaffected.
 Whether the overridden function inherits the override isn't particularly important.

(require 'noflet)

(defun my-message (msg)
  (message (concat "**" msg "**")))

(defun unaffected-fn ()
  (my-message "Goodbye!"))

(defun target-fn ()
  (my-message "Hello!")
  (unaffected-fn))

(noflet ((my-message (msg) (message (concat "@@" msg "@@"))))
  (target-fn))

The output of this code is:

@@Hello!@@
@@Goodbye!@@

I would like to avoid unaffected-fn inheriting this local override.  The output for the desired behavior would be:

@@Hello!@@
**Goodbye!**

Suggestions for clearer wording of this question are welcome.


texts: How to automate installation of packages with .emacs file?

texts: My ~/.emacs (which you can find on GitHub) file loads several different Emacs packages and I would like them to be automatically installed as soon as Emacs starts up, if they are not already installed. This way if I have to reinstall my Ubuntu 16.04 operating system again I will not have to install each package myself manually using M-x package-install. Is there a way to write an ~/.emacs file so that it will automatically install all loaded packages on startup? I would like this to be done with the minimum of lines as I have over ten different packages loaded so if I have to add extra lines for each individual package it will make my ~/.emacs rather long.


texts:
I am trying to run logo programs (ucblogo version 5.5) on my emacs in Debian Linux (26.1). There is a currently a mode for it ( https://www.emacswiki.org/emacs/LogoMode ). I followed the instructions on the wiki page and configured my init.el file such as:

(add-to-list 'load-path "~/.emacs.d/logo")
(autoload 'logo-mode "logo")
(setq auto-mode-alist (append '(("\\.lgo?$" . logo-mode)) auto-mode-alist))
(setq logo-binary-name "/usr/bin/logo")
(setq logo-tutorial-path "~/.emacs.d/logo/")
(setq logo-help-path "~/.emacs.d/logo/helpfiles/")
(setq logo-info-file "~/.emacs.d/logo/docs/ucblogo.info")

I was able to see menu items for ucblogo on Emacs but when I click on the item "Run Logo Other Frame", it is not running logo interpreter and I get an error:

comint-mode: Symbol’s function definition is void: make-local-hook

I tried with different version of ucblogo (6.0). The logo interpreter starts but  my emacs freezes and I am not able to edit my logo buffer.


texts:
In my shell (Bash), I can switch among several LaTeX distros setting the $PATH variable. E.g.:
export PATH=/usr/local/texlive/2016/bin/x86_64-linux:$PATH

or
export PATH=/usr/local/texlive/2018/bin/x86_64-linux:$PATH

This doesn't affect the LaTeX distro used by emacs when I call the function tex-file.
Is there a way to set the $PATH variable used by emacs once it is running.
I need it to test the .pdf file layout generated by different LaTeX distros while working on a document.


texts:
I am a beginner. Like a complete and total noob.
I want to get this cozy fireplace thing for fun on emacs -> https://github.com/johanvts/emacs-fireplace
How do I install it? I do not understand the melpa method, but I tried the manual install... here is how far I got...
I used my Mac's terminal to transfer the fireplace.el to ~/.emacs.d/fireplace but stopped there because I have no idea how to compile the file bc when I type byte-compile-file it says Byte compile file and when I type ~/.emacs.d/fireplace it says read error...
So i moved on and thought i would figure it out later, and instead tried to figure out how to put the code: load "~/.emacs.d/fireplace/fireplace" in the init file. BUT ALAS! I found out that GNU emacs does not come with an init file! So I had to create one... but I do not know how, or how to put code into it... please help I am very new to this community...
(using a 2019 Macbook running macOSS Big Sur 11.2.3 if that means anything, also I am using GNU emacs)


texts: How can I use ox-pandoc as a publishing backend for org files?

texts:
I would like to use org-publish to generate files for a website. I would prefer to do this using the ox-pandoc exporter rather than org-mode's own publishing exporters. But I can't quite seem to see how this is done.

The org-publish function requires a function (plist filename pub-dir) format

 (defun org-pandoc-publish-to-html (plist filename pub-dir)
 "Publish an org file to html using ox-pandoc. Return output file name."
 (org-publish-org-to 'org-pandoc-export-to-html filename ".html" plist pub-dir))

Not sure what's wrong with the above, but it doesn't work. Specifically, with :publishing-function (org-pandoc-publish-to-html) set I get the message: unknown "nil" back-end: Aborting export with no output.

Update: when I change the setting to :publishing-function (org-pandoc-export-to-html) I get a different message:

Publishing file /Users/Roambot/test/source/pubtest.org using `org-pandoc-export-to-html'
Initializing asynchronous export process
Publishing file /Users/Roambot/test/source/pubtest.org using `org-pandoc-export-to-html'
Process `org-export-process' exited abnormally

The Org Export Process buffer reads: Before first headline at position 1 in buffer  *temp*. I'm not sure what this means.

Again, publishing works fine for other export functions like org-html-publish-to-html and ox-pandoc works independently of org-publish.


texts:
Here is my openwith settings:

(require 'openwith)
(setq openwith-associations '(("\\.mov\\'" "smplayer" (file))))
(openwith-mode t)

When I press enter in dired mode on a .mov file, it still open it in a text buffer.

Any more settings required here?


texts: Creating a new text file in a directory using org-capture

texts:
Following this response: Org-Mode - How do I create a new file with org-capture https://stackoverflow.com/questions/11902620/org-mode-how-do-i-create-a-new-file-with-org-capture?
I am trying to make this piece of code work, but I get the error: invalid file location: nil.
(defun capture-report-date-file (path)
  (let ((name (read-string "Name: ")))
    (expand-file-name (format "%s-%s.txt"
                              (format-time-string "%Y-%m-%d")
                              name) path)))

(setq org-capture-templates
      '(("t"
         "todo"
         entry
         (file (capture-report-date-file  "~/path/path/name"))
         "* TODO")))


texts: How can I prevent yasnippet from breaking when I update my packages?

texts:
After packages have been updated, the location of the loaded elisp files will change to be in the folder of the new version of the package.

Yasnippet attempts to lazily load snippets for the file it was installed it, when I open a file in a major mode yasnippet hasn't seen before.

This means that loading things with previously unseen major modes once emacs has been updated fails, because yasnippet breaks the whole thing by complaining about "no such file or directory".

Is there a good general way to solve this, such as not letting updates break things? (I get a similar but less tedious problem when ag is updated). Alternatively, would advising something in yasnippet to just swallow the errors so it merely warns instead of erroring when it couldn't load packages be a better plan?

Clarification:

I start emacs, and yasnippet is loaded.
I load no files whose major mode is (for example) makefiles.
I update to a new version of yasnippet, using the package manager
I load a makefile, and yasnippet attempts to load the snippets for makefiles
but it fails, because the folder it was using for snippets no longer exists. Not only that, but practically every other command fails, because the pre-hook to them that yasnippet installed fails.
Workaround: Open the message buffer, find which folder cannot be opened and run mkdir ~/.blargh/folder-yasnippet-wants.

Clearly, one could could write some advice for some bit of yasnippet, but I'm hoping for a more global solution (and it'd take a while of playing with elisp to get the advice to work I'm sure).


texts: Why do my js2-mode hooks work on Mac but not Fedora Linux?

texts:
I am getting very inconsistent behavior with js-mode and js2-mode hooks and I am not sure why.

I have three "hooks":

(add-hook 'js2-mode-hook (lambda () (setq mode-name "Zono-mode")))
(add-hook 'js2-mode-hook (lambda () (tern-mode t)))

For some reason these do work on my Mac but do not work on my Fedora Linux system, and I am wondering if anyone can offer a reason as to why this would happen.

To further the strangeness, the very similar (add-hook 'js-mode-hook (lambda () (ac-js2-mode t))) does work on both machines.

Any advice would be much appreciated.

All of the libaries have been installed, and, when opening a file that ends in .js I do enter js2-mode (it just seems none of the hooks are run)
The only possible difference I see is on my Fedora machine Emacs is 24.5.1 and on my Mac it is Emacs 24.4.1. but I looked and this should make no difference (in fact the newer versions should help make sure hooks are run)


texts:
I am using gerrit. When I want to push my commits, I use following command:

git push origin HEAD:refs/for/master

How can I recreate the same command using Magit?


texts: Bookmarks mode with quick selection list and autodetected names from context?

texts:
I like recentf and like jump-to-register, ibuffer, ido-switch-buffer but during code investigation I need a lot of switching between already visited points.

Having short memory I like reviewing possibilities through list of available options, like that provide recentf. But that all lack support for positioning across files.

Seems that this known as bookmarking and I read (elisp)Bookmarks and try most promising http://www.emacswiki.org/emacs/BookmarkPlus

That bookmarking packages provide persistent storage and simple interface to select the bookmarks but I don't like type bookmark name.

Usually name can be easy derived from context - in RST mode - this is section title, in C/ELisp - function name, in Info - page title... For C++/Java I like to see also enclosing context - namespece and package path (through CEDET or other sources).

Are there any implementation or support from another packages (or extension point) to get automatically named bookmarks?


texts: Easy way to give the time its own face in modeline?

texts:
Is there an easy way to give the time (as displayed by M-x display-time-mode) a separate face in the modeline?

I don't need anything too fancy like powerline, I'd just like to be able to have the time in its own colour.

Cheers


texts:
While in Helm Help mode -- the help buffer that pops up when you hit C-c ? in a helm buffer -- I am unable to do anything but scroll up and down. I can not select text (neither with mouse nor with keys), or C-s search or anything!

Is this a feature or a bug? Can I change this behavior, and have, say, a regular read-only buffer, where at the minimum text selection works?

Thanks


texts: How can I get :size from font-spec using Elisp?


texts: How can I set frame title to include Babel language when point is in a block

texts:
My frame title is currently set as (setq frame-title-format '(buffer-file-name "%f" ("%b"))), or for example /path/to/file.org. I'd like to set my frame title to include the language name of the Babel block, if the point is within a block.
For example if I move the point inside a #+begin_src python block, then the frame title would be /path/to/file : python, and reset to /path/to/file when the point leaves that block.
Reason: I'm trying to use 3rd-party software (Talon voice) that has support for different vocabularies. It selects vocabularies based on the app, or the window title. I'd like to automatically load and unload Python support, for example, if I'm in a #+BEGIN_SRC jupyter-python block or not.


texts: How do I insert resizebox code in org-mode tables when exporting to latex?

texts:
I'm trying to figure out how to insert a resize command inside a table environment in org-mode that exports to latex,

Here is my minimal example of raw latex source vs org-mode tables:

#+LATEX_CLASS: article
#+LATEX_HEADER: \usepackage{graphicx}

#+begin_src latex :exports results :results latex
\begin{table}
  \caption{a table that scales to the linewidth}
  \centering
  \resizebox{\linewidth}{!}{%
  \begin{tabular}{ll}
    A & 1\\
    B & 2\\
  \end{tabular}}
  \label{tab:scaled}
\end{table}
#+end_src

How can I make org-mode tables with a \resizebox{\linewidth}{!}{% } command so that the same result is achieved for the table below? (Or alternatively something else that gives the same result).

#+LATEX_CLASS: article
#+LATEX_HEADER: \usepackage{graphicx}
#+CAPTION: a table that does not scale to the linewidth
#+LABEL: tab:uncaled
| A | 1 |
| B | 2 |

My attempt based on the LaTeX-specific-attributes from org-mode manual

#+LATEX_CLASS: article
#+LATEX_HEADER: \usepackage{graphicx}
#+CAPTION: a table that does not scale to the linewidth
#+ATTR_LATEX: :math-prefix \resizebox{\linewidth}{!}{% :math-suffix }
| A | 1 |
| B | 2 |

However the things I've tried has not worked. In the answer provided to the question on tex.stackechange another alternative is presented, which requires insertion of another environment between table and tabular.

#+LATEX_CLASS: article
#+LATEX_HEADER: \usepackage{graphicx}
#+LATEX_HEADER: \usepackage{adjustbox}
#+begin_src latex :exports results :results latex
\begin{table}
  \caption{a table that scales to the linewidth}
  \centering
  \begin{adjustbox}{width=\textwidth}
    \begin{tabular}{ll}
      A & 1\\
      B & 2\\
    \end{tabular}
  \end{adjustbox}
  \label{tab:scaled}
\end{table}
#+end_src


texts: linum referring to the top of the window

texts:
I use the "go to line" navigation a lot, but mostly of the time I have to type a three digit number in order to navigate through the document.

I would like to have a row count referring to the visible area of the window and not to all the document, in such a way I will always have to type only a 1 or 2 digit number when navigating.

For instance typing M-g M-g 3 RET I would like to go to the third visible line and not the third line of the document.

Thank you!


texts: noweb function call with variable arguments

texts:
I get error "reference y not found in this buffer" when trying to evaluate cubed-plus-cubed:

#+NAME: cubed
#+BEGIN_SRC python :var x=3
return x * x * x
#+END_SRC

#+RESULTS: cubed
: 27

#+NAME: cubed-plus-cubed
#+BEGIN_SRC python :var y=0 :noweb eval
<<cubed(x=y)>> + <<cubed(x=y)>>
#+END_SRC

Why does not it work?

I also imagine my philosophy here could be all wrong and all this is done very differently in practice.


texts:
I have the following line in my .emacs.d/init.el file

(global-set-key [(control tab)]  'other-window)
;; remap f1 to undo
(global-set-key (kbd "<f1>") 'undo)

When I use the full X-window GUI version of emacs, the commands works fine.  When I start using the -nw options to use Emacs in a terminal, they don't work at all.

What am I doing wrong?


texts:
This is a bit of a long shot, but I'm going to ask anyway.
Kinda similar to what dired-at-point and find-file-at-point

When point is inside a .txt file on a line like this

ls -la /tmp/

When point is at the beginning of that line, is there something like shell-command-at-point where the shell command on that line is executed and the output is displayed in the echo area?  The other way to do it is I guess to yank the line, M-| paste RET.

I think Org mode has this feature [[shell:ls -la /tmp/][example], but I'm looking for a general purpose solution.


texts: How to disable stack with flycheck for Haskell?

texts:
I'm on nixos and due to stack's integration with Nix/Nixos the following command is very slow:

time stack ghc
ghc: no input files
Usage: For basic information, try the `--help' option.
stack ghc  1.14s user 0.13s system 95% cpu 1.324 total

This means after a few keystrokes the emacs editor hangs... So I usually uninstall stack to remove it from the $PATH.

How can I disable this, to avoid this really frustrating delay?

In the messages:

haskell-stack-ghc: Flycheck checker haskell-stack-ghc returned non-zero exit code 1,

I have tried adding:

(add-to-list '(flycheck-disabled-checkers '(haskell-stack-ghc)))

to my init file, but there was no change in behavior.


texts: #000000 and true black in terminal Emacs colors

texts:
I just ran into a weird issue while tweaking my colour theme for terminal Emacs. The background wasn't appearing as black as expected, but grey, even though the background was set to #000000. So I opened the 'customize-face' dialog, and then opened the 'choose colour' option for background. This presents the following list:

Notice that the first colour, black, is actually grey, despite being listed as #000000. Stranger, is there is a second colour named color-16, with the same code #000000, and it is full black (see the bottom of the image).

The upshot is if I set a colour to #000000 or black, I actually get grey, but if I set the colour to color-16, I get black.

This doesn't happen in GUI Emacs, where #000000 is called black, and produces true black. There is no color-16 in my GUI emacs.

This is a bit awkward as I'd like to have the same color theme for GUI and terminal emacs, but black seems to mean different things. Can anyone explain this?

Emacs 27.0.50
Debian Linux
gnome terminal


texts:
In a recent answer by lunaryorn, he stated:

  However, I'd recommend against most other parts of Org, for reasons
  already stated in comments: It's old, and full of legacy and harmful
  practices (e.g. find-file-noselect to read files non-interactively).

Can anyone explain why is find-file-noselect a bad idea to read files in Elisp programs? Is there a better way? I'm asking because I was thinking of using it in one of my projects.


texts: How to use the inserting commands/functions in the mini-buffer?

texts:
Assume that I have defined a function like below with some keybinding (e.g.M-p).

(defun foo () (interactive)
(insert "something very long") )

(global-set-key [(meta p)] 'foo)

If I hit M-p while the cursor is at the main buffer, of course the text something very long is inserted. But when the cursor is at mini-buffer by hitting M-p the text foo is inserted.

Is there a way to redefine this function in such a way to work in both main buffer and mini-buffer?


texts: How to revert Dired drag and drop for dirs to old behavior?

texts:
When I drag and drop a directory to Dired in Emacs 26.3, it copies the directory (and its contents) to the directory that Emacs is showing.  This is like the behavior in MS Windows explorer.
I don't like that!, at least not for Emacs.
I prefer the old behavior where dired will rather just list that directory in Dired.
Can anyone please tell me what to hack to get back that old behavior?  (Google did not provide me an answer, alas.)


texts: Delete word backward without coping it to buffer

texts:
(I feel like there should be duplicate for this, but I could not find it. Pardon me.)

Question

How can I delete word backwards without it being copied to buffer?

Explanation

I developed a habit of coping text from somewhere, coming to emacs, using M-Backspace to delete some text, and then yank (C-y). Unfortunately, it is bound to backward-kill-word, which "overwrites" whatever I just copied from another place. I am looking for  delete-backward-char-like functionality, but for words (like delete-backward-word) and I want it to be bound to M-Backspace. I suspect I just don't use emacs properly or "not thinking the emacs way". Should I change my habit? If so, then how?


texts: Debugger entered--Lisp error: (wrong-type-argument wholenump -47) when press 'enter' in orgorg

texts:
Every time, I press 'Enter' in org docs
it prompts

Debugger entered--Lisp error: (wrong-type-argument wholenump -47)
  make-list(-47 nil)
  lisp-indent-initial-state()
  indent-sexp()
  paredit-newline()
  funcall-interactively(paredit-newline)
  call-interactively(paredit-newline nil nil)
  command-execute(paredit-newline)

google search returns few answer to the debugger error.

What's the problem?


texts: Find variable definition and uses in emacs-lisp files?

texts:
Is it possible to find/jump/point to where an Emacs LISP variable is used/defined within the current file? I know about find-variable, describe-variable and find-symbol, but those all seem to work only on globally defined symbols. I would like something that I can use to quickly examine the current file.

I recently started learning Racket, and in using the DrRacket IDE, I found it has this feature, which I find extremely useful:

It would be great to have this feature in Emacs for emacs-lisp (and of course, for other languages as well).


texts: How to apply flycheck right after a new file is opened

texts:
I am using flycheck for for Python. I want flycheck to detect any errors right away when any Python file is opened. Currently it can detect if there is a modification and save operation is performed.
Let's say I have following code in hello.py file:
#!/usr/bin/env python3

import os

print(os.getpid())

Than I have commented out print(os.getpid()) and close the file and reopened it. At this stage flycheck does not detect that 'os' imported but unused [F401]. I have to make some moditifications and save the file for it do detect it.

my setup:
(require 'flycheck)
(require 'flycheck-mypy)

(setq python-shell-interpreter "python3"
      python-shell-prompt-detect-failure-warning nil
      flycheck-python-pycompile-executable "python3"
      python-shell-completion-native-enable nil
      python-shell-completion-native-disabled-interpreters '("python3")
      elpy-shell-echo-output nil ;
      )

(add-hook 'python-mode-hook
      (lambda ()
        ;; (setq flycheck-mypyrc "~/venv/bin/pylint")
        (setq flycheck-python-pylint-executable "~/venv/bin/pylint")
        (local-set-key (kbd "C-c C-b") 'break-point)
        (setq flycheck-pylintrc "~/.pylintrc")))

I am also using Getting flycheck “jump to next/previous error” to cycle, it won't also able to detect it till save is done.


texts:
I've got this

(defun testor (s)
  (if (or (< s 1) (> s 21)) (message "Bad")
    (message "good")))

which works. But a similar

(defun test2 (n)
  (pcase n
    ((pred (< n 1)) (message "bad"))
    ((pred (> n 21)) (message "bad"))
    (n (message "%s" n))))

gives

(test2 0)
"0"

i.e., it's not flagging 0 as less than 1. What am I missing here? I'm on 26.2 and am in a emacs -q session.


texts: Closing magit's visit-file/blob window doesn't return focus back to magit

texts:
If Magit's log is open and you hit RET on any of the commits, it opens a visit file/blob window where you can see the diff with some details. There's a few ways to do it, but I believe in Doom Emacs the default is magit-diff-visit-file-other-window where it will spawn a new window if you only have one, otherwise it will try to use one of the existing windows.
If you only have 1 window open (with Magit status/log), it will spawn another window on the right side of the screen with commit details. After you close that window, you're back to your full-screen magit status/log buffer (OK).
However, if you already have a 2 windows open (e.g. vertically split), Magit will spawn the view-commit buffer in your other window, but after you close it (via q), it will not return focus to the status/log buffer, so you will have to do it manually. This is very disruptive if you're visiting many commits. I'm fairly positive this behaviour was different back when I was using an older Magit/Spacemacs a few years back, but I can't tell now whether it's new Magit's behaviour, or is it Doom Emacs or something else.
TL;DR: Magit doesn't return focus to status/log buffer after you close visit-file/blob window.
Notes:

I've tried searching through issues in magit repo but couldn't find anything matching, hence posting it here hoping someone might know the answer.
I'm running vanilla freshly installed Doom, with just a few lines of config, so I believe this would be easily reproducible.
Environment: macOS, brew-installed Emacs 27.1, latest vanilla Doom 2.0.9.


texts: Syntax highlighting (in Emacs) for SQL code in log files

texts:
How can we highlight SQL code in some log files, with Emacs?

Sample log file:

[DEBUG][2016-05-26 09:04:51,714][FileHelper] - [realContextPath=[/server.xml]]
[DEBUG][2016-05-26 10:24:22,369][DbConnectionImpl] - [DELETE FROM xct_log]
[DEBUG][2016-05-26 11:00:46,925][DataSourceRestrictionConverter] - [parseRestrictions]
[DEBUG][2016-05-26 10:24:22,476][DbConnectionImpl] - [UPDATE hlpdsk_step_log
SET table_name= 'hxct_log' WHERE
 table_name='xct_log' AND pkey_value = 247296]

The goal would be to put a light yellow background behind SQL code, that is:

code found between the last [...] (can be on multiple physical lines, as shown in the last line of the log sample), and
code found on lines where the "source" (3rd bracket pair) is "DbConnectionImpl".

If possible, the yellow background should only be between those last 2 brackets, on the right lines.

(Originally posted on StackOverflow, but advised to post it here.)


texts:
While in my agenda, I mark several TODOs as DONE as I complete them.

Is there a way to see what all was marked as DONE today?


texts: Saving and restoring highlighting patterns

texts:
I have some log files that I spend a lot of time reading, and I find myself doing the same series of commands to get useful highlighting each time I open a new log. Typically some combination of M-x highlight-phrase and M-x highlight-lines-matching-regexp.

What is the best way to consolidate this down to a single command (macro perhaps?) Or better yet, have the highlighting applied whenever I open a file matching a specific name pattern?


texts: Custom search function for dictionary lookup

texts:
I have a plain text dictionary in which each headword is matched by

^# \(† \)?headword,

How can I make a custom search function that relieves me of typing
the whole regex every time I want to look up a word?   I tried recording a keyboard macro, but that didn't work.


texts:
I am just curious:

Is there a way to run Emacs remotely from a webpage?

For example, one can set up a JupyterHub on a Ubuntu server so that many users can access server programs from a webpage. Can emacs be set up on a central server and accessed using webpages in a similar way?

(I know non-gui mode emacs can be executed in Juptyer's webpage-based terminal. I'm curious if a GUI version can be also executed from within a webpage)


texts: Given a list of (filepath line column), how to make this open as an xref buffer?

texts: If I have a list of file locations in elisp, how would I create an xref window, showing these locations?


texts: I am getting this message during startup of my Emacs, recently (since the update to Emacs 26?). I could not track down where is package is loaded and did not find anything related to this message in the web. It is not really a problem but I would like to know why my Emacs loads an obsolete package.


texts: Is there a hook that runs for all read only buffers

texts:
I want to enable show-trailing-whitespace for editable file and disable show-trailing-whitespace for read only files. I've tried

(defun my/read-only-whitespace ()
  (setq-local show-trailing-whitespace (not buffer-read-only)))

(setq-default show-trailing-whitespace t)
(add-hook 'read-only-mode-hook #'my/read-only-whitespace)

But this only only seems to work if I enable read-only-mode manually. When I open a buffer that becomes read-only automatically (e.g. a read-only file) then the hook is not run.

Is there a hook that runs for all read-only buffers?


texts: flycheck tslint reports no-implicit-dependencies for everything

texts:
I'm editing TypeScript using Tide, successfully, except that it complains about every single import statement.  For example:

import { GraphQLSchema } from 'graphql';

I see an error in the minibuffer:

  Module 'graphql' is not listed as dependency in package.json [no-implicit-dependencies]

My repository layout is like so:

<repository root>
\-- service
  +-- package.json
  +-- tslint.yml
  \-- src
    \-- something.ts

If I go and open up the package.json file it's right there, and if I run tslint outside Emacs or in a *shell* buffer it works fine.  All of the other type checking works fine and I happily get JavaScript type errors, it's just this one complaint, almost as if it's not finding package.json where it expects.


texts: How to remove MELPA repository from package-archives?

texts:
I added MELPA stable and MELPA repositories with

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

How can I remove one of them from the list so M-x package-list-packages does not show duplicate packages? Also, how could I print the list to see if the entry is really gone?


texts: How to do 'Hello World' in Emacs-LISP on Eshell and display evaluation in shell area itself, instead of echo area or *message* Buffer?

texts:
I am new to Emacs and struggling to learn it.

How to get rid of the line Emacs: command not found?

   ~/Documents $ eshell-source-file hello.el
   Emacs: command not found
   Hello World
   ~/Documents $