jangid

joined 1 year ago
[–] [email protected] 1 points 1 year ago

Following is my configuration for Python; I am using Emacs 29.1 --with-tree-sitter:

  (use-package treesit
    :config
    (setq treesit-language-source-alist
	  '((python . ("https://github.com/tree-sitter/tree-sitter-python.git"))))
    (add-to-list 'auto-mode-alist
		 `("\\.py[iw]?\\'\\|python[0-9.]*" . python-ts-mode)))

  (use-package eglot
    :hook ((python-mode . eglot-ensure)	; pip install 'python-language-server[all]'
	   (python-ts-mode . eglot-ensure)))
[–] [email protected] 1 points 1 year ago

I understand that. But we have to choose betweet --rebase, --no-rebase or --ff-only when git gets stuck.

[–] [email protected] 1 points 1 year ago (2 children)

If Magit is functioning correctly, it shouldn't error out when both the remote and local repos have been updated post the last sync. Currently, to resolve this, I resort to the CLI and run git pull --no-rebase, which prompts for a comment and creates a new commit upon saving.

I want exactly this behavior inside Magit. Is there a setting to do that?

[–] [email protected] 1 points 1 year ago (1 children)

I am okay with this approach. I just wanted to make sure that I am not missing anything. Magit claims that it provides all the features that are normally available via CLI route. So I thought may be `git pull --no-rebase` is hidden somewhere in the user interface.

 

When local repository moved ahead and remote also moved ahead, the remote doesn't allow Push. You have to first Pull. But sometimes pull doesn't work straight forward, you have to specify the merge strategy. This happens when `--ff-only` doesn't work for some reason.

In such a scenario, I normally use `--no-rebase` option. It creates a new commit with the merge. I can use `--rebase` also. But that is my personal preference. I want to keep the history of changes as is.

I couldn't find `--no-rebase` option in the Magit interface. Any idea, how to do that using Magit?

ChatGPT suggests that instead of direct Pull i.e. `F u`, I should first fetch and then merge i.e. `f u` followed by merging aka `m m`. Although, I haven't tried it yet. But just wanted to ask, if there is a direct way to achieve `--no-rebase` in Pull.

 

I had a very great setup using app-specific password till now. But now want to move to oauth2 because app-specific passwords will not work any more. So I changed my settings as follows,

;; older setting
;; ...
     (nnimap "gmail"
             (nnimap-address "imap.gmail.com")
             (nnimap-inbox "INBOX")
             (nnimap-expunge immediately)
             (nnimap-stream ssl))
;; ...

I looked for a solution, or rather asked ChatGPT about the oauth2.el thing. And it suggested the following,

;; new settings
;; ...
     (nnimap "gml"
             (nnimap-address "imap.gmail.com")
             (nnimap-inbox "INBOX")
             (nnimap-expunge immediately)
             (nnimap-stream ssl)
             (nnimap-authenticator oauth2)
             (nnimap-oauth2-client-id "client-id")
             (nnimap-oauth2-client-secret "client-secret")
             (nnimap-oauth2-credentials "~/.emacs.d/.gmail.oauth2-token"))
;; ...

I created a new project in Google Cloud Console, enabled Gmail API and generated client-id and client-secret for the above. But this doesn't seem to be working. When I launch Gnus (M-x gnus), it is stuck at "Openning connection to imap.gmail.com via tls...". Default browser is not launched for the oauth2 workflow.

I have tested the following code. It launches the default browser and works just fine,

(require 'oauth2)
(defvar my-oauth2-token 
  (oauth2-auth-and-store "https://accounts.google.com/o/oauth2/auth"
                         "https://accounts.google.com/o/oauth2/token"
                         "https://www.googleapis.com/auth/userinfo.email"
                         "client-id"
			 "client-secret"))

Has anyone here done this kind of configuration - gnus+gmail+oauth2?